This repository was archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.rb
More file actions
53 lines (41 loc) · 1.27 KB
/
Copy pathapplication.rb
File metadata and controls
53 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# $Id$
class ApplicationController < ActionController::Base
include AuthenticatedSystem
before_filter :select_format
before_filter :login_from_cookie
helper :atom_feed, :comments, :people, :posts, :tags
layout 'xhtml'
def select_format
host = request.env["HTTP_X_FORWARDED_HOST"] ? request.env["HTTP_X_FORWARDED_HOST"] : request.env["HTTP_HOST"]
request.env['HTTP_ACCEPT'] = 'text/xml' if host.starts_with? 'xml.'
request.env['HTTP_ACCEPT'] = 'application/atom+xml' if host.starts_with? 'feed.'
end
def show_about
render :action => 'about'
end
def show_terms_of_service
render :action => 'tos'
end
def rescue_action_in_public(exception = nil)
render :template => "/shared/error"
end
def local_request?
return false
end
private
def check_for_person_logged_in
unless logged_in?
flash[:notice] = 'Sorry, but you need to log in first!'
session[:redirect_url] = request.request_uri
redirect_to '/'
end
true
end
def check_for_ownership
unless logged_in? && params[:account_name].downcase == current_person.account_name.downcase
flash[:notice] = 'Sorry, but you\'re not allowed to do that!'
redirect_to '/'
end
true
end
end