diff options
Diffstat (limited to 'app')
34 files changed, 81 insertions, 81 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d93e68dab..5a8b1fe55 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -51,7 +51,7 @@ class AdminController < ApplicationController # For administration interface, return display name of authenticated user def admin_current_user - if Configuration::skip_admin_auth + if AlaveteliConfiguration::skip_admin_auth admin_http_auth_user else session[:admin_name] @@ -74,7 +74,7 @@ class AdminController < ApplicationController end def authenticate - if Configuration::skip_admin_auth + if AlaveteliConfiguration::skip_admin_auth session[:using_admin] = 1 return else @@ -98,7 +98,7 @@ class AdminController < ApplicationController end else authenticate_or_request_with_http_basic do |user_name, password| - if user_name == Configuration::admin_username && password == Configuration::admin_password + if user_name == AlaveteliConfiguration::admin_username && password == AlaveteliConfiguration::admin_password session[:using_admin] = 1 session[:admin_name] = user_name else diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 45a898759..56fd731fe 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -44,9 +44,9 @@ class AdminRequestController < AdminController # XXX is this *really* the only way to render a template to a # variable, rather than to the response? vars = OpenStruct.new(:name_to => @info_request.user_name, - :name_from => Configuration::contact_name, + :name_from => AlaveteliConfiguration::contact_name, :info_request => @info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(@info_request), + :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_url(@info_request), :site_name => site_name) template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.html.erb")) @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 57eca965e..f039390b3 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -243,6 +243,6 @@ class ApiController < ApplicationController private def make_url(*args) - "http://" + Configuration::domain + "/" + args.join("/") + "http://" + AlaveteliConfiguration::domain + "/" + args.join("/") end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 04fd0ed0e..e86bf5fb3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -51,12 +51,12 @@ class ApplicationController < ActionController::Base end def set_gettext_locale - if Configuration::include_default_locale_in_urls == false + if AlaveteliConfiguration::include_default_locale_in_urls == false params_locale = params[:locale] ? params[:locale] : I18n.default_locale else params_locale = params[:locale] end - if Configuration::use_default_browser_language + if AlaveteliConfiguration::use_default_browser_language requested_locale = params_locale || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale else requested_locale = params_locale || session[:locale] || cookies[:locale] || I18n.default_locale @@ -86,7 +86,7 @@ class ApplicationController < ActionController::Base # egrep "CONSUME MEMORY: [0-9]{7} KB" production.log around_filter :record_memory def record_memory - record_memory = Configuration::debug_record_memory + record_memory = AlaveteliConfiguration::debug_record_memory if record_memory logger.info "Processing request for #{request.url} with Rails process #{Process.pid}" File.read("/proc/#{Process.pid}/status").match(/VmRSS:\s+(\d+)/) @@ -342,10 +342,10 @@ class ApplicationController < ActionController::Base # def check_read_only - if !Configuration::read_only.empty? + if !AlaveteliConfiguration::read_only.empty? flash[:notice] = _("<p>{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.</p> <p>{{read_only}}</p>", :site_name => site_name, - :read_only => Configuration::read_only) + :read_only => AlaveteliConfiguration::read_only) redirect_to frontpage_url end @@ -552,10 +552,10 @@ class ApplicationController < ActionController::Base def country_from_ip country = "" - if !Configuration::gaze_url.empty? - country = quietly_try_to_open("#{Configuration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") + if !AlaveteliConfiguration::gaze_url.empty? + country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") end - country = Configuration::iso_country_code if country.empty? + country = AlaveteliConfiguration::iso_country_code if country.empty? return country end diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 34870bd42..e52be7cf8 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -21,7 +21,7 @@ class GeneralController < ApplicationController medium_cache # get some example searches and public bodies to display # either from config, or based on a (slow!) query if not set - body_short_names = Configuration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ") + body_short_names = AlaveteliConfiguration::frontpage_publicbody_examples.split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ") @locale = self.locale_from_params() locale_condition = 'public_body_translations.locale = ?' conditions = [locale_condition, @locale] @@ -71,7 +71,7 @@ class GeneralController < ApplicationController def blog medium_cache @feed_autodetect = [] - @feed_url = Configuration::blog_feed + @feed_url = AlaveteliConfiguration::blog_feed separator = @feed_url.include?('?') ? '&' : '?' @feed_url = "#{@feed_url}#{separator}lang=#{self.locale_from_params()}" @blog_items = [] @@ -84,7 +84,7 @@ class GeneralController < ApplicationController @feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}] end end - @twitter_user = Configuration::twitter_username + @twitter_user = AlaveteliConfiguration::twitter_username end # Just does a redirect from ?query= search to /query diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index be9c9f80b..5ab44fe1a 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -18,7 +18,7 @@ class HelpController < ApplicationController end def contact - @contact_email = Configuration::contact_email + @contact_email = AlaveteliConfiguration::contact_email # if they clicked remove for link to request/body, remove it if params[:remove] diff --git a/app/controllers/holiday_controller.rb b/app/controllers/holiday_controller.rb index 3101c07e3..939f26776 100644 --- a/app/controllers/holiday_controller.rb +++ b/app/controllers/holiday_controller.rb @@ -12,7 +12,7 @@ class HolidayController < ApplicationController def due_date if params[:holiday] @request_date = Date.strptime(params[:holiday]) or raise "Invalid date" - @due_date = Holiday.due_date_from(@request_date, Configuration::reply_late_after_days, Configuration::working_or_calendar_days) + @due_date = Holiday.due_date_from(@request_date, AlaveteliConfiguration::reply_late_after_days, AlaveteliConfiguration::working_or_calendar_days) @skipped = Holiday.all( :conditions => [ 'day >= ? AND day <= ?', @request_date.strftime("%F"), @due_date.strftime("%F") diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 680833ae4..a1c649888 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -28,7 +28,7 @@ class RequestController < ApplicationController def select_authority # Check whether we force the user to sign in right at the start, or we allow her # to start filling the request anonymously - if Configuration::force_registration_on_new_request && !authenticated?( + if AlaveteliConfiguration::force_registration_on_new_request && !authenticated?( :web => _("To send your FOI request"), :email => _("Then you'll be allowed to send FOI requests."), :email_subject => _("Confirm your email address") @@ -44,7 +44,7 @@ class RequestController < ApplicationController end def show - if !Configuration::varnish_host.blank? + if !AlaveteliConfiguration::varnish_host.blank? # If varnish is set up to accept PURGEs, then cache for a # long time long_cache @@ -369,7 +369,7 @@ class RequestController < ApplicationController replied by then.</p> <p>If you write about this request (for example in a forum or a blog) please link to this page, and add an annotation below telling people about your writing.</p>",:law_used_full=>@info_request.law_used_full, - :late_number_of_days => Configuration::reply_late_after_days) + :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) redirect_to show_new_request_path(:url_title => @info_request.url_title) end @@ -458,7 +458,7 @@ class RequestController < ApplicationController flash[:notice] = _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(@info_request.date_response_required_by)) redirect_to request_url(@info_request) elsif calculated_status == 'waiting_response_very_overdue' - flash[:notice] = _("<p>Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.</p>", :very_late_number_of_days => Configuration::reply_very_late_after_days, :late_number_of_days => Configuration::reply_late_after_days) + flash[:notice] = _("<p>Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.</p>", :very_late_number_of_days => AlaveteliConfiguration::reply_very_late_after_days, :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) redirect_to unhappy_url(@info_request) elsif calculated_status == 'not_held' flash[:notice] = _("<p>Thank you! Here are some ideas on what to do next:</p> @@ -490,7 +490,7 @@ class RequestController < ApplicationController elsif calculated_status == 'gone_postal' redirect_to respond_to_last_url(@info_request) + "?gone_postal=1" elsif calculated_status == 'internal_review' - flash[:notice] = _("<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within {{late_number_of_days}} days, or be told if it will take longer (<a href=\"{{review_url}}\">details</a>).</p>",:late_number_of_days => Configuration.reply_late_after_days, :review_url => unhappy_url(@info_request) + "#internal_review") + flash[:notice] = _("<p>Thank you! Hopefully your wait isn't too long.</p><p>You should get a response within {{late_number_of_days}} days, or be told if it will take longer (<a href=\"{{review_url}}\">details</a>).</p>",:late_number_of_days => AlaveteliConfiguration.reply_late_after_days, :review_url => unhappy_url(@info_request) + "#internal_review") redirect_to request_url(@info_request) elsif calculated_status == 'error_message' flash[:notice] = _("<p>Thank you! We'll look into what happened and try and fix it up.</p><p>If the error was a delivery failure, and you can find an up to date FOI email address for the authority, please tell us using the form below.</p>") @@ -896,10 +896,10 @@ class RequestController < ApplicationController if !File.exists?(file_path) FileUtils.mkdir_p(File.dirname(file_path)) Zip::ZipFile.open(file_path, Zip::ZipFile::CREATE) { |zipfile| - convert_command = Configuration::html_to_pdf_command + convert_command = AlaveteliConfiguration::html_to_pdf_command done = false if !convert_command.blank? && File.exists?(convert_command) - url = "http://#{Configuration::domain}#{request_url(@info_request)}?print_stylesheet=1" + url = "http://#{AlaveteliConfiguration::domain}#{request_url(@info_request)}?print_stylesheet=1" tempfile = Tempfile.new('foihtml2pdf') output = AlaveteliExternalCommand.run(convert_command, url, tempfile.path) if !output.nil? diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 1db5348c7..35c178aac 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -6,7 +6,7 @@ class ServicesController < ApplicationController def other_country_message text = "" - iso_country_code = Configuration::iso_country_code.downcase + iso_country_code = AlaveteliConfiguration::iso_country_code.downcase if country_from_ip.downcase != iso_country_code found_country = WorldFOIWebsites.by_code(country_from_ip) @@ -36,9 +36,9 @@ class ServicesController < ApplicationController :content_type => "text/plain", :layout => false, :locals => {:name_to => info_request.user_name, - :name_from => Configuration::contact_name, + :name_from => AlaveteliConfiguration::contact_name, :info_request => info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(info_request), + :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_url(info_request), :site_name => site_name} end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 80c27ffd4..c1f9661b7 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -136,7 +136,7 @@ class UserController < ApplicationController # Login form def signin work_out_post_redirect - @request_from_foreign_country = country_from_ip != Configuration::iso_country_code + @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code # make sure we have cookies if session.instance_variable_get(:@dbman) if not session.instance_variable_get(:@dbman).instance_variable_get(:@original) @@ -190,7 +190,7 @@ class UserController < ApplicationController # Create new account form def signup work_out_post_redirect - @request_from_foreign_country = country_from_ip != Configuration::iso_country_code + @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code # Make the user and try to save it @user_signup = User.new(params[:user_signup]) error = false diff --git a/app/helpers/config_helper.rb b/app/helpers/config_helper.rb index 73e12172f..026600ff1 100644 --- a/app/helpers/config_helper.rb +++ b/app/helpers/config_helper.rb @@ -1,5 +1,5 @@ module ConfigHelper def site_name - Configuration::site_name + AlaveteliConfiguration::site_name end -end
\ No newline at end of file +end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 030fab20b..74de5eb6d 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -219,7 +219,7 @@ module LinkToHelper # Admin pages def admin_url(relative_path) - admin_url_prefix = Configuration::admin_base_url + admin_url_prefix = AlaveteliConfiguration::admin_base_url (admin_url_prefix.empty? ? admin_general_index_url + '/' : admin_url_prefix) + relative_path end @@ -238,7 +238,7 @@ module LinkToHelper def main_url(relative_path, append = nil) - url_prefix = "http://" + Configuration::domain + url_prefix = "http://" + AlaveteliConfiguration::domain url = url_prefix + relative_path if !append.nil? begin diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index be2ce47aa..3d4bbac71 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -1,5 +1,5 @@ module MailerHelper def contact_from_name_and_email - "#{Configuration::contact_name} <#{Configuration::contact_email}>" + "#{AlaveteliConfiguration::contact_name} <#{AlaveteliConfiguration::contact_email}>" end end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3877c4a33..e4178081f 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -15,7 +15,7 @@ class ApplicationMailer < ActionMailer::Base self.raise_delivery_errors = true def blackhole_email - Configuration::blackhole_prefix+"@"+Configuration::incoming_email_domain + AlaveteliConfiguration::blackhole_prefix+"@"+AlaveteliConfiguration::incoming_email_domain end # URL generating functions are needed by all controllers (for redirects), diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index b990e38f4..383f1a6e6 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -39,7 +39,7 @@ class ContactMailer < ApplicationMailer mail(:from => contact_from_name_and_email, :to => recipient_user.name_and_email, - :bcc => Configuration::contact_email, + :bcc => AlaveteliConfiguration::contact_email, :subject => subject) end end diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb index 14277ae8b..c602359de 100644 --- a/app/mailers/outgoing_mailer.rb +++ b/app/mailers/outgoing_mailer.rb @@ -15,7 +15,7 @@ class OutgoingMailer < ApplicationMailer # Email to public body requesting info def initial_request(info_request, outgoing_message) - @info_request, @outgoing_message, @contact_email = info_request, outgoing_message, Configuration::contact_email + @info_request, @outgoing_message, @contact_email = info_request, outgoing_message, AlaveteliConfiguration::contact_email @wrap_lines_as_paragraphs = true headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message) @@ -26,7 +26,7 @@ class OutgoingMailer < ApplicationMailer # Later message to public body regarding existing request def followup(info_request, outgoing_message, incoming_message_followup) - @info_request, @outgoing_message, @incoming_message_followup, @contact_email = info_request, outgoing_message, incoming_message_followup, Configuration::contact_email + @info_request, @outgoing_message, @incoming_message_followup, @contact_email = info_request, outgoing_message, incoming_message_followup, AlaveteliConfiguration::contact_email @wrap_lines_as_paragraphs = true headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message) @@ -88,7 +88,7 @@ class OutgoingMailer < ApplicationMailer message_id = "ogm-" + outgoing_message.id.to_s t = Time.now message_id += "+" + '%08x%05x-%04x' % [t.to_i, t.tv_usec, rand(0xffff)] - message_id += "@" + Configuration::incoming_email_domain + message_id += "@" + AlaveteliConfiguration::incoming_email_domain return "<" + message_id + ">" end diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb index 0e3025c73..750f6f9b5 100644 --- a/app/mailers/request_mailer.rb +++ b/app/mailers/request_mailer.rb @@ -46,7 +46,7 @@ class RequestMailer < ApplicationMailer attachments.inline["original.eml"] = raw_email_data @info_request = info_request - @contact_email = Configuration::contact_email + @contact_email = AlaveteliConfiguration::contact_email mail(:to => email.from_addrs[0].to_s, :from => contact_from_name_and_email, @@ -337,7 +337,7 @@ class RequestMailer < ApplicationMailer # Send email alerts for new responses which haven't been classified. By default, # it goes out 3 days after last update of event, then after 10, then after 24. def self.alert_new_response_reminders - Configuration::new_response_reminder_after_days.each_with_index do |days, i| + AlaveteliConfiguration::new_response_reminder_after_days.each_with_index do |days, i| self.alert_new_response_reminders_internal(days, "new_response_reminder_#{i+1}") end end diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb index 1ddce4a7e..263b406e9 100644 --- a/app/mailers/track_mailer.rb +++ b/app/mailers/track_mailer.rb @@ -26,7 +26,7 @@ class TrackMailer < ApplicationMailer end def contact_from_name_and_email - "#{Configuration::track_sender_name} <#{Configuration::track_sender_email}>" + "#{AlaveteliConfiguration::track_sender_name} <#{AlaveteliConfiguration::track_sender_email}>" end # Send email alerts for tracked things. Never more than one email diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 80219ba63..ae63e9db8 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -193,7 +193,7 @@ class IncomingMessage < ActiveRecord::Base text.gsub!(self.info_request.public_body.request_email, _("[{{public_body}} request email]", :public_body => self.info_request.public_body.short_or_long_name)) end text.gsub!(self.info_request.incoming_email, _('[FOI #{{request}} email]', :request => self.info_request.id.to_s) ) - text.gsub!(Configuration::contact_email, _("[{{site_name}} contact email]", :site_name => Configuration::site_name) ) + text.gsub!(AlaveteliConfiguration::contact_email, _("[{{site_name}} contact email]", :site_name => AlaveteliConfiguration::site_name) ) end # Replaces all email addresses in (possibly binary data) with equal length alternative ones. @@ -219,7 +219,7 @@ class IncomingMessage < ActiveRecord::Base if censored_uncompressed_text != uncompressed_text # then use the altered file (recompressed) recompressed_text = nil - if Configuration::use_ghostscript_compression == true + if AlaveteliConfiguration::use_ghostscript_compression == true command = ["gs", "-sDEVICE=pdfwrite", "-dCompatibilityLevel=1.4", "-dPDFSETTINGS=/screen", "-dNOPAUSE", "-dQUIET", "-dBATCH", "-sOutputFile=-", "-"] else command = ["pdftk", "-", "output", "-", "compress"] @@ -316,7 +316,7 @@ class IncomingMessage < ActiveRecord::Base text.gsub!(/(Mobile|Mob)([\s\/]*(Fax|Tel))*\s*:?[\s\d]*\d/, "[mobile number]") # Remove WhatDoTheyKnow signup links - text.gsub!(/http:\/\/#{Configuration::domain}\/c\/[^\s]+/, "[WDTK login link]") + text.gsub!(/http:\/\/#{AlaveteliConfiguration::domain}\/c\/[^\s]+/, "[WDTK login link]") # Remove things from censor rules self.info_request.apply_censor_rules_to_text!(text) @@ -534,7 +534,7 @@ class IncomingMessage < ActiveRecord::Base source_charset = 'utf-8' if source_charset.nil? text = Iconv.conv('utf-8//IGNORE', source_charset, text) + _("\n\n[ {{site_name}} note: The above text was badly encoded, and has had strange characters removed. ]", - :site_name => Configuration::site_name) + :site_name => AlaveteliConfiguration::site_name) rescue Iconv::InvalidEncoding, Iconv::IllegalSequence, Iconv::InvalidCharacter if source_charset != "utf-8" source_charset = "utf-8" diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 913d053bf..5f5cc28c7 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -665,7 +665,7 @@ public # last_event_forming_initial_request. There may be more obscure # things, e.g. fees, not properly covered. def date_response_required_by - Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::reply_late_after_days, Configuration::working_or_calendar_days) + Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::reply_late_after_days, AlaveteliConfiguration::working_or_calendar_days) end # This is a long stop - even with UK public interest test extensions, 40 # days is a very long time. @@ -673,10 +673,10 @@ public last_sent = last_event_forming_initial_request if self.public_body.is_school? # schools have 60 working days maximum (even over a long holiday) - Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::special_reply_very_late_after_days, Configuration::working_or_calendar_days) + Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::special_reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days) else # public interest test ICO guidance gives 40 working maximum - Holiday.due_date_from(self.date_initial_request_last_sent_at, Configuration::reply_very_late_after_days, Configuration::working_or_calendar_days) + Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days) end end @@ -876,10 +876,10 @@ public end def InfoRequest.magic_email_for_id(prefix_part, id) - magic_email = Configuration::incoming_email_prefix + magic_email = AlaveteliConfiguration::incoming_email_prefix magic_email += prefix_part + id.to_s magic_email += "-" + InfoRequest.hash_from_id(id) - magic_email += "@" + Configuration::incoming_email_domain + magic_email += "@" + AlaveteliConfiguration::incoming_email_domain return magic_email end @@ -890,7 +890,7 @@ public end def InfoRequest.hash_from_id(id) - return Digest::SHA1.hexdigest(id.to_s + Configuration::incoming_email_secret)[0,8] + return Digest::SHA1.hexdigest(id.to_s + AlaveteliConfiguration::incoming_email_secret)[0,8] end # Called by find_by_incoming_email - and used to be called by separate @@ -1118,7 +1118,7 @@ public before_save :purge_in_cache def purge_in_cache - if !Configuration::varnish_host.blank? && !self.id.nil? + if !AlaveteliConfiguration::varnish_host.blank? && !self.id.nil? # we only do this for existing info_requests (new ones have a nil id) path = url_for(:controller => 'request', :action => 'show', :url_title => self.url_title, :only_path => true, :locale => :none) req = PurgeRequest.find_by_url(path) diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb index 755584b90..77cd23a96 100644 --- a/app/models/mail_server_log.rb +++ b/app/models/mail_server_log.rb @@ -53,7 +53,7 @@ class MailServerLog < ActiveRecord::Base done.save! f = is_gz ? Zlib::GzipReader.open(file_name) : File.open(file_name, 'r') - case(Configuration::mta_log_type.to_sym) + case(AlaveteliConfiguration::mta_log_type.to_sym) when :exim load_exim_log_data(f, done) when :postfix @@ -123,13 +123,13 @@ class MailServerLog < ActiveRecord::Base # We also check the email prefix so that we could, for instance, separately handle a staging and production # instance running on the same server with different email prefixes. def MailServerLog.email_addresses_on_line(line) - prefix = Regexp::quote(Configuration::incoming_email_prefix) - domain = Regexp::quote(Configuration::incoming_email_domain) + prefix = Regexp::quote(AlaveteliConfiguration::incoming_email_prefix) + domain = Regexp::quote(AlaveteliConfiguration::incoming_email_domain) line.scan(/#{prefix}request-[^\s]+@#{domain}/).sort.uniq end def MailServerLog.request_sent?(ir) - case(Configuration::mta_log_type.to_sym) + case(AlaveteliConfiguration::mta_log_type.to_sym) when :exim request_exim_sent?(ir) when :postfix diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 93737ba1b..784cf19e2 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -88,7 +88,7 @@ class OutgoingMessage < ActiveRecord::Base "'" + self.info_request.title + "'." + "\n\n\n\n [ " + self.get_internal_review_insert_here_note + " ] \n\n\n\n" + "A full history of my FOI request and all correspondence is available on the Internet at this address:\n" + - "http://" + Configuration::domain + "/request/" + self.info_request.url_title + "http://" + AlaveteliConfiguration::domain + "/request/" + self.info_request.url_title else "" end diff --git a/app/models/public_body.rb b/app/models/public_body.rb index a06e0d253..a76aeb189 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -332,7 +332,7 @@ class PublicBody < ActiveRecord::Base pb = PublicBody.new( :name => 'Internal admin authority', :short_name => "", - :request_email => Configuration::contact_email, + :request_email => AlaveteliConfiguration::contact_email, :home_page => "", :notes => "", :publication_scheme => "", @@ -548,7 +548,7 @@ class PublicBody < ActiveRecord::Base # Returns nil if configuration variable not set def override_request_email - e = Configuration::override_all_public_body_request_emails + e = AlaveteliConfiguration::override_all_public_body_request_emails e if e != "" end diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb index 77705b0f6..032839b2f 100644 --- a/app/models/raw_email.rb +++ b/app/models/raw_email.rb @@ -26,7 +26,7 @@ class RawEmail < ActiveRecord::Base if Rails.env.test? return File.join(Rails.root, 'files/raw_email_test') else - return File.join(Configuration::raw_emails_location, + return File.join(AlaveteliConfiguration::raw_emails_location, request_id[0..2], request_id) end end diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index dfe92b7fe..8dbeaca7e 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -258,7 +258,7 @@ class TrackThing < ActiveRecord::Base :title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", :title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", # Authentication - :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>Configuration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)), + :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>AlaveteliConfiguration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)), :email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.", :public_body_name=>CGI.escapeHTML(self.public_body.name)), :email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'", :public_body_name=>self.public_body.name), # RSS sorting diff --git a/app/models/user.rb b/app/models/user.rb index d16a9452a..63dd5b1dd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -188,12 +188,12 @@ class User < ActiveRecord::Base # The "internal admin" is a special user for internal use. def User.internal_admin_user - u = User.find_by_email(Configuration::contact_email) + u = User.find_by_email(AlaveteliConfiguration::contact_email) if u.nil? password = PostRedirect.generate_random_token u = User.new( :name => 'Internal admin user', - :email => Configuration::contact_email, + :email => AlaveteliConfiguration::contact_email, :password => password, :password_confirmation => password ) @@ -266,16 +266,16 @@ class User < ActiveRecord::Base return false if self.no_limit # Has the user issued as many as MAX_REQUESTS_PER_USER_PER_DAY requests in the past 24 hours? - return false if Configuration::max_requests_per_user_per_day.blank? + return false if AlaveteliConfiguration::max_requests_per_user_per_day.blank? recent_requests = InfoRequest.count(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id]) - return (recent_requests >= Configuration::max_requests_per_user_per_day) + return (recent_requests >= AlaveteliConfiguration::max_requests_per_user_per_day) end def next_request_permitted_at return nil if self.no_limit - n_most_recent_requests = InfoRequest.all(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id], :order => "created_at DESC", :limit => Configuration::max_requests_per_user_per_day) - return nil if n_most_recent_requests.size < Configuration::max_requests_per_user_per_day + n_most_recent_requests = InfoRequest.all(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id], :order => "created_at DESC", :limit => AlaveteliConfiguration::max_requests_per_user_per_day) + return nil if n_most_recent_requests.size < AlaveteliConfiguration::max_requests_per_user_per_day nth_most_recent_request = n_most_recent_requests[-1] return nth_most_recent_request.created_at + 1.day diff --git a/app/views/general/_footer.html.erb b/app/views/general/_footer.html.erb index ab5ab2c47..3ec4f40e6 100644 --- a/app/views/general/_footer.html.erb +++ b/app/views/general/_footer.html.erb @@ -1,6 +1,6 @@ <div id="footer"> <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_url %> -| <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= Configuration::twitter_username %>"><%= _("Follow us on twitter") %></a> +| <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>"><%= _("Follow us on twitter") %></a> <%= render :partial => 'general/credits' %> </div> <div class="after-footer"> </div> diff --git a/app/views/general/_stylesheet_includes.html.erb b/app/views/general/_stylesheet_includes.html.erb index 7a03680f8..5b6e12258 100644 --- a/app/views/general/_stylesheet_includes.html.erb +++ b/app/views/general/_stylesheet_includes.html.erb @@ -16,6 +16,6 @@ <![endif]--> <!-- the following method for customising CSS is deprecated; see `doc/THEMES.md` for detail --> <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet" %> - <% if Configuration::force_registration_on_new_request %> + <% if AlaveteliConfiguration::force_registration_on_new_request %> <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet" %> <% end %> diff --git a/app/views/general/blog.html.erb b/app/views/general/blog.html.erb index 07d6d2f14..707eadebb 100644 --- a/app/views/general/blog.html.erb +++ b/app/views/general/blog.html.erb @@ -7,9 +7,9 @@ <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/> <img src="/images/feed-16.png" alt="RSS icon" valign="middle"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a> </div> - <% if Configuration::twitter_widget_id %> + <% if AlaveteliConfiguration::twitter_widget_id %> <div id="twitter"> - <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= Configuration::twitter_username %>" data-widget-id="<%= Configuration::twitter_widget_id %>">Tweets by @<%= Configuration::twitter_username %></a> + <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>" data-widget-id="<%= AlaveteliConfiguration::twitter_widget_id %>">Tweets by @<%= AlaveteliConfiguration::twitter_username %></a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> </div> <% end %> diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 28d099984..da9bed4b3 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -42,7 +42,7 @@ <%= render :partial => 'general/before_head_end' %> </head> <body class="<%= 'front' if params[:action] == 'frontpage' %>"> - <% if Configuration::force_registration_on_new_request && !@user %> + <% if AlaveteliConfiguration::force_registration_on_new_request && !@user %> <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %> <script type="text/javascript"> $(document).ready(function() { @@ -139,13 +139,13 @@ <input type="text"> </div> <% - unless Configuration::ga_code.empty? || (@user && @user.super?) %> + unless AlaveteliConfiguration::ga_code.empty? || (@user && @user.super?) %> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> - var pageTracker = _gat._getTracker("<%= Configuration::ga_code %>"); + var pageTracker = _gat._getTracker("<%= AlaveteliConfiguration::ga_code %>"); pageTracker._trackPageview(); </script> diff --git a/app/views/request/_sidebar.html.erb b/app/views/request/_sidebar.html.erb index 781671529..6fac1e808 100644 --- a/app/views/request/_sidebar.html.erb +++ b/app/views/request/_sidebar.html.erb @@ -31,7 +31,7 @@ <h2><%= _("Act on what you've learnt") %></h2> <div class="act_link"> - <% tweet_link = "https://twitter.com/share?url=#{h(request.url)}&via=#{h(Configuration::twitter_username)}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %> + <% tweet_link = "https://twitter.com/share?url=#{h(request.url)}&via=#{h(AlaveteliConfiguration::twitter_username)}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %> <%= link_to tweet_link do %> <%= image_tag "twitter-16.png", :alt => "twitter icon" %> <% end %> diff --git a/app/views/request/simple_correspondence.html.erb b/app/views/request/simple_correspondence.html.erb index 0da9ef172..461fa3912 100644 --- a/app/views/request/simple_correspondence.html.erb +++ b/app/views/request/simple_correspondence.html.erb @@ -1,4 +1,4 @@ -<%= _('This is a plain-text version of the Freedom of Information request "{{request_title}}". The latest, full version is available online at {{full_url}}', :request_title => @info_request.title, :full_url => "http://#{Configuration::domain}#{show_request_path(:url_title=>@info_request.url_title)}") %>. +<%= _('This is a plain-text version of the Freedom of Information request "{{request_title}}". The latest, full version is available online at {{full_url}}', :request_title => @info_request.title, :full_url => "http://#{AlaveteliConfiguration::domain}#{show_request_path(:url_title=>@info_request.url_title)}") %>. <% for info_request_event in @info_request_events %> <% diff --git a/app/views/user/rate_limited.html.erb b/app/views/user/rate_limited.html.erb index d52deebab..54a4e0461 100644 --- a/app/views/user/rate_limited.html.erb +++ b/app/views/user/rate_limited.html.erb @@ -2,7 +2,7 @@ <h1><%=@title%></h1> -<p><%= _("You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}.", :max_requests_per_user_per_day => Configuration::max_requests_per_user_per_day, :can_make_another_request => distance_of_time_in_words(Time.now, @next_request_permitted_at))%></p> +<p><%= _("You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}.", :max_requests_per_user_per_day => AlaveteliConfiguration::max_requests_per_user_per_day, :can_make_another_request => distance_of_time_in_words(Time.now, @next_request_permitted_at))%></p> <p><%= _("There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please <a href='{{help_contact_path}}'>get in touch</a>.", :help_contact_path => help_contact_path) %></p> diff --git a/app/views/user/set_profile_about_me.html.erb b/app/views/user/set_profile_about_me.html.erb index c4b760307..fb7de7e97 100644 --- a/app/views/user/set_profile_about_me.html.erb +++ b/app/views/user/set_profile_about_me.html.erb @@ -26,7 +26,7 @@ <%= _(' Include relevant links, such as to a campaign page, your blog or a twitter account. They will be made clickable. e.g.')%> - <a href="https://twitter.com/<%= Configuration::twitter_username %>">https://twitter.com/<%= Configuration::twitter_username %></a> + <a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>">https://twitter.com/<%= AlaveteliConfiguration::twitter_username %></a> </p> </div> |