diff options
55 files changed, 133 insertions, 133 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> diff --git a/config/application.rb b/config/application.rb index 0e02e9e03..f5b525a36 100644 --- a/config/application.rb +++ b/config/application.rb @@ -53,7 +53,7 @@ module Alaveteli # Note that having set a zone, the Active Record # time_zone_aware_attributes flag is on, so times from models # will be in this time zone - config.time_zone = ::Configuration::time_zone + config.time_zone = ::AlaveteliConfiguration::time_zone config.after_initialize do require 'routing_filters.rb' @@ -62,8 +62,8 @@ module Alaveteli config.autoload_paths << "#{Rails.root.to_s}/lib/mail_handler" # See Rails::Configuration for more options - ENV['RECAPTCHA_PUBLIC_KEY'] = ::Configuration::recaptcha_public_key - ENV['RECAPTCHA_PRIVATE_KEY'] = ::Configuration::recaptcha_private_key + ENV['RECAPTCHA_PUBLIC_KEY'] = ::AlaveteliConfiguration::recaptcha_public_key + ENV['RECAPTCHA_PRIVATE_KEY'] = ::AlaveteliConfiguration::recaptcha_private_key # Insert a bit of middleware code to prevent uneeded cookie setting. require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions" diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 5ce519829..f5fdcf79d 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -40,22 +40,22 @@ ALAVETELI_VERSION = '0.6.8' # The Rails cache is set up by the Interlock plugin to use memcached # Domain for URLs (so can work for scripts, not just web pages) -ActionMailer::Base.default_url_options[:host] = Configuration::domain +ActionMailer::Base.default_url_options[:host] = AlaveteliConfiguration::domain # So that javascript assets use full URL, so proxied admin URLs read javascript OK -if (Configuration::domain != "") +if (AlaveteliConfiguration::domain != "") ActionController::Base.asset_host = Proc.new { |source, request| if ENV["RAILS_ENV"] != "test" && request.fullpath.match(/^\/admin\//) - Configuration::admin_public_url + AlaveteliConfiguration::admin_public_url else - Configuration::domain + AlaveteliConfiguration::domain end } end # fallback locale and available locales -available_locales = Configuration::available_locales.split(/ /) -default_locale = Configuration::default_locale +available_locales = AlaveteliConfiguration::available_locales.split(/ /) +default_locale = AlaveteliConfiguration::default_locale FastGettext.default_available_locales = available_locales I18n.locale = default_locale @@ -81,7 +81,7 @@ require 'public_body_categories' # Temporarily commented out the lines below on the Rails 3 spike. # TODO: Reinstate this properly! -#if !Configuration.exception_notifications_from.blank? && !Configuration.exception_notifications_to.blank? -# ExceptionNotification::Notifier.sender_address = Configuration::exception_notifications_from -# ExceptionNotification::Notifier.exception_recipients = Configuration::exception_notifications_to +#if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? +# ExceptionNotification::Notifier.sender_address = AlaveteliConfiguration::exception_notifications_from +# ExceptionNotification::Notifier.exception_recipients = AlaveteliConfiguration::exception_notifications_to #end diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index 1cd6440e4..752448a41 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -3,4 +3,4 @@ FastGettext.default_text_domain = 'app' I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) -RoutingFilter::Locale.include_default_locale = Configuration::include_default_locale_in_urls
\ No newline at end of file +RoutingFilter::Locale.include_default_locale = AlaveteliConfiguration::include_default_locale_in_urls diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 5277e8927..f82348169 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Alaveteli::Application.config.secret_token = Configuration::cookie_store_session_secret +Alaveteli::Application.config.secret_token = AlaveteliConfiguration::cookie_store_session_secret diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index 877149e9d..4c8967c97 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -3,7 +3,7 @@ $alaveteli_route_extensions = [] if ENV["RAILS_ENV"] != "test" # Don't let the themes interfere with Alaveteli specs - for url in Configuration::theme_urls.reverse + for url in AlaveteliConfiguration::theme_urls.reverse theme_name = url.sub(/.*\/(.*).git/, "\\1") theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ if File.exists? theme_main_include diff --git a/config/test.yml b/config/test.yml index ef270dcf2..ecd7c2898 100644 --- a/config/test.yml +++ b/config/test.yml @@ -1,7 +1,7 @@ # test.yml # Test values for the "general" config file. # -# Configuration parameters, in YAML syntax. +# AlaveteliConfiguration parameters, in YAML syntax. # # These may be values expected by the test suite; changing them may # break tests. diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb index 24b4b1aa8..ac91a5867 100644 --- a/lib/alaveteli_external_command.rb +++ b/lib/alaveteli_external_command.rb @@ -21,14 +21,14 @@ module AlaveteliExternalCommand program_path = program_name else found = false - Configuration::utility_search_path.each do |d| + AlaveteliConfiguration::utility_search_path.each do |d| program_path = File.join(d, program_name) if File.file? program_path and File.executable? program_path found = true break end end - raise "Could not find #{program_name} in any of #{Configuration::utility_search_path.join(', ')}" if !found + raise "Could not find #{program_name} in any of #{AlaveteliConfiguration::utility_search_path.join(', ')}" if !found end xc = ExternalCommand.new(program_path, *args) diff --git a/lib/configuration.rb b/lib/configuration.rb index d239b95f0..6d2bed66d 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -12,7 +12,7 @@ MySociety::Config.load_default # TODO: Make this return different values depending on the current rails environment -module Configuration +module AlaveteliConfiguration DEFAULTS = { :ADMIN_BASE_URL => '', :ADMIN_PASSWORD => '', @@ -68,7 +68,7 @@ module Configuration :WORKING_OR_CALENDAR_DAYS => 'working', } - def Configuration.method_missing(name) + def AlaveteliConfiguration.method_missing(name) key = name.to_s.upcase if DEFAULTS.has_key?(key.to_sym) MySociety::Config.get(key, DEFAULTS[key.to_sym]) diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake index 14aa15551..cbd3d123e 100644 --- a/lib/tasks/themes.rake +++ b/lib/tasks/themes.rake @@ -31,7 +31,7 @@ namespace :themes do if system(clone_command) Dir.chdir install_path do # First try to checkout a specific branch of the theme - tag_checked_out = checkout_remote_branch(Configuration::theme_branch) if Configuration::theme_branch + tag_checked_out = checkout_remote_branch(AlaveteliConfiguration::theme_branch) if AlaveteliConfiguration::theme_branch if !tag_checked_out # try to checkout a tag exactly matching ALAVETELI VERSION tag_checked_out = checkout_tag(ALAVETELI_VERSION) @@ -94,10 +94,10 @@ namespace :themes do desc "Install themes specified in the config file's THEME_URLS" task :install => :environment do verbose = true - Configuration::theme_urls.each{ |theme_url| install_theme(theme_url, verbose) } - if ! Configuration::theme_url.blank? + AlaveteliConfiguration::theme_urls.each{ |theme_url| install_theme(theme_url, verbose) } + if ! AlaveteliConfiguration::theme_url.blank? # Old version of the above, for backwards compatibility - install_theme(Configuration::theme_url, verbose, deprecated=true) + install_theme(AlaveteliConfiguration::theme_url, verbose, deprecated=true) end end -end
\ No newline at end of file +end diff --git a/lib/tasks/translation.rake b/lib/tasks/translation.rake index aab327d5b..351faef2c 100644 --- a/lib/tasks/translation.rake +++ b/lib/tasks/translation.rake @@ -156,7 +156,7 @@ namespace :translation do write_email(event_digest_email, 'Alerts on things the user is tracking', output_file) # user mailer - site_name = Configuration::site_name + site_name = AlaveteliConfiguration::site_name reasons = { :web => "", :email => _("Then you can sign in to {{site_name}}", :site_name => site_name), diff --git a/script/handle-mail-replies.rb b/script/handle-mail-replies.rb index 4e35ee0cf..f5d34d796 100755 --- a/script/handle-mail-replies.rb +++ b/script/handle-mail-replies.rb @@ -165,7 +165,7 @@ def is_oof?(message) end def forward_on(raw_message) - IO.popen("/usr/sbin/sendmail -i #{Configuration::forward_nonbounce_responses_to}", "w") do |f| + IO.popen("/usr/sbin/sendmail -i #{AlaveteliConfiguration::forward_nonbounce_responses_to}", "w") do |f| f.write(raw_message); f.close; end diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index d4aa034a7..9a88dbc3a 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -20,13 +20,13 @@ end describe GeneralController, 'when getting the blog feed' do it 'should add a lang param correctly to a url with no querystring' do - Configuration.stub!(:blog_feed).and_return("http://blog.example.com") + AlaveteliConfiguration.stub!(:blog_feed).and_return("http://blog.example.com") get :blog assigns[:feed_url].should == "http://blog.example.com?lang=en" end it 'should add a lang param correctly to a url with an existing querystring' do - Configuration.stub!(:blog_feed).and_return("http://blog.example.com?alt=rss") + AlaveteliConfiguration.stub!(:blog_feed).and_return("http://blog.example.com?alt=rss") get :blog assigns[:feed_url].should == "http://blog.example.com?alt=rss&lang=en" end @@ -104,11 +104,11 @@ describe GeneralController, "when showing the frontpage" do before do @default_lang_home_link = /href=".*\/en\// @other_lang_home_link = /href=".*\/es\// - @old_include_default_locale_in_urls = Configuration::include_default_locale_in_urls + @old_include_default_locale_in_urls = AlaveteliConfiguration::include_default_locale_in_urls end def set_default_locale_in_urls(value) - Configuration.stub!(:include_default_locale_in_urls).and_return(value) + AlaveteliConfiguration.stub!(:include_default_locale_in_urls).and_return(value) load Rails.root.join("config/initializers/fast_gettext.rb") end diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index 796c6b63d..399f48acb 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -54,27 +54,27 @@ describe ServicesController, "when returning a message for people in other count it "should return the 'another country' message if the service responds OK" do config = MySociety::Config.load_default() config['ISO_COUNTRY_CODE'] = "DE" - Configuration.stub!(:gaze_url).and_return('http://denmark.com') + AlaveteliConfiguration.stub!(:gaze_url).and_return('http://denmark.com') FakeWeb.register_uri(:get, %r|denmark.com|, :body => "DK") get :other_country_message response.should be_success response.body.should == 'Hello! We have an <a href="/help/alaveteli?country_name=Deutschland">important message</a> for visitors outside Deutschland <span class="close-button">X</span>' end it "should default to no message if the country_from_ip domain doesn't exist" do - Configuration.stub!(:gaze_url).and_return('http://12123sdf14qsd.com') + AlaveteliConfiguration.stub!(:gaze_url).and_return('http://12123sdf14qsd.com') get :other_country_message response.should be_success response.body.should == '' end it "should default to no message if the country_from_ip service doesn't exist" do - Configuration.stub!(:gaze_url).and_return('http://www.google.com') + AlaveteliConfiguration.stub!(:gaze_url).and_return('http://www.google.com') get :other_country_message response.should be_success response.body.should == '' end it "should default to no message if the country_from_ip service returns an error" do FakeWeb.register_uri(:get, %r|500.com|, :body => "Error", :status => ["500", "Error"]) - Configuration.stub!(:gaze_url).and_return('http://500.com') + AlaveteliConfiguration.stub!(:gaze_url).and_return('http://500.com') get :other_country_message response.should be_success response.body.should == '' diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 0825d12bf..6cd1c099f 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -332,7 +332,7 @@ describe UserController, "when sending another user a message" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.body.should include("Bob Smith has used #{Configuration::site_name} to send you the message below") + mail.body.should include("Bob Smith has used #{AlaveteliConfiguration::site_name} to send you the message below") mail.body.should include("Just a test!") #mail.to_addrs.first.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email mail.from_addrs.first.to_s.should == users(:bob_smith_user).email diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index f525c9819..63daf1a75 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -60,7 +60,7 @@ describe LinkToHelper do context 'with ADMIN_BASE_URL set' do before(:each) do - Configuration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/') + AlaveteliConfiguration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/') end it 'should prepend the admin base URL to a simple string' do diff --git a/spec/integration/admin_spec.rb b/spec/integration/admin_spec.rb index e148ea3ca..8a5e59ba2 100644 --- a/spec/integration/admin_spec.rb +++ b/spec/integration/admin_spec.rb @@ -13,7 +13,7 @@ describe "When administering the site" do # Now fetch the "log in as" link to log in as Bob get_via_redirect "/admin/user/login_as/#{users(:bob_smith_user).id}", nil, { - "Authorization" => "Basic " + Base64.encode64("#{Configuration::admin_username}:#{Configuration::admin_password}").strip + "Authorization" => "Basic " + Base64.encode64("#{AlaveteliConfiguration::admin_username}:#{AlaveteliConfiguration::admin_password}").strip } response.should be_success session[:user_id].should == users(:bob_smith_user).id diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb index 18b925b33..9597045eb 100644 --- a/spec/mailers/request_mailer_spec.rb +++ b/spec/mailers/request_mailer_spec.rb @@ -33,7 +33,7 @@ describe RequestMailer, " when receiving incoming mail" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.to.should == [ Configuration::contact_email ] + mail.to.should == [ AlaveteliConfiguration::contact_email ] deliveries.clear end @@ -53,7 +53,7 @@ describe RequestMailer, " when receiving incoming mail" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.to.should == [ Configuration::contact_email ] + mail.to.should == [ AlaveteliConfiguration::contact_email ] deliveries.clear end @@ -73,7 +73,7 @@ describe RequestMailer, " when receiving incoming mail" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.to.should == [ Configuration::contact_email ] + mail.to.should == [ AlaveteliConfiguration::contact_email ] deliveries.clear end @@ -159,7 +159,7 @@ describe RequestMailer, " when receiving incoming mail" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 mail = deliveries[0] - mail.to.should == [ Configuration::contact_email ] + mail.to.should == [ AlaveteliConfiguration::contact_email ] deliveries.clear end @@ -349,7 +349,7 @@ describe RequestMailer, 'requires_admin' do context 'has an ADMIN_BASE_URL set' do before(:each) do - Configuration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/') + AlaveteliConfiguration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/') end it 'body should contain the full admin URL' do diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 781212841..aa7826865 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -353,7 +353,7 @@ describe IncomingMessage, " when censoring data" do end it "should apply hard-coded privacy rules to HTML files" do - data = "http://#{Configuration::domain}/c/cheese" + data = "http://#{AlaveteliConfiguration::domain}/c/cheese" @im.html_mask_stuff!(data) data.should == "[WDTK login link]" end diff --git a/spec/models/mail_server_log_spec.rb b/spec/models/mail_server_log_spec.rb index d0a1d202f..2b44a4559 100644 --- a/spec/models/mail_server_log_spec.rb +++ b/spec/models/mail_server_log_spec.rb @@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe MailServerLog do describe ".load_file" do before :each do - Configuration.stub!(:incoming_email_domain).and_return("example.com") + AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com") File.stub_chain(:stat, :mtime).and_return(DateTime.new(2012, 10, 10)) end @@ -64,8 +64,8 @@ describe MailServerLog do describe ".email_addresses_on_line" do before :each do - Configuration.stub!(:incoming_email_domain).and_return("example.com") - Configuration.stub!(:incoming_email_prefix).and_return("foi+") + AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com") + AlaveteliConfiguration.stub!(:incoming_email_prefix).and_return("foi+") end it "recognises a single incoming email" do @@ -106,7 +106,7 @@ describe MailServerLog do # Postfix logs for a single email go over multiple lines. They are all tied together with the Queue ID. # See http://onlamp.com/onlamp/2004/01/22/postfix.html it "loads the postfix log and untangles seperate email transactions using the queue ID" do - Configuration.stub!(:incoming_email_domain).and_return("example.com") + AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com") log.stub!(:rewind) ir1 = info_requests(:fancy_dog_request) ir2 = info_requests(:naughty_chicken_request) @@ -135,7 +135,7 @@ describe MailServerLog do describe ".scan_for_postfix_queue_ids" do it "returns the queue ids of interest with the connected email addresses" do - Configuration.stub!(:incoming_email_domain).and_return("example.com") + AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com") MailServerLog.scan_for_postfix_queue_ids(log).should == { "CB55836EE58C" => ["request-14-e0e09f97@example.com"], "9634B16F7F7" => ["request-10-1234@example.com"] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eaf77a909..3b59d05c5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -134,8 +134,8 @@ Spork.prefork do end def basic_auth_login(request, username = nil, password = nil) - username = Configuration::admin_username if username.nil? - password = Configuration::admin_password if password.nil? + username = AlaveteliConfiguration::admin_username if username.nil? + password = AlaveteliConfiguration::admin_password if password.nil? request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{username}:#{password}") end end diff --git a/spec/support/validate_html.rb b/spec/support/validate_html.rb index 56f384537..403865c74 100644 --- a/spec/support/validate_html.rb +++ b/spec/support/validate_html.rb @@ -20,7 +20,7 @@ end # Monkeypatch! Validate HTML in tests. $html_validation_script_found = false -Configuration::utility_search_path.each do |d| +AlaveteliConfiguration::utility_search_path.each do |d| $html_validation_script = File.join(d, "validate") $html_validation_script_options = ["--charset=utf-8"] if File.file? $html_validation_script and File.executable? $html_validation_script |