Archive: ComponentOwl Rails app, DB backups, go redirect script

This commit is contained in:
EC2 Default User
2026-03-23 16:20:05 +00:00
commit 50037f386f
218 changed files with 14558 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
class AboutController < ApplicationController
caches_page :index, :press_resources
def index
@static_page = StaticPage['about']
end
def press_resources
@static_page = StaticPage['press-resources']
end
end

View File

@@ -0,0 +1,40 @@
class ActivationsController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :authenticate
before_filter :init_params, :only => :create
def create
@activation = Activation.new(params[:activation])
if @activation.save
respond_to do |format|
format.xml { render_activation_xml }
end
else
FailedActivation.create_from_activation(@activation)
respond_to do |format|
format.xml { render_activation_xml }
end
end
end
private
def render_activation_xml
render :xml => @activation.to_xml(:buy_url => order_url(featured_product), :support_url => support_contact_url)
end
def init_params
params[:activation] ||= {}
params[:activation][:ip] = request.remote_ip
end
def authenticate
authenticate_or_request_with_http_basic do |login, password|
login == Settings.activation_auth.login && password == Settings.activation_auth.password
end
end
end

View File

@@ -0,0 +1,101 @@
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
filter_parameter_logging :password
helper_method :locales, :newsletter_subscription, :crypted_subscriptions_path, :featured_product, :blog_url, :upgrade_url,
:dropdown_products, :order_products, :all_products, :blog_posts, :latest_news, :latest_comic,
:dropdown_categorized_products, :have_articles?
#include ExceptionNotifiable
include ExceptionNotification::Notifiable
# kvuli super_exception_notifier
# bez tohoto se vypisuje chybova stranka do layoutu prislusejiciho ke controlleru
@@error_layout = "application"
protect_from_forgery # See ActionController::RequestForgeryProtection for details
before_filter :enable_or_disable_cdn
helper :rails_wordpress
# disable cnd for certain parts of the application (/admin) and re-enable it if needed
def enable_or_disable_cdn
if defined?(CloudfrontAssetHost) && CloudfrontAssetHost.enabled
if request.path.starts_with?('/admin') && ActionController::Base.asset_host.present?
CloudfrontAssetHost.disable!
elsif !request.path.starts_with?('/admin') && ActionController::Base.asset_host.blank?
CloudfrontAssetHost.enable!
end
end
end
def upgrade_url(code)
root_url + "upgrade/#{StaticPage[code].url_param}"
end
# do newsletter engine
def crypted_subscriptions_path(contact)
subscriptions_url + "?contact=" + UrlParamCrypt.encrypt(contact.id)
end
def newsletter_subscription(location_code = nil)
subscription = Subscription.new
subscription.subscription_location = SubscriptionLocation[location_code] if location_code
subscription
end
def latest_comic
@latest_comic ||= Comic.latest
end
def blog_url
@blog_url ||= WpOption["siteurl"].value
end
def dropdown_products
@dropdown_products ||= [featured_product] + Promotion['dropdown'].products.all_ordered
end
def order_products
@order_products ||= ProductCategory.non_free_products
end
def featured_product
@featured_product ||= Product[Settings.featured_product]
end
def all_products
@all_products ||= Product.all_ordered
end
def blog_posts
@blog_posts ||= WpBlogPost.find(:all, :limit => Settings.home.blog_posts)
end
def latest_news
@latest_news ||= begin
latests = (Latest.find_latest + Release.find_latest).sort {|x, y| x.date <=> y.date }
latests.reverse.slice(0, Settings.home.latest)
end
end
def dropdown_categorized_products
@dropdown_categorized_products ||= [].tap do |a|
ProductCategory.all.each do |product_category|
products = []
dropdown_products.each do |dropdown_product|
products << dropdown_product if dropdown_product.product_category == product_category
end
#products.unshift(featured_product) if featured_product.product_category == product_category
a << { :category => product_category.name, :products => products } unless products.empty?
end
end
end
def have_articles?
!Article.published.empty?
end
end

View File

@@ -0,0 +1,33 @@
class ArticlesController < ApplicationController
caches_page :index, :show
def index
@featured_articles = Article.published.featured(Settings.resources.featured_articles)
@articles = Article.cute_ordered.published - @featured_articles
end
def show
@article = Article.find_by_slug(params[:id])
if @article
if @article.keyword1.present?
@meta_title = I18n.t('txt.articles.meta_title_with_keyword', :title => @article.title, :keyword => @article.keyword1)
else
@meta_title = I18n.t('txt.articles.meta_title', :title => @article.title)
end
if @article.custom_subtemplate.blank?
@subtemplate = SubtemplateType.with_keywords('article-sidebar', @article)
else
@subtemplate = @article.custom_subtemplate
end
respond_to do |format|
format.html
end
else
respond_to do |format|
format.html { render_404 }
end
end
end
end

View File

@@ -0,0 +1,22 @@
class Bmt::OrdersController < ApplicationController
before_filter :verify_api_token
def create
@bmt_order = BmtOrder.new(params[:request])
if @bmt_order.save
#@trackable_number = @bmt_order.customer_ref
#track_visitor(@bmt_order.orderable, :source => @bmt_order.track_from_other_source, :url => "BMT-Checkout", :checkout => true, :created_at => 1.minute.ago) if @bmt_order.track_checkout?
#track_visitor(@bmt_order.orderable, :source => "BMT-Checkout", :order => true)
respond_to do |format|
format.xml { render :xml => @bmt_order.xml_response }
end
else
respond_to do |format|
format.xml { render :xml => @bmt_order.xml_response }
end
end
end
end

View File

@@ -0,0 +1,28 @@
class ComicsController < ApplicationController
caches_page :show
def index
@comics = Comic.find_latest.published
respond_to do |format|
format.html { redirect_to latest_comic }
format.rss
end
end
def show
@comic = Comic.published.find_by_number(params[:id])
if @comic
@previous_comic = @comic.previous
@next_comic = @comic.next
else
@comic = Comic.published.find_by_id(params[:id])
if @comic
redirect_to @comic, :status => 301
else
render_404
end
end
end
end

View File

@@ -0,0 +1,6 @@
class CronController < ApplicationController
def resend_support_requests
Cron.resend_support_requests
render :nothing => true
end
end

View File

@@ -0,0 +1,15 @@
class DownloadController < ApplicationController
before_filter(:only => [:show]){ |c| c.find_product("download_url", UrlDestination['product-download']) }
before_filter :init_objects, :only => [:show]
private
def init_objects
@download_url = direct_download_url(:filename => @product.file_url)
@testimonial = @product.testimonial_by_location('download')
@meta_title = I18n.t('txt.download_page.meta_title', :product => @product.name.strip_version, :version => @product.current_version)
@meta_description = I18n.t('txt.download_page.meta_description', :product => @product.name.strip_version)
@meta_keywords = I18n.t('txt.download_page.meta_keywords', :product => @product.name.strip_version)
end
end

View File

@@ -0,0 +1,53 @@
class FaqsController < ApplicationController
before_filter :init_objects, :except => [:search]
before_filter :init_params, :only => [:search]
caches_page :index, :show
def index
render :action => "show"
end
def show
end
def search
#buga> uz budou mit dalsi produkty faqs, tohle se musi predelat
@product = featured_product
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @faqs }
end
end
private
def init_params
params[:search] ||= {}
params[:search] ||= {}
params[:search][:order] ||= "ascend_by_position"
@search = Faq.search(params[:search])
@faqs = @search.all
end
def init_objects
if params[:product]
@product = Product[params[:product]]
@categories = @product.faq_categories.all_ordered
else
@categories = FaqCategory.common
end
if params[:id]
@categories.each {|category| @category = category if category.url_param == params[:id] }
else
@category = @categories.first
end
@faqs = @category.faqs
@products = Product.all_ordered
end
end

View File

@@ -0,0 +1,15 @@
class FeedsController < ApplicationController
layout false
def index
posts = WpBlogPost.find(:all, :limit => Settings.rss.posts)
releases = Release.find_latest_for_rss
p = (posts + releases).sort {|x, y| x.date.to_datetime <=> y.date.to_datetime }
@posts = p.reverse.slice(0, Settings.rss.posts)
respond_to do |format|
format.rss
end
end
end

View File

@@ -0,0 +1,9 @@
class HomeController < ApplicationController
caches_page :index
def index
@static_page = StaticPage['home-blv20']
end
end

View File

@@ -0,0 +1,21 @@
class LandingPagesController < ApplicationController
before_filter :init_product
layout "simple"
caches_page :show
def show
@support_request = SupportRequest.new
@support_request.support_request_origin = SupportRequestOrigin['landing-page']
@support_request.product = @product
end
private
def init_product
@product = Product.find_by_code(params[:id])
end
end

View File

@@ -0,0 +1,33 @@
class OrdersController < ApplicationController
before_filter(:only => [:show]){ |c| c.find_product("order_url", UrlDestination['order']) }
before_filter :check_product, :only => :show
before_filter :init_objects
caches_page :index, :show
def index
redirect_to order_url(featured_product)
end
def show
@product = Product[params[:id]]
unless @product
render_404
else
@page = @product.product_pages.find_by_code(Settings.pricing_code)
end
end
private
def check_product
redirect_to Settings.better_splitbutton_buy_url if @product.code == 'better-splitbutton'
end
def init_objects
@support_request = SupportRequest.new
@support_request.support_request_origin = SupportRequestOrigin['order']
@support_request.product = @product
end
end

View File

@@ -0,0 +1,17 @@
class PadController < ApplicationController
caches_page :show
def show
# blba vyjimka
params[:id] = "mp3-speed-accelerator" if params[:id] == "mp3speedaccelerator"
@product = Product.find_by_file(params[:id])
if @product
respond_to do |format|
format.xml
end
else
render :nothing => true, :status => 404
end
end
end

View File

@@ -0,0 +1,9 @@
class ProductPagesController < ApplicationController
def show
@product_page = ProductPage.find(params[:id])
#sleep(2)
render :inline => @product_page.html
end
end

View File

@@ -0,0 +1,93 @@
class ProductsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:generate_license, :download]
before_filter :verify_api_token, :only => :generate_license
before_filter(:only => [:show]){ |c| c.find_product("product_url", UrlDestination['product-detail']) }
before_filter :init_objects, :only => [:show]
caches_page :index, :show, :if => Proc.new { |c| c.params[:detail] != Settings.releases_code }
def index
@categories = ProductCategory.all_but_featured
@all_categories = ProductCategory.find :all
@testimonials = Testimonial.for_products_page
end
def show
@special_menu_hl = true if @product.code == Settings.featured_product
@release = @product.current_release
@screenshots = @product.screenshots.featured
# future? pro ajaxove taby
#if params[:ajax]
# render :text => @detail.html
#end
end
def download
params[:filename] = featured_product.setup_file.original_filename.split(".").first if params[:filename] == "swifttodolist7-beta12"
@product = Product.find_by_file(params[:filename])
if @product
DownloadLog.log(@product, request)
if Rails.env.preproduction? || Rails.env.production?
redirect_to "http://#{Settings.download_host}/#{@product.setup_file.path}"
else
send_file @product.setup_file.path, :type => 'application/binary'
end
else
render_404
end
end
def detail
render :text => @detail.html
end
def generate_license
@license_key = BmtLicenseKey.new
@license_key.generate!
respond_to do |format|
format.xml { render :xml => @license_key }
end
end
private
def verify_generate_license_token
if !params[:t] || params[:t] != Settings.generate_license_token
render :nothing => true
end
end
def init_objects
if params[:detail]
case params[:detail]
when "features"
redirect_to(@product, :status => 301)
when "thumbnails"
redirect_to(Product['better-thumbnail-browser'], :status => 301)
when Settings.documentation_code
#redirect_to(product_page_url(@product, @product.product_pages.find_by_code("resources")))
redirect_to("/documentation/#{@product.code}/index.html")
when Settings.class_reference_code
redirect_to("/class-reference/#{@product.code}/index.html")
when Settings.quick_start_guide_code
redirect_to("/documentation/#{@product.code}/data/chapter-quickstart.html")
when Settings.releases_code
@since_release = @product.releases.find_by_version(params[:since]) if params[:since].present?
@since_release = @product.current_release unless @since_release
@releases = @product.releases.find_since(@since_release.version)
else
@detail = @product.product_pages.find_by_code(params[:detail])
render_404 unless @detail
end
else
@detail = @product.default_page
end
@support_request = SupportRequest.new
@support_request.support_request_origin = SupportRequestOrigin['product']
@support_request.product = @product
end
end

View File

@@ -0,0 +1,51 @@
class ReleasesController < ApplicationController
caches_page :show
def show
@release = Release.find(params[:id])
respond_to do |format|
format.html
format.js {
render :partial => "whatsnew", :layout => false
}
end
end
def check
edition = ProductEdition.find_by_internal_code(params[:product])
product = edition ? edition.product : Product.find_by_internal_code(params[:product])
release = product.current_release
new_version = release.newer_than(params[:build].to_i)
@response = ["### update check response ###"]
if new_version
releases = product.releases.find_newer_than(params[:build])
@response << release.version
@response << release.build
@response << I18n.l(release.date, :format => :iso)
@response << download_url(product)
@response << direct_download_url(:filename => product.file_url)
@response << "### changelog begin ###"
if releases.size == 1
@response << release.changelog
else
@response << "This cumulative update contains #{releases.size} previous updates that you have not installed."
@response << ""
releases.each do |release|
@response << "===================================================="
@response << "Changes in version #{release.version} (#{I18n.l(release.date, :format => :cute)})"
@response << "===================================================="
@response << release.changelog
@response << "" unless releases.last == release
end
end
@response << "### changelog end ###"
else
@response << "### no new version ###"
end
render :layout => false
end
end

View File

@@ -0,0 +1,11 @@
class ResourcesController < ApplicationController
caches_page :index
def index
@posts = WpBlogPost.find(:all, :limit => Settings.resources.blog_posts)
@featured_articles = Article.published.featured(Settings.resources.featured_articles)
@articles = Article.cute_ordered.published - @featured_articles
end
end

View File

@@ -0,0 +1,15 @@
class SitemapController < ApplicationController
caches_page :index, :if => Proc.new { |c| c.request.format.html? }
def index
@products = Product.all_ordered
@custom_titles = SitemapTitle.all
respond_to do |format|
format.html
format.xml
end
end
end

View File

@@ -0,0 +1,42 @@
class SubscriptionsController < ApplicationController
skip_before_filter :verify_authenticity_token
def index
@contact = Contact.find(UrlParamCrypt.decrypt(params[:contact]))
#prozatim takhle super primitivne
@contact.remove_trialwalkthrough_subscription(featured_product)
end
def from_download
@product = Product[params[:product]]
render :layout => "iframe"
end
def create
@subscription = Subscription.new(params[:subscription])
@callback = params[:callback] || "subscription_saved"
if @subscription.save_many
respond_to do |format|
format.html { render :text => "OK" }
format.js {
render :update do |page|
page.call @callback, params[:form_id]
end
}
end
else
respond_to do |format|
format.html { render :text => "ERROR" }
format.js {
render :update do |page|
page.call "subscription_not_saved", t('txt.support.unsaved_subscription')
end
}
end
end
end
end

View File

@@ -0,0 +1,44 @@
class SupportController < ApplicationController
before_filter(:only => [:show]){ |c| c.find_product("support_url", UrlDestination['support']) }
before_filter :init_objects
#layout "legal", :only => [:disclaimer, :privacy_policy]
# index a show nejde kesovat kvuli get parametru subject
caches_page :disclaimer, :privacy_policy, :eula, :customer_service
def index
end
def show
render :action => "index"
end
def disclaimer
@static_page = StaticPage['disclaimer']
end
def privacy_policy
@static_page = StaticPage['privacy-policy']
end
def eula
@static_page = StaticPage['eula']
end
def customer_service
@static_page = StaticPage['customer-service']
end
private
def init_objects
@dextronet_faqs = FaqCategory.top_dextronet_faqs
@products = Product.all_ordered.delete_if { |r| r.code == 'better-listview-express' }
@support_request = SupportRequest.new
@support_request.support_request_origin = SupportRequestOrigin['support']
@support_request.product = @product
end
end

View File

@@ -0,0 +1,25 @@
class UninstallController < ApplicationController
before_filter :init_objects
caches_page :index, :show
#layout "simple"
def index
end
def show
render :action => "index"
end
private
def init_objects
@product = Product.find_by_code(params[:id])
@support_request = SupportRequest.new
@support_request.support_request_origin = SupportRequestOrigin['why-uninstall']
@support_request.product = @product
end
end

View File

@@ -0,0 +1,15 @@
class UpgradeController < ApplicationController
caches_page :index
def index
@product = featured_product
@static_page = StaticPage.find_by_url_param(params[:upgrade])
@survey = Survey.new
@survey.product = @product
render_404 unless @static_page
end
end

View File

@@ -0,0 +1,39 @@
class WpController < ApplicationController
layout false
caches_page :header, :footer, :get_meta_tags, :get_page_include, :post_ad_stdl, :sidebar_ad,
:blv_sidebar_ad, :post_ad_blv
def sweep
SiteSweeper.sweep
render :nothing => true
end
def header
@blog = true
end
def footer
end
def get_meta_tags
end
def get_page_include
end
def get_tracker
end
def post_ad_stdl
end
def post_ad_blv
end
def sidebar_ad
end
def blv_sidebar_ad
end
end