Changesets can be listed by changeset number.
The Git repository is here.
Changeset 120
Hub integration. RForum Users are lazy-created when Hub users, logged in,
visit RForum for the first time. RForum navigation links to log in and
out or change settings all point at Hub. Webmaster and adminstrator roles
in Hub map to administrator permissions in RForum; in addition to the
RForum permission management system, though, added Hub permissions hashes
to various controllers to include Hub authorisation too. Two layers can't
hurt and it means sensible return-to'd redirections to Hub for some
action types.
Corrected grammar on deletion confirmation messages and tidied up a few
templates here and there, too.
- Comitted by: adh
- Date: Saturday October 28 23:53:03 2006 (over 18 years ago)
Affected files:
- rool/rails/rforum/trunk/db/migrate/012_change_lengths_for_hub.rb
- rool/rails/rforum/trunk/app/controllers/admin_controller.rb (diff)
- rool/rails/rforum/trunk/app/controllers/application.rb (diff)
- rool/rails/rforum/trunk/app/controllers/attachment_controller.rb (diff)
- rool/rails/rforum/trunk/app/controllers/forum_controller.rb (diff)
- rool/rails/rforum/trunk/app/controllers/mailer.rb (diff)
- rool/rails/rforum/trunk/app/controllers/navbar.rb (diff)
- rool/rails/rforum/trunk/app/controllers/topic_controller.rb (diff)
- rool/rails/rforum/trunk/app/controllers/user_controller.rb (diff)
- rool/rails/rforum/trunk/app/models/user.rb (diff)
- rool/rails/rforum/trunk/app/views/mailer/en/delete_post_notification.rhtml (diff)
- rool/rails/rforum/trunk/app/views/mailer/en/user_message.rhtml (diff)
- rool/rails/rforum/trunk/app/views/stats/index.rhtml (diff)
- rool/rails/rforum/trunk/app/views/user/show.rhtml (diff)
- rool/rails/rforum/trunk/config/site.rb (diff)
- rool/rails/rforum/trunk/db/schema.rb (diff)
- rool/rails/rforum/trunk/lang/en.yaml (diff)
- rool/rails/rforum/trunk/test/unit/post_menu_test.rb (diff)
rool/rails/rforum/trunk/app/controllers/admin_controller.rb:
prev. | current | |
class AdminController < ApplicationController | ||
3 | # Use HubSsoLib for permissions management, as a layer on top of | |
4 | # the provision within RForum. | |
5 | ||
6 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ | |
7 | :block_ip => [ :admin, :webmaster ] | |
8 | }) | |
9 | ||
10 | def AdminController.hubssolib_permissions | |
11 | @@hubssolib_permissions | |
12 | end | |
13 | ||
def block_ip | ||
raise RForum::SecurityError unless @user.admin? | ||
@ip = @params['ip'] |
rool/rails/rforum/trunk/app/controllers/application.rb:
prev. | current | |
require 'navbar' | ||
require 'post_menu' | ||
require 'url_generator' | ||
4 | require 'digest/sha1' | |
# The filters added to this controller will be run for all controllers in the application. | ||
# Likewise will all the methods added be available for all controllers. | ||
... | ... | |
layout 'default' | ||
before_filter :check_block, :setup_user, :setup_url_generator, :setup_local, \ | ||
:setup_skin | ||
28 | | |
29 | ||
before_filter :detect_site if RForum::CONFIG[:use_sites] | ||
before_filter :get_forums | ||
32 | | |
33 | ||
after_filter :finish_user, :remember_location | ||
# Default index action: redirect to start page | ||
... | ... | |
protected | ||
42 | | |
43 | def rescue_action(e) | |
if e.is_a?(RForum::SecurityError) | ||
redirect_to :controller => 'security', :action => 'access_denied' | ||
else | ||
... | ... | |
end | ||
end | ||
60 | # Get a unique name from the Hub user, in abstracted form. | |
61 | # While it must be unique, its content is irrelevant in the | |
62 | # Hub integrated RForum as it doesn't get displayed to any | |
63 | # normal user. | |
64 | # | |
65 | def get_hub_user_name | |
66 | Digest::SHA1.hexdigest("#{hubssolib_get_user_address} (#{hubssolib_get_user_id})") | |
67 | end | |
68 | ||
69 | # Map a Hub user's parameters to an RForum User model's | |
70 | # parameters. Returns a hash appropriate for updating an | |
71 | # existing model or to create a brand new RForum User. | |
72 | # | |
73 | def map_hub_user_to_forum_user | |
74 | ||
75 | return { | |
76 | :name => get_hub_user_name, # Must be unique and <= 60 characters; SHA1 digest keeps it to 40 | |
77 | :firstname => hubssolib_unique_name, | |
78 | :email => hubssolib_get_user_address, | |
79 | :surname => '' | |
80 | } | |
81 | end | |
82 | ||
83 | def hub_user_is_rforum_admin? | |
84 | hubssolib_get_user_roles.include?('admin,webmaster') ? true : false | |
85 | end | |
86 | ||
87 | # Filter method that sets up the current user parameters | |
88 | # by mapping in the currently logged in Hub user to a new | |
89 | # or updated RForum user. | |
90 | # | |
def setup_user | ||
60 | | |
61 | | |
62 | | |
63 | | |
64 | | |
65 | | |
66 | | |
92 | @user = nil | |
93 | ||
94 | if (hubssolib_logged_in?) | |
95 | @user = User.find_by_name(get_hub_user_name) | |
96 | ||
97 | # This for now is the quick and dirty code. We either create | |
98 | # a new user on a default map of parameters from Hub to | |
99 | # RForum user, or we update the Hub parts - on each and every | |
100 | # action in RForum. This is, obviously, very slow. | |
101 | ||
102 | if (@user) | |
103 | @user.update_attributes(map_hub_user_to_forum_user) | |
104 | else | |
105 | # There is no user with the same unique ID, but there may be | |
106 | # a user with the same e-mail address - somebody might have | |
107 | # deleted and recreated their account, or a person may have | |
108 | # given up an e-mail address but it could have been claimed | |
109 | # by an entirely new user. In any event, a new ID with the | |
110 | # same e-mail address implies the old address is stale; Hub | |
111 | # insists on unique addreses. We don't want to delete that | |
112 | # user because their user name is associated with posts, so | |
113 | # instead, clear its email address. | |
114 | ||
115 | @other_user = User.find_by_email(hubssolib_get_user_address) | |
116 | ||
117 | if @other_user | |
118 | @other_user.email = '' | |
119 | @other_user.save! | |
120 | end | |
121 | ||
122 | # Now create the shiny new account and save it. | |
123 | ||
124 | @user = User.new(map_hub_user_to_forum_user) | |
125 | @user.save! | |
end | ||
68 | | |
69 | | |
127 | ||
128 | # The role column requires special attention | |
129 | ||
130 | admin = hub_user_is_rforum_admin? | |
131 | ||
132 | if (admin != @user.admin?) | |
133 | @user.role = admin ? 'Admin' : 'User' | |
134 | @user.save! | |
135 | ||
136 | # Although we think we just modified this user, the model is | |
137 | # part of a class hierarchy for administration or normal user | |
138 | # profiles. Reloading the model makes sure we get an Admin or | |
139 | # User underneath; without that, we'll have a role string that | |
140 | # may be updated, but the class type will be unchanged for the | |
141 | # remainder of this action (but would update on the next one, | |
142 | # since the model gets reloaded each time). | |
143 | ||
144 | @user = User.find_by_name(get_hub_user_name) | |
145 | end | |
else | ||
@user = Guest.new(@session[:guest_name], @session[:guest_email]) if @user.nil? | ||
end | ||
raise RForum::SecurityError if @user.nil? | ||
76 | | |
77 | | |
78 | | |
79 | | |
80 | | |
81 | | |
82 | | |
83 | | |
152 | # if @params['user_id'] and @params['key'] | |
153 | # @user = User.find_by_token(@params['user_id'], @params['key']) | |
154 | # @authenticated_by_token = true | |
155 | # # set the token to expire in no more than next 10 minutes | |
156 | # if @user | |
157 | # @user.token_expiry = [@user.token_expiry, Time.at(Time.now.to_i + 600 * 1000)].min | |
158 | # @user.save | |
159 | # end | |
160 | # elsif @session[:user_id] | |
161 | # @user = User.find(@session[:user_id]) | |
162 | # else | |
163 | # @user = Guest.new(@session[:guest_name], @session[:guest_email]) if @user.nil? | |
164 | # end | |
165 | # | |
166 | # raise RForum::SecurityError if @user.nil? | |
167 | # | |
168 | # rescue => e | |
169 | # reset_session | |
170 | # if retried? | |
171 | # raise e | |
172 | # else | |
173 | # retried = true | |
174 | # retry | |
175 | # end | |
end | ||
85 | | |
177 | ||
def setup_url_generator | ||
UrlGenerator.controller = self | ||
end | ||
... | ... | |
module RForum | ||
# Security error. Controllers throw these in situations where a user is trying to access a | ||
152 | | |
244 | # function that he is not authorized to access. | |
# Normally, RForum does not show URLs that would allow the user to access such features. | ||
class SecurityError < StandardError | ||
end |
rool/rails/rforum/trunk/app/controllers/attachment_controller.rb:
prev. | current | |
require 'mime/types' | ||
class AttachmentController < ApplicationController | ||
4 | ||
5 | # Use HubSsoLib for permissions management, as a layer on top of | |
6 | # the provision within RForum. | |
7 | ||
8 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ | |
9 | :fetch => [ :admin, :webmaster, :privileged, :normal ] | |
10 | }) | |
11 | ||
12 | def AttachmentController.hubssolib_permissions | |
13 | @@hubssolib_permissions | |
14 | end | |
15 | ||
def fetch | ||
id = @params[:id] | ||
file_path = Attachment.find(id).file_path |
rool/rails/rforum/trunk/app/controllers/forum_controller.rb:
prev. | current | |
helper :forum | ||
#caches_page :index, :forum | ||
5 | # Use HubSsoLib for permissions management, as a layer on top of | |
6 | # the provision within RForum. | |
8 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ | |
9 | :new => [ :admin, :webmaster ], | |
10 | :edit => [ :admin, :webmaster ], | |
11 | :move => [ :admin, :webmaster ] | |
12 | }) | |
13 | ||
14 | def ForumController.hubssolib_permissions | |
15 | @@hubssolib_permissions | |
16 | end | |
17 | ||
# Display the list of topics in a forum. | ||
def forum | ||
begin | ||
9 | | |
21 | @forum = Forum.find(@params['id']) | |
return if redirect_if_site_doesnt_match | ||
rescue ActiveRecord::RecordNotFound | ||
render_text "Forum not found", 404 | ||
return | ||
end | ||
15 | | |
27 | ||
@title = @forum.name | ||
17 | | |
29 | ||
@page = @params['page'].to_i | ||
@page = 1 if @page == 0 | ||
@topics_per_page = RForum::CONFIG[:topics_per_page] | ||
... | ... | |
if not @user.guest? | ||
topic_read_times = @user.topic_read_times | ||
34 | | |
46 | ||
@topics.each do |topic| | ||
topic['last_read_time'] = topic_read_times[topic.id] | ||
end | ||
... | ... | |
if @params['forums'] | ||
@selected_forums = @params['forums'].collect {|id| id.to_i} | ||
else | ||
58 | | |
70 | @selected_forums = (@forums.collect {|f| f.id}) | |
end | ||
if @params['query'] | ||
... | ... | |
@page = @params['page'].to_i | ||
@page = 1 if @page == 0 | ||
@posts_per_page = RForum::CONFIG[:search_results_per_page] | ||
67 | | |
79 | ||
@results = Post.search(@query, @selected_forums, @posts_per_page, (@page - 1) * @posts_per_page) | ||
if @results.size < @posts_per_page | ||
@last_page = true | ||
end | ||
end | ||
74 | | |
86 | ||
end | ||
def new | ||
... | ... | |
@title = l(:create_forum_title) | ||
@forum = Forum.find(@params['id']) | ||
95 | | |
107 | ||
if @params['save'] | ||
Forum.update(@params['id'], @params['forum']) | ||
redirect_to :action => 'list' | ||
... | ... | |
raise RForum::SecurityError unless @user.admin? | ||
@forum = Forum.find(@params['id']) | ||
111 | | |
123 | ||
if @params['direction'] == 'up' | ||
@forum.move_higher | ||
elsif @params['direction'] == 'down' |
rool/rails/rforum/trunk/app/controllers/mailer.rb:
prev. | current | |
@body['post'] = post | ||
@body['user'] = user | ||
end | ||
25 | | |
25 | ||
def reset_password(user, reset_password_url) | ||
setup_email(user) | ||
@subject += l(:reset_password_subject) | ||
... | ... | |
def user_message(from, to, text) | ||
setup_email(to) | ||
@from = from.email | ||
36 | | |
36 | @subject += l(:user_message_from, from.firstname) | |
@body['text'] = Wraptools.wrap_ff(text, 72) | ||
@body['from'] = from | ||
@body['to'] = to | ||
... | ... | |
unless post.topic.forum.list_address | ||
raise RuntimeError | ||
end | ||
51 | | |
51 | ||
footer = "\n\n-- \nPosted via http://www.ruby-forum.com/." | ||
@body = post.text + footer | ||
... | ... | |
name = (post.author.guest_name || 'Guest').dup | ||
email = post.author.guest_email | ||
else | ||
60 | | |
60 | name = "#{post.author.firstname}" # Adding #{post.author.surname} not required in Hub; firstname already contains a full unique name | |
email = post.author.email | ||
end | ||
63 | | |
63 | ||
if post.topic.forum.ml_from_address | ||
email = post.topic.forum.ml_from_address | ||
end | ||
67 | | |
67 | ||
@from = "#{name} <#{email}>" | ||
69 | | |
69 | ||
@subject = post.subject | ||
@recipients = post.topic.forum.list_address | ||
@sent_on = post.created_at | ||
73 | | |
73 | ||
@headers['Content-Type'] = "text/plain; charset=#{RForum::CONFIG[:mail_charset]}; format=flowed" | ||
@headers['reply-to'] = post.topic.forum.list_address | ||
#@headers["bcc"] = (users.collect { |u| u.email }).join "," | ||
... | ... | |
# TODO: bounce | ||
raise 'email from guest' | ||
end | ||
105 | | |
105 | ||
if email.from_unauthorized_user? | ||
# TODO: bounce | ||
raise 'email from unauthorized user' |
rool/rails/rforum/trunk/app/controllers/navbar.rb:
prev. | current | |
end | ||
end | ||
31 | # With Hub, we expect the templates to not offer direct links for | |
32 | # logging in and out; they don't in other applications so it would | |
33 | # look rather inconsistent. However, should someone want to use | |
34 | # these functions they should at least do something sane. | |
35 | ||
def user_settings | ||
32 | | |
33 | | |
34 | | |
35 | | |
36 | | |
37 | Item.new(@user.guest? ? l(:nav_register) : l(:nav_settings), '/rails/hub/tasks') | |
end | ||
def user_list | ||
40 | | |
41 | if (@user.admin?) | |
42 | Item.new(l(:nav_user_list), '/rails/hub/account/list') | |
43 | end | |
end | ||
43 | ||
def login_info | ||
if @user.guest? | ||
46 | | |
48 | Item.new(l(:nav_log_in), '/rails/hub/account/login_hop') | |
else | ||
48 | | |
50 | link_text = l(:nav_log_out, @user.firstname) # Actually the Hub unique name | |
link_text << " (#{@user.role})" unless @user.class == User | ||
50 | | |
52 | Item.new(link_text, '/rails/hub/account/logout') | |
end | ||
end | ||
end # class NavBar |
rool/rails/rforum/trunk/app/controllers/topic_controller.rb:
prev. | current | |
class TopicController < ApplicationController | ||
helper :forum | ||
4 | # Use HubSsoLib for permissions management, as a layer on top of | |
5 | # the provision within RForum. | |
6 | ||
7 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ | |
8 | :new => [ :admin, :webmaster, :privileged, :normal ], | |
9 | :subscribe => [ :admin, :webmaster, :privileged, :normal ], | |
10 | :unsubscribe => [ :admin, :webmaster, :privileged, :normal ], | |
11 | :delete_post => [ :admin, :webmaster, :privileged, :normal ], | |
12 | :move => [ :admin, :webmaster, :privileged ], | |
13 | :undelete_post => [ :admin, :webmaster, :privileged ] | |
14 | }) | |
15 | ||
16 | def TopicController.hubssolib_permissions | |
17 | @@hubssolib_permissions | |
18 | end | |
19 | ||
# Display a topic. If reply_to parameter is included, handle the post editing form, too | ||
def show | ||
begin | ||
... | ... | |
@user.subscribe_topic(@topic) | ||
end | ||
185 | flash[:attention] = 'Email notification for new posts in this topic is now enabled.' | |
redirect_to :controller => 'topic', :action => 'show', :id => @topic.id | ||
end | ||
... | ... | |
@user.unsubscribe_topic(@topic) | ||
end | ||
197 | flash[:attention] = 'Email notification for new posts in this topic is now disabled.' | |
redirect_to :controller => 'topic', :action => 'show', :id => @topic.id | ||
end | ||
rool/rails/rforum/trunk/app/controllers/user_controller.rb:
prev. | current | |
class UserController < ApplicationController | ||
3 | # Use HubSsoLib for permissions management, as a layer on top of | |
4 | # the provision within RForum. The ":nobody" entries are a bit of | |
5 | # a hack - any unrecognised role would do, since it means that | |
6 | # nobody will ever have that role; thus, no permission. | |
7 | ||
8 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ | |
9 | :show => [ :admin, :webmaster, :privileged, :normal ], | |
10 | :list => [ :admin, :webmaster ], | |
11 | :login => [ :nobody ], | |
12 | :register => [ :nobody ], | |
13 | :register_complete => [ :nobody ] | |
14 | }) | |
15 | ||
16 | def UserController.hubssolib_permissions | |
17 | @@hubssolib_permissions | |
18 | end | |
19 | ||
def login | ||
@title = l(:login_title) | ||
... | ... | |
def show | ||
@title = 'User information' | ||
95 | | |
112 | begin | |
113 | @selected_user = User.find(@params['id']) | |
114 | rescue | |
115 | @selected_user = Guest.new('Unknown user', '') | |
116 | end | |
if @params['send_message'] and !@user.guest? | ||
@text = @params['text'].strip |
rool/rails/rforum/trunk/app/models/user.rb:
prev. | current | |
self.name.downcase! | ||
self.email.downcase! | ||
59 | ||
self.role = 'User' | ||
@unencrypted_password = makepass | ||
encrypt_stored_password | ||
end | ||
def validate_on_create | ||
65 | | |
66 | | |
67 | | |
68 | | |
66 | # Hub integration; nickname comes from e-mail address to try and | |
67 | # guarantee it is unique. We trust it so long as it isn't a duplicate. | |
68 | # The creation routine makes sure it fits within field length by turning | |
69 | # the address into a SHA1 hex digest (40 characters). | |
70 | # | |
71 | # # Nickname cannot be changed, so we only need to validate it on create | |
72 | # unless self.name =~ /^[a-z0-9\-]{3,15}$/i | |
73 | # errors.add 'name', :user_name_invalid | |
74 | # end | |
75 | ||
# Already existing nick is not allowed | ||
errors.add_on_duplicate 'name', :user_name_duplicate | ||
end | ||
def validate | ||
74 | | |
75 | | |
76 | | |
77 | | |
81 | # All commented out; Hub integration means we're | |
82 | # sufficiently happy with the data source to live with it. | |
83 | #errors.add 'email', :user_email_invalid unless valid_email?(self.email) | |
84 | #errors.add 'firstname', :user_firstname_invalid unless self.firstname =~ /^.{2,20}$/i | |
85 | #errors.add 'surname', :user_surname_invalid unless self.surname =~ /^.{2,20}$/i | |
86 | #errors.add_on_duplicate 'email', :user_email_duplicate | |
79 | | |
80 | | |
81 | | |
88 | #if (@new_password or self.password.nil?) and password.size < 3 | |
89 | # errors.add 'new_password', :user_password_invalid | |
90 | #end | |
# nick cannot be changed | ||
unless self.new_record? | ||
... | ... | |
end | ||
def get_display_name | ||
247 | | |
256 | "#{self.firstname}" # Don't need to add " #{self.surname}" under Hub since firstname already contains a full unique name | |
end | ||
private |
rool/rails/rforum/trunk/app/views/mailer/en/delete_post_notification.rhtml:
prev. | current | |
in forum | ||
"<%= @post.topic.forum.name %>" | ||
was deleted. | ||
6 |
rool/rails/rforum/trunk/app/views/mailer/en/user_message.rhtml:
prev. | current | |
1 | ||
1 | <%= @from.firstname %> sent you the following message: | |
==================================== | ||
<%= @text %> |
rool/rails/rforum/trunk/app/views/stats/index.rhtml:
prev. | current | |
1 | ||
1 | This RForum installation does not gather statistics. | |
2 | <% if false -%> | |
3 | <div class="stats"> | |
4 | <div class="box"> | |
5 | <img src="/images/stats/posts.png" /> | |
6 | </div> | |
3 | | |
4 | | |
5 | | |
6 | ||
7 | | |
8 | | |
9 | | |
10 | ||
8 | <div class="box"> | |
9 | <img src="/images/stats/registrations.png" /> | |
10 | </div> | |
11 | </div> | |
12 | <% end -%> | |
rool/rails/rforum/trunk/app/views/user/show.rhtml:
prev. | current | |
1 | ||
2 | ||
3 | ||
4 | | |
5 | | |
6 | | |
7 | | |
8 | | |
9 | | |
10 | | |
11 | | |
12 | | |
13 | | |
14 | | |
15 | | |
16 | | |
17 | | |
1 | <div class="user"> | |
2 | <div class="show"> | |
3 | <% unless @user.guest? -%> | |
4 | <div class="box"> | |
5 | <table class="userdata"> | |
6 | <% if @selected_user.guest? -%> | |
<tr> | ||
19 | | |
20 | | |
8 | <th><%= l(:user_name) %></th> | |
9 | <td><%=h @selected_user.guest_name %></td> | |
</tr> | ||
22 | | |
23 | | |
24 | | |
25 | | |
26 | | |
27 | | |
28 | | |
29 | | |
30 | | |
31 | | |
32 | ||
11 | <% else -%> | |
12 | <tr> | |
13 | <th><%= l(:user_name) %></th> | |
14 | <td><%=h @selected_user.guest? ? @selected_user.guest_name : @selected_user.firstname %></td> | |
15 | </tr> | |
16 | <% if @user.can_see_user_email? %> | |
17 | <tr> | |
18 | <th><%= l(:user_email) %></th> | |
19 | <td><%=h @selected_user.email %></td> | |
20 | </tr> | |
21 | <% end %> | |
22 | <tr> | |
23 | <th><%= l(:user_number_of_posts) %></th> | |
24 | <td><%=h @selected_user.posts.size %></td> | |
25 | </tr> | |
26 | <% end -%> | |
27 | </table> | |
28 | </div> | |
34 | ||
35 | ||
36 | | |
37 | ||
<p /> | ||
39 | | |
40 | | |
41 | | |
31 | <div class="box user_message"> | |
32 | <% if @selected_user.guest? -%> | |
33 | This user's details are not available. | |
34 | <% elsif @selected_user.email.empty? -%> | |
35 | This user cannot receive user messages. | |
36 | <% else -%> | |
37 | <h3><%= l(:send_user_message) %></h3> | |
39 | <p /> | |
40 | The text entered below will be sent in an e-mail message. The message | |
41 | will contain your address, as the sender, so that the recipient can | |
42 | reply directly. If you do not want to reveal your e-mail address in | |
43 | this way, do not send a message. | |
44 | ||
45 | <p /> | |
<% if @message_sent %> | ||
<span class="message_sent"><%= l(:user_message_sent) %></span> | ||
45 | ||
<% else %> | ||
47 | ||
<form action="<%= url_for %>" method="post"> | ||
<textarea name="text" cols="56" rows="16"><%=h @text %></textarea> | ||
<p /> | ||
... | ... | |
</form> | ||
<% end %> | ||
64 | | |
65 | ||
66 | ||
67 | ||
68 | ||
65 | <% end -%> | |
66 | </div> | |
67 | <% else -%> | |
68 | <div class="box"> | |
69 | Guests cannot view user details. Please <a href="/rails/hub/account/login">log in</a>. | |
70 | </div> | |
71 | <% end -%> | |
72 | </div> | |
73 | </div> |
rool/rails/rforum/trunk/config/site.rb:
prev. | current | |
:site_name => 'RISC OS Open Forum', | ||
# All email generated by the forum will have this sender address | ||
10 | | |
10 | :site_email => 'webmaster@riscosopen.org', | |
# Hostname of this forum (used for messageids) | ||
13 | | |
13 | :hostname => 'riscosopen.org', | |
# See /public/skins/ for available skins. | ||
:skin => 'risc_os_open', | ||
... | ... | |
# :noone (don't show email address) | ||
# :users (show email address to other registered users) | ||
# :everyone (show email address to everyone) | ||
45 | | |
45 | :show_user_email_to => :noone, # Except admins | |
# Should the forum send posts to the mailing list | ||
# (only if a forum has a list_address) | ||
:deliver_mail => true, | ||
50 | | |
50 | :bounce_address => 'webmaster@riscosopen.org', | |
:accept_mail_from_guests => true, | ||
... | ... | |
# after the number of hours specified by the parameter below. | ||
:security_token_life_hours => 24, | ||
70 | | |
70 | :spam_filter_regex => /(cialis|viagra|xenical|valium|xanax|phentermine|hydrocodone|tramadol|alprazolam|carisoprodol|rivotril|narod\.ru|cymbalta|e-cigarette|ezigaretten\.com|billige zigaretten)/i, | |
:use_sites => false | ||
} |
rool/rails/rforum/trunk/db/schema.rb:
prev. | current | |
# migrations feature of ActiveRecord to incrementally modify your database, and | ||
# then regenerate this schema definition. | ||
5 | ||
5 | ActiveRecord::Schema.define(:version => 12) do | |
create_table "attachments", :force => true do |t| | ||
t.column "created_at", :datetime, :null => false | ||
... | ... | |
t.column "list_address", :string, :limit => 50 | ||
t.column "position", :integer | ||
t.column "add_mail_headers", :string | ||
32 | t.column "site_id", :integer | |
33 | t.column "readonly", :integer, :default => 0, :null => false | |
34 | t.column "ml_from_address", :string, :limit => 60 | |
end | ||
add_index "forums", ["groupname"], :name => "forums_1uq", :unique => true | ||
... | ... | |
t.column "value", :integer, :null => false | ||
end | ||
44 | | |
add_index "post_votes", ["post_id"], :name => "post_votes_1ix" | ||
add_index "post_votes", ["voter_id"], :name => "post_votes_2ix" | ||
49 | add_index "post_votes", ["post_id", "voter_id"], :name => "post_votes_uq1" | |
create_table "posts", :force => true do |t| | ||
t.column "created_at", :datetime, :null => false | ||
... | ... | |
t.column "post_method", :string, :limit => 10, :default => "web", :null => false | ||
end | ||
70 | add_index "posts", ["l", "r", "parent_id"], :name => "posts_1ix" | |
add_index "posts", ["messageid"], :name => "posts_1uq", :unique => true | ||
68 | | |
add_index "posts", ["messageid"], :name => "posts_2ix" | ||
70 | | |
73 | add_index "posts", ["id", "created_at", "topic_id", "deleted"], :name => "posts_3ix" | |
add_index "posts", ["created_at"], :name => "posts_4ix" | ||
add_index "posts", ["l"], :name => "posts_5ix" | ||
add_index "posts", ["r"], :name => "posts_6ix" | ||
... | ... | |
t.column "sessid", :string, :limit => 60, :null => false | ||
t.column "data", :text | ||
t.column "updated_at", :datetime | ||
91 | t.column "created_at", :datetime | |
end | ||
add_index "sessions", ["sessid"], :name => "sessions_1uq", :unique => true | ||
96 | create_table "sites", :force => true do |t| | |
97 | t.column "created_at", :datetime, :null => false | |
98 | t.column "updated_at", :datetime, :null => false | |
99 | t.column "host", :string, :limit => 60 | |
100 | t.column "language", :string, :limit => 5 | |
101 | t.column "layout", :string, :limit => 20 | |
102 | t.column "skin", :string, :limit => 20 | |
103 | t.column "owner_id", :integer | |
104 | t.column "position", :integer | |
105 | end | |
106 | ||
create_table "tags", :force => true do |t| | ||
t.column "name", :string, :limit => 60, :null => false | ||
end | ||
... | ... | |
t.column "topic_id", :integer, :null => false | ||
end | ||
103 | | |
118 | add_index "topic_reads", ["user_id", "topic_id"], :name => "topic_reads_1uq", :unique => true | |
create_table "topic_subscriptions", :force => true do |t| | ||
t.column "created_at", :datetime, :null => false | ||
... | ... | |
t.column "post_counter", :integer, :default => 1 | ||
end | ||
129 | | |
144 | add_index "topics", ["forum_id", "last_post_created_at", "deleted"], :name => "topics_1ix" | |
create_table "topics_tags", :id => false, :force => true do |t| | ||
t.column "topic_id", :integer, :null => false | ||
... | ... | |
t.column "created_at", :datetime, :null => false | ||
t.column "updated_at", :datetime, :null => false | ||
t.column "role", :string, :limit => 50, :null => false | ||
142 | | |
143 | | |
144 | | |
157 | t.column "name", :string, :limit => 64, :null => false | |
158 | t.column "email", :string, :null => false | |
159 | t.column "firstname", :string, :limit => 160 | |
t.column "surname", :string, :limit => 30 | ||
146 | | |
147 | | |
161 | t.column "password", :string, :limit => 40, :null => false | |
162 | t.column "security_token", :string, :limit => 40 | |
t.column "additional_information", :text | ||
t.column "token_expiry", :datetime | ||
t.column "receives_email", :integer, :default => 0, :null => false | ||
t.column "sends_email", :integer, :default => 0, :null => false | ||
167 | t.column "salt", :string, :limit => 40 | |
168 | t.column "activated", :integer, :default => 0, :null => false | |
end | ||
171 | add_index "users", ["role"], :name => "users_1ix" | |
add_index "users", ["name"], :name => "users_1uq", :unique => true | ||
155 | | |
end |
rool/rails/rforum/trunk/lang/en.yaml:
prev. | current | |
postmenu_delete_topic: Delete topic | ||
postmenu_undelete_topic: Undelete topic | ||
postmenu_edit_post: Edit | ||
33 | ||
34 | ||
35 | ||
36 | ||
33 | delete_post_confirmation_prompt: Are you sure you want to delete this post? | |
34 | undelete_post_confirmation_prompt: Are you sure you want to undelete this post? | |
35 | delete_topic_confirmation_prompt: Are you sure you want to delete this topic? | |
36 | undelete_topic_confirmation_prompt: Are you sure you want to undelete this topic? | |
move_topic_to: 'Move topic "%s" from forum "%s" to:' | ||
rool/rails/rforum/trunk/test/unit/post_menu_test.rb:
prev. | current | |
item = RForum::PostMenu::Item | ||
EXPECTED_ITEMS = { | ||
11 | | |
11 | :reply_to => item.new('Reply with quote', | |
{:controller => 'topic', :action => 'show', :id => 1, :anchor => 'postform', | ||
:params => {'reply_to' => 1}}), | ||
14 | | |
15 | | |
16 | | |
17 | | |
14 | :delete_post => item.new('Delete', {:controller => 'topic', :action => 'delete_post', | |
15 | :id => 2}, 'Are you sure you want to delete this post?'), | |
16 | :delete_topic => item.new('Delete topic', {:controller => 'topic', :action => 'delete_post', | |
17 | :id => 1}, 'Are you sure you want to delete this topic?') | |
} | ||
def setup | ||
... | ... | |
end | ||
# HELPERS | ||
68 | | |
68 | ||
def delete_post_item(post_id) | ||
delete_post = EXPECTED_ITEMS[:delete_post].dup | ||
delete_post.target[:id] = post_id |