<commit_before># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

require_dependency "login_system"

class ApplicationController < ActionController::Base
  include LoginSystem
  
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_rucksack_session_id'
  
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '1891570368d75c5be1519db4be2a1d14'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password
  
  before_filter :login_required
  before_filter :set_time_zone
  
protected
  
  def error_status(error, message, args={}, continue_ok=true)
  	flash[:error] = error
  	flash[:message] = message.l_with_args(args)
  	
  	return unless (error and continue_ok)
  	
  	# Construct a reply with a relevant error
  	respond_to do |format|
        format.html { redirect_back_or_default('/') }
        format.js { render(:update) do |page| 
                      page.replace_html('statusBar', h(flash[:message]))
                      page.show 'statusBar'
                    end }
        format.xml  { head(error ? :unprocessable_entity : :ok) }
  	end
  end
  
  def user_track
    if not @logged_user.nil?
      store_location
	  @logged_user.update_attribute('last_visit', Time.now.utc)
    end
    true
  end
  
  def set_time_zone<commit_msg>Reload account owner every page load<commit_after># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

require_dependency "login_system"

class ApplicationController < ActionController::Base
  include LoginSystem
  
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_rucksack_session_id'
  
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '1891570368d75c5be1519db4be2a1d14'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password
  
  before_filter :reload_owner
  before_filter :login_required
  before_filter :set_time_zone
  
protected
  
  def error_status(error, message, args={}, continue_ok=true)
  	flash[:error] = error
  	flash[:message] = message.l_with_args(args)
  	
  	return unless (error and continue_ok)
  	
  	# Construct a reply with a relevant error
  	respond_to do |format|
        format.html { redirect_back_or_default('/') }
        format.js { render(:update) do |page| 
                      page.replace_html('statusBar', h(flash[:message]))
                      page.show 'statusBar'
                    end }
        format.xml  { head(error ? :unprocessable_entity : :ok) }
  	end
  end
  
  def reload_owner
    Account.owner(true)
    true
  end
  
  def user_track
    if not @logged_user.nil?
      store_location
	  @logged_user.update_attribute('last_visit', Time.now.utc)
    end
    true
  end
  
  def set_time_zone
{'fraction_non_alphanumeric': 0.07025246981339188, 'fraction_numerical': 0.012074643249176729, 'mean_word_length': 3.3862815884476536, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '751754', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1047, 'n_words': 333}