LOTS of stuff

This commit is contained in:
jomo
2014-04-04 01:08:17 +02:00
parent 0604bbce63
commit f290258f26
62 changed files with 1457 additions and 655 deletions

View File

@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :update_ip, :update_seen
# force_ssl
helper :all
@@ -10,16 +10,22 @@ class ApplicationController < ActionController::Base
helper_method :current_user
helper_method :disabled?
helper_method :banned?
helper_method :confirmed?
helper_method :unconfirmed?
helper_method :default?
helper_method :donor?
helper_method :normal?
helper_method :mod?
helper_method :admin?
helper_method :superadmin?
helper_method :donor?
helper_method :confirmed?
private
def update_ip
current_user && current_user.update_attribute(:last_ip, request.remote_ip)
end
def update_seen
current_user && current_user.update_attribute(:last_seen, Time.now)
end
def current_user
@current_user ||= User.find_by_id(session[:user_id])
end
@@ -33,21 +39,8 @@ class ApplicationController < ActionController::Base
!!(current_user && current_user.banned?)
end
def unconfirmed?
!!(current_user && current_user.unconfirmed?)
end
#special one
def confirmed?
!!(current_user && current_user.confirmed?)
end
def default?
!!(current_user && current_user.default?)
end
def donor?
!!(current_user && current_user.donor?)
def normal?
!!(current_user && current_user.normal?)
end
def mod?
@@ -62,4 +55,12 @@ class ApplicationController < ActionController::Base
!!(current_user && current_user.superadmin?)
end
def donor?
!!(current_user && current_user.donor?)
end
def confirmed?
!!(current_user && current_user.confirmed?)
end
end