Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 9
- Log:
Reverting to the Tarball version of RForum. The prototype RISC OS Open
Ltd web site used a HEAD revision of RForum from RForum's SVN but this
specific revision was not recorded, so the changes are unknown. I'm
going to separately apply the current HEAD as a patch to the rolled
back Tarball revision, and apply the RISC OS Open Ltd site version as
a patch, then attempt to merge the latter to the former. If this fails
I'll revert to my original strategy - take the Tarball, commit HEAD,
then commit the web site version (which will implicitly revert to a
slightly earlier RForum version).
- Author:
- adh
- Date:
- Sat Jul 22 19:57:27 +0100 2006
- Size:
- 2861 Bytes
1 | require 'navbar' |
2 | require 'post_menu' |
3 | require 'url_generator' |
4 | require_dependency 'mod_application' |
5 | |
6 | # The filters added to this controller will be run for all controllers in the application. |
7 | # Likewise will all the methods added be available for all controllers. |
8 | class ApplicationController < ActionController::Base |
9 | model :forum, :post, :topic, :user |
10 | helper :application |
11 | |
12 | session :session_expires => Time.now + 1.years |
13 | |
14 | include RForum::Localization |
15 | |
16 | layout 'default' |
17 | before_filter :check_block, :setup_user, :setup_url_generator, :setup_local |
18 | after_filter :finish_user, :remember_location |
19 | |
20 | # Default index action: redirect to start page |
21 | def index |
22 | redirect_to :controller => 'forum', :action => 'list' |
23 | end |
24 | |
25 | protected |
26 | |
27 | def rescue_action(e) |
28 | if e.is_a?(RForum::SecurityError) |
29 | redirect_to :controller => 'security', :action => 'access_denied' |
30 | else |
31 | super |
32 | end |
33 | end |
34 | |
35 | # Check if the client IP is blocked |
36 | def check_block |
37 | if BlockedIp.blocked?(@request.remote_ip) |
38 | # don't waste any time on template rendering |
39 | render_text 'blocked', 403 |
40 | return false |
41 | end |
42 | end |
43 | |
44 | def setup_user |
45 | if @params['user_id'] and @params['key'] |
46 | @user = User.find_by_token(@params['user_id'], @params['key']) |
47 | @authenticated_by_token = true |
48 | # set the token to expire in no more than next 10 minutes |
49 | if @user |
50 | @user.token_expiry = [@user.token_expiry, Time.at(Time.now.to_i + 600 * 1000)].min |
51 | @user.save |
52 | end |
53 | elsif @session[:user_id] |
54 | @user = User.find(@session[:user_id]) |
55 | else |
56 | @user = Guest.new(@session[:guest_name], @session[:guest_email]) if @user.nil? |
57 | end |
58 | |
59 | raise RForum::SecurityError if @user.nil? |
60 | |
61 | rescue => e |
62 | reset_session |
63 | if retried? |
64 | raise e |
65 | else |
66 | retried = true |
67 | retry |
68 | end |
69 | end |
70 | |
71 | def setup_url_generator |
72 | UrlGenerator.controller = self |
73 | end |
74 | |
75 | def finish_user |
76 | @session[:user_id] = @user.id |
77 | @session[:guest_name] = @user.guest_name |
78 | @session[:guest_email] = @user.guest_email |
79 | end |
80 | |
81 | @@REMEMBER_NOT = ['user', 'security', 'feed'] |
82 | def remember_location |
83 | if @response.headers['Status'] == '200 OK' |
84 | @session[:return_to] = url_for unless @@REMEMBER_NOT.include? controller_name |
85 | end |
86 | end |
87 | |
88 | def return_to_last_remembered |
89 | begin |
90 | redirect_to_url(@session[:return_to] || '/') |
91 | rescue RForum::SecurityError |
92 | redirect_to_url('/') |
93 | end |
94 | end |
95 | |
96 | def setup_local |
97 | @headers["Content-Type"] = "text/html; charset=#{RForum::CONFIG[:web_charset]}" |
98 | end |
99 | |
100 | end |
101 | |
102 | module RForum |
103 | |
104 | # Security error. Controllers throw these in situations where a user is trying to access a |
105 | # function that he is not authorized to access. |
106 | # Normally, RForum does not show URLs that would allow the user to access such features. |
107 | class SecurityError < StandardError |
108 | end |
109 | |
110 | end |