Class: ForumController
Constant Summary
KitController::Pagebase
Instance Attribute Summary
#is_image_request, #kit_request, #layout_being_used, #requested_url, #template_being_used
Instance Method Summary
collapse
#anti_spam_okay?, #app_name, #can_moderate, #can_use, #captcha_okay?, #check_and_record_goal, #check_user, #csv_headers, #dif, #edit_page_path, #feature?, #get_asset, #get_view_content, #host_name, #index_name, #info_page_path, #kit_layout_in_use, #kit_render, #kit_session, #kit_session_end, #link_to, #mailchimp_connect, #mobile_template, #no_read, #no_write, #not_found, #not_found_404, #offline, #page_path, #pref, #rails_app_name, #render, #render_error, #render_page, #render_page_by_url, #routing_error, #sanity_check_okay?, #session_id, #set_requested_url, #show_form, #stylesheets, #super_render, #user_sees_menu?
Instance Method Details
#add_post ⇒ Object
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
# File 'app/controllers/forum_controller.rb', line 304
def add_post
unless current_user && current_user.admin?
return unless anti_spam_okay?
return unless sanity_check_okay?
return unless check_post_rate?
end
@thread = TopicThread.where(:id=>params[:id]).first
redirect_to "/forums" and return unless level_okay(@thread.topic.write_access_level)
if @thread.is_locked? && !can?(:moderate, self)
flash[:notice] = "You can't post on this thread because it has been locked by a moderator"
redirect_to @thread.link and return
end
if !@thread.is_visible? && !can?(:moderate, self)
flash[:notice] = "You can't post on this thread because it has been removed by a moderator"
redirect_to "/forums" and return
end
@post = TopicPost.new
if params[:topic_post][:body] && params[:topic_post][:body].strip.length<2
flash[:form_message] = "Your message must be at least 2 characters"
kit_render "thread", :layout_o=>get_layout('thread')
return
end
@post.topic_thread_id = @thread.id
@post.created_by_user_id = current_user.id
@post.created_by_user_display_name = current_user.display_name
@post.is_visible = 1
@post. = ''
@post.raw_body = params[:topic_post][:body]
@post.system_id = _sid
@post.kit_session_id = session_id
@post.ip = request.remote_ip
if @post.save
@thread.post_count += 1
@thread.last_post_by_user_id = current_user.id
@thread.last_post_by_user_display_name = current_user.display_name
@thread.last_post_at = Time.now
@thread.save
@thread.topic.post_count += 1 rescue 1
@thread.topic.last_thread_id = @thread.id
@thread.topic.last_post_at = Time.now
@thread.topic.last_post_id = @post.id
@thread.topic.save
@post.update_postnumber
end
if request.xhr?
render :js=>";"
else
redirect_to @thread.link_for_post(@post.id, @user_options, @mod)
end
end
|
#category_topic_list ⇒ Object
219
220
221
222
|
# File 'app/controllers/forum_controller.rb', line 219
def category_topic_list
@thread = TopicThread.find(params[:id])
render "category_topic_list", :layout=>false
end
|
363
364
365
366
367
368
|
# File 'app/controllers/forum_controller.rb', line 363
def
redirect_to "/forums" and return unless can?(:moderate, self)
@post = TopicPost.sys(_sid).where(:id=>params[:id]).first
kit_render :text=>@post.
end
|
#create_page_thread ⇒ Object
393
394
395
396
397
398
399
400
|
# File 'app/controllers/forum_controller.rb', line 393
def create_page_thread
@topic = Topic.sys(_sid).where(:id=>Preference.getCached(_sid, 'topic_for_article_discussion')).first
@post = TopicPost.new
@threads = nil
@page_id = params[:page_id]
@about_page_title = Page.find_sys_id(_sid, @page_id).title
kit_render "topic_index", :layout_o=>get_layout('threads')
end
|
#create_thread ⇒ Object
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
# File 'app/controllers/forum_controller.rb', line 402
def create_thread
return unless anti_spam_okay?
return unless sanity_check_okay?
return unless check_post_rate?
@topic = Topic.sys(_sid).where(:url=>params[:topic]).first
redirect_to "/forums" and return unless level_okay(@topic.write_access_level) && @topic.is_open? && @topic.is_visible?
@post = TopicPost.new
@post.raw_body = params[:topic_post][:body]
if @post.raw_body.strip.length<2
flash[:form_message] = "Your message must be at least 2 characters"
kit_render "topic_index", :layout_o=>get_layout('threads')
return
end
if params[:topic_post][:title].strip.length<2
flash[:form_message] = "Title must be at least 4 characters"
kit_render "topic_index", :layout_o=>get_layout('threads')
return
end
@post.system_id = _sid
@post.created_by_user_id = current_user.id
@post.created_by_user_display_name = current_user.display_name
@thread = TopicThread.new
@thread.topic_id = @topic.id
@thread.created_by_user_id = current_user.id
@thread.title = params[:topic_post][:title]
@thread. = ''
@thread.last_post_by_user_id = current_user.id
@thread.last_post_by_user_display_name = current_user.display_name
@thread.last_post_at = Time.now
@thread.post_count = 1
@thread.is_locked = 0
@thread.is_sticky = 0
@thread.locked_statement = ''
@thread.is_visible = 1
@thread.view_count = 0
@thread.heat = 0
@thread.system_id = _sid
@thread.kit_session_id = session_id
@thread.save
@post.topic_thread_id = @thread.id
@post.ip = request.remote_ip
@post.is_visible = 1
@post.kit_session_id = session_id
@post.post_number = 1
@post.save
@topic.last_post_at = Time.now
@topic.thread_count = @topic.thread_count + 1 rescue 1
@topic.post_count = @topic.post_count + 1 rescue 1
@topic.last_thread_id = @thread.id
@topic.save
@thread.first_post_id = @post.id
@thread.save
if params[:page_id].not_blank?
PageThread.create(:page_id=>params[:page_id], :topic_thread=>@thread)
end
Activity.add(_sid, "Created Thread '#{link_to(@thread.title,@thread.link)}'", current_user, 'Forums')
redirect_to @thread.link
end
|
#delete_post ⇒ Object
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
# File 'app/controllers/forum_controller.rb', line 508
def delete_post
@post = TopicPost.sys(_sid).where(:id=>params[:id]).first
redirect_to "/forums" and return unless can?(:moderate, self)
@post.mark_as_deleted(current_user, params[:delete].to_i == 0)
if @post.is_visible==0
topic = @post.topic_thread.topic
if @post.id == topic.last_post_id
new_last = @post.topic_thread.topic_posts.order("id desc").where("is_visible = 1").first
unless new_last
last_thread = topic.topic_threads.order("id desc").where("is_visible = 1").first
new_last = last_thread.topic_posts.order("id desc").where("is_visible = 1").first
end
if new_last
topic.last_post_id= new_last.id
topic.last_post_at = new_last.created_at
topic.post_count ||= 1
topic.post_count -= 1
topic.save
end
end
end
if params[:inc]
@post.created_by_user.spam_points ||= 0
@post.created_by_user.spam_points += 1
@post.created_by_user.save
end
if params[:status]
@post.created_by_user.forum_status ||= 0
@post.created_by_user.forum_status += 1
@post.created_by_user.save
end
if params[:ban]
@post.created_by_user.ban!(current_user)
end
if params[:delete_all]
Activity.add(_sid, "Deleted all posts for user '#{@post.created_by_user.email}'", current_user, 'Forums')
@post.created_by_user.notes << UserNote.new(:category=>"Forum", :description=>"Removed all posts for spamming", :created_by_id=>current_user)
TopicPost.delete_all_by_user(_sid, @post.created_by_user_id, current_user)
else
@post.created_by_user.user_notes << UserNote.new(:category=>"Forum", :description=>"Had <a href='#{@post.link}'>post</a> #{params[:delete]=='0' ? '' : 'un'}deleted", :created_by_id=>current_user.id)
end
render :js=>"done_delete(#{@post.id}, #{@post.is_visible});"
end
|
#delete_thread ⇒ Object
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
# File 'app/controllers/forum_controller.rb', line 484
def delete_thread
@thread = TopicThread.where(:id=>params[:id]).first
redirect_to "/forums" and return unless can?(:moderate, self)
@thread.is_visible=params[:undelete] ? 1 : 0
@thread. += (@thread.is_visible==0 ? "Deleted" : "Undeleted") + " by #{current_user.email} at #{Time.now}<br/>"
@thread.save
if params[:undelete]!=1 && @thread.topic.last_thread_id == @thread.id
new_last = @thread.topic.topic_threads.where("topic_threads.id <> #{@thread.id}").where("topic_threads.is_visible = 1").order(:id).last
if new_last
@thread.topic.update_attributes(:last_thread_id=>new_last.id, :last_post_at=>new_last.topic_posts.order(:id).last.created_at)
else
@thread.topic.update_attributes(:last_thread_id=>nil, :last_post_at=>nil)
end
end
if request.xhr?
render :js=>"done_delete(#{@thread.id}, #{@thread.is_visible? ? 1 : 0});" and return
else
redirect_to @thread.topic.link and return
end
end
|
#edit_post ⇒ Object
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
|
# File 'app/controllers/forum_controller.rb', line 580
def edit_post
@post = TopicPost.sys(_sid).where(:id=>params[:id]).first
redirect_to "/forums" unless @post
if can?(:moderate, self)
@post.edited(current_user)
@post. ||= ''
if @post.raw_body_changed?
@post. += "Edited by #{current_user.email} at #{Time.now}<br/>"
end
@post. += "Comment by #{current_user.email} at #{Time.now}: #{params[:comment]}<br/>" if params[:comment] && params[:comment].strip.length>0
@post.raw_body = params[:body]
elsif @post.created_by_user_id == current_user.id && @post.created_at > Time.now - (Preference.get_cached(_sid, "forum_post_edit_time") || "0").to_i.minutes
@post.edited(current_user)
@post.raw_body = params[:body]
else
redirect_to "/forums" unless @post
end
@post.save
render :json=>{:bod=>@post.body, :edits=>@post.edit_log}
end
|
#edit_thread ⇒ Object
558
559
560
561
562
563
564
|
# File 'app/controllers/forum_controller.rb', line 558
def edit_thread
@thread = TopicThread.sys(_sid).where(:id=>params[:id]).first
redirect_to "/forums" and return unless can?(:moderate, self) && @thread
@thread.update_attributes(params[:topic_thread])
respond_with_bip(@thread)
end
|
#favourite_thread ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/forum_controller.rb', line 29
def favourite_thread
@thread = TopicThread.find_sys_id(_sid, params[:id])
if @thread.is_favourited_by(current_user)
@thread.users.delete(current_user)
r = t("forum.favourite_thread")
else
@thread.users << current_user
r = t("forum.un_favourite_thread")
end
render :text=>r
end
|
#favourites ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/controllers/forum_controller.rb', line 55
def favourites
@list_name = 'forum.favourites'
if current_user
@threads = current_user.topic_threads.page(params[:page]).per(@user_options.threads_per_page)
@page_title = "Forum: Favourite Threads"
@show_watch = true
kit_render "thread_list", :layout_o=>get_layout('im-watching', ['im-watching', 'threads'])
else
redirect_to "/users/sign_in"
end
end
|
#fetch_raw ⇒ Object
566
567
568
569
570
571
572
573
574
575
576
577
578
|
# File 'app/controllers/forum_controller.rb', line 566
def fetch_raw
@post = TopicPost.sys(_sid).where(:id=>params[:id]).first
if can?(:moderate, self) || (@post.is_visible==1 && @post.topic_thread.is_visible==1 && @post.topic_thread.topic.is_visible==1 && level_okay(@post.topic_thread.topic.read_access_level))
if params[:editor]
render "fetch_raw", :layout=>false, :locals=>{:is_mod=>params[:mod]=="1"}
else
render :text=>@post.raw_body, :layout_o=>false
end
else
render :text=>"n/a", :layout_o=>false
end
end
|
#im_on ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
|
# File 'app/controllers/forum_controller.rb', line 67
def im_on
@list_name = 'forum.im_on'
if current_user
@page_title = "Forum: Threads I Posted To"
@threads = TopicThread.im_on(current_user, @user_options.threads_per_page, @mod, params[:page])
kit_render "thread_list", :layout_o=>get_layout('im-on', ['im-on', 'threads'])
else
redirect_to "/users/sign_in"
end
end
|
#index ⇒ Object
124
125
126
127
128
129
130
131
|
# File 'app/controllers/forum_controller.rb', line 124
def index
categories = TopicCategory.sys(_sid).order(:display_order).includes({:topics=>[{:last_post=>[:created_by_user, {:topic_thread=>:topic}]},{:last_thread=>:created_by_user}]})
categories = categories.where(:url=>params[:category]) if params[:category]
@categories = categories.all
@page_title = "Forums"
@canonical_tag = "/forums"
kit_render "index", :layout_o=>get_layout('index')
end
|
#lock_thread ⇒ Object
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
# File 'app/controllers/forum_controller.rb', line 467
def lock_thread
@thread = TopicThread.where(:id=>params[:id]).first
render :js=>";" and return unless can?(:moderate, self)
@thread.is_locked =params[:lock]
@thread. += (@thread.is_locked==0 ? "Locked" : "Unlocked") + " by #{current_user.email} at #{Time.now}<br/>"
@thread.save
if params[:lock]=="0"
render :js=>"$('.unlocked').show(); $('.locked').hide(); $('#locked_warning').hide(); $('#post_message').show();"
return
else
render :js=>"$('.unlocked').hide(); $('.locked').show(); $('#locked_warning').show(); $('#post_message').hide();"
return
end
end
|
#moderate ⇒ Object
14
15
16
17
18
|
# File 'app/controllers/forum_controller.rb', line 14
def moderate
redirect_to "/users/sign_in" and return unless @mod
@topic_posts = TopicPost.sys(_sid).order("id desc").where(:is_visible=>1).page(params[:page]).per(25)
kit_render "moderate", :layout_o=>get_layout('index')
end
|
#move_thread ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/forum_controller.rb', line 42
def move_thread
thread = TopicThread.find_sys_id(_sid, params[:thread_id])
topic = Topic.find_sys_id(_sid, params[:topic_id])
if topic && thread
thread.topic_id = params[:topic_id]
thread. += "Thread moved to #{topic.name} by #{current_user.email} at #{Time.now}<br/>"
thread.save
Activity.add(_sid, "Moved #{link_to('thread',thread.link)} to topic '#{topic.name}'", current_user, 'Forums')
end
redirect_to thread.link
end
|
#preview ⇒ Object
296
297
298
299
300
301
302
|
# File 'app/controllers/forum_controller.rb', line 296
def preview
post = TopicPost.new(:raw_body=>params[:body], :created_by_user=>current_user, :is_visible=>true)
post.update_body
kit_render :partial=>"post_preview", :locals=>{:post=>post}
end
|
#rate_post ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'app/controllers/forum_controller.rb', line 20
def rate_post
if TopicPostVote.where(:user_id=>current_user.id).where(:topic_post_id=>params[:id]).count > 0
render :js=>"rating_dupe(#{params[:id]})"
return
end
TopicPostVote.create(:user_id=>current_user.id, :topic_post_id=>params[:id], :score=>params[:score]=='-1' ? -1 : 1)
render :js=>"rating_done(#{params[:id]})"
end
|
#recent ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
|
# File 'app/controllers/forum_controller.rb', line 87
def recent
@list_name = "forum.recent"
@page_title = "Forum: Recent Threads"
@threads = TopicThread.most_recent(current_user, @user_options.threads_per_page, @mod, params[:page])
@destination_last = true
respond_to do |format|
format.html { kit_render "thread_list", :layout_o=>get_layout('recent', ['recent', 'threads']) }
format. { render "forum/thread_list.rss" }
end
end
|
#recent_posts ⇒ Object
79
80
81
82
83
84
85
|
# File 'app/controllers/forum_controller.rb', line 79
def recent_posts
@page_title = "Forum: Recent Posts"
@posts = TopicPost.sys(_sid).order("id desc").where(:is_visible=>1).page(params[:page]).per(50)
respond_to do |format|
format. { render "forum/post_list.rss" }
end
end
|
#report ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'app/controllers/forum_controller.rb', line 99
def report
unless current_user
redirect_to "/users/sign_in"
return
end
@post = TopicPost.sys(_sid).where(:id=>params[:id]).first
unless @post
redirect_to "/forums"
return
end
if request.post?
post_report = PostReport.create(:user_id=>current_user.id, :topic_post_id=>@post.id, :comment=>params[:body])
Activity.add(_sid,"User '#{current_user.email} reported post titled '#{@post.topic_thread.title}' by '#{ @post.created_by_user.email }'", current_user, "Users")
Notification.report_post_admin(post_report, _sid).deliver
flash[:notice] = "Thanks for reporting the post. We'll take a look and may get back to you if necessary."
redirect_to @post.link
return
end
kit_render "report", :layout_o=>get_layout('report')
end
|
#search ⇒ Object
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'app/controllers/forum_controller.rb', line 133
def search
system_id = _sid
if params[:for]
original_search_for = params[:for]
search_for = original_search_for.clone
if search_for =~ /user\:\"([^\"]+)\"/i
display_name = $1
search_for.slice!(/user\:\"([^\"]+)\"/i)
params[:for] = search_for
end
display_name = params[:display_name] if params[:display_name].not_blank?
params[:display_name] = display_name
search_fields = []
indexes = []
search_size = (params[:per] || "25").to_i
the_page = (params[:page] || "1").to_i
log = logger
[ "TopicPost", "TopicThread" ].each do |model|
indexes << "#{index_name}_#{model.tableize}"
KitIndexed.indexed_columns(model).collect { |ic|
search_fields << ic[:name] if ic[:user]
}
end
search = Tire.search indexes.join(',') do
query do
boolean do
if search_for.not_blank?
must do
string search_for, :fields=>search_fields.uniq
end
end
if display_name.not_blank?
must do
string display_name, :default_field=>:created_by_user_display_name
end
end
end
end
filter :term, :system_id=>system_id
unless @mod
filter :term, :is_visible=>1
end
from (the_page-1)*search_size
size search_size
end
@results = search.results
else
@results = nil
end
kit_render "search", :layout_o=>get_layout('search')
end
|
#test ⇒ Object
10
11
12
|
# File 'app/controllers/forum_controller.rb', line 10
def test
kit_render "test", :layout_o=>get_layout('index')
end
|
#thread ⇒ Object
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
# File 'app/controllers/forum_controller.rb', line 233
def thread
@thread = TopicThread.where(:id=>params[:id])
.includes([:topic, :created_by_user, :last_post_by_user])
.first
if @thread==nil
redirect_to "/forums" , :notice=>"Can't find that thread"
return
end
@thread.update_attributes(:view_count => @thread.view_count ? @thread.view_count+1 : 1)
@post = TopicPost.new
@posts = TopicPost.sys(_sid).where(:topic_thread_id => @thread.id).includes(:topic_post_edits).order("id " + @post_order)
@posts = @posts.includes(:created_by_user)
@posts = @posts.where(:is_visible=>1) unless @mod
params[:latest] = nil
@posts = @posts.page(params[:page]).per(@user_options.posts_per_page)
if @posts.size==0
redirect_to @thread.topic.link
return
end
users = {}
@posts.each { |p| users[p.created_by_user.id] = p.created_by_user }
User.load_forum_attributes(_sid, users)
current_user.topic_post_votes.where("topic_post_id in (#{@posts.map {|p| p.id }.join(',')})").each do |tpv|
@posts.each do |post|
if tpv.topic_post_id == post.id
post.already_voted = true
break
end
end
end if current_user
@show_mini_profile = Preference.get_cached(_sid, "forum_show_mini_profile")=="true"
if current_user && (@posts.last!=nil && @posts.last.id!=nil && current_user.id!=nil && @thread.id!=nil)
ThreadView.connection.execute("insert into thread_views (user_id, topic_thread_id, topic_post_id) values (#{current_user.id}, #{@thread.id}, #{@posts.last.id}) on duplicate key update topic_post_id = greatest(topic_post_id, #{@posts.last.id});")
if ttu = @thread.topic_thread_users.where(:user_id=>current_user.id).first
ttu.update_attributes(:email_sent=>nil)
end
end
unless level_okay(@thread.topic.read_access_level)
redirect_to "/forums"
return
end
unless @mod || (@thread.is_visible==1 && @thread.topic.is_visible==1)
redirect_to "/forums"
return
end
@meta_description = "Forums: #{@thread.topic.name} - #{@thread.title}"
@page_title = "#{@thread.topic.name} - #{@thread.title}"
@canonical_tag = @thread.link
kit_render "thread", :layout_o=>get_layout('posts')
end
|
370
371
372
373
374
375
376
377
378
379
380
381
|
# File 'app/controllers/forum_controller.rb', line 370
def
redirect_to "/forums" and return unless can?(:moderate, self)
@thread = TopicThread.where(:id=>params[:id]).first
@thread. = params[:thread][:thread_comment]
@thread. ||= ''
@thread. += "Thread comment added by #{current_user.email} at #{Time.now}<br/>"
@thread.save
Activity.add(_sid,"Added Thread Comment #{link_to(@thread.thread_comment,@thread.link)}'", current_user, 'Forums')
redirect_to @thread.link
end
|
#thread_last_unread ⇒ Object
224
225
226
227
228
229
230
231
|
# File 'app/controllers/forum_controller.rb', line 224
def thread_last_unread
@thread = TopicThread.where(:id=>params[:id]).first
if @thread==nil
redirect_to "/forums" , :notice=>"Can't find that thread"
return
end
redirect_to @thread.link_latest_unread(current_user, @user_options, @mod)
end
|
383
384
385
386
387
388
389
390
391
|
# File 'app/controllers/forum_controller.rb', line 383
def
redirect_to "/forums" and return unless can?(:moderate, self)
@topic = Topic.sys(_sid).where(:id=>params[:id]).first
@topic. = params[:topic][:topic_comment]
@topic.save
redirect_to @topic.link
end
|
#topic_index ⇒ Object
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# File 'app/controllers/forum_controller.rb', line 189
def topic_index
name = params[:topic]
@topic = load_topic(name)
if @topic==nil
if params[:topic] =~ /^(\d+)\-(.*)$/
load_topic($2)
end
end
if @topic==nil
redirect_to "/forums", :notice=>"Topic not found"
return
end
@post = TopicPost.new
@threads = TopicThread.sys(_sid).where(:topic_id=>@topic.id).order("last_post_at " + @thread_order).includes([:topic]).page(params[:page]).per(@user_options.threads_per_page)
@threads = @threads.where(:is_visible=>1) unless @mod
unless level_okay(@topic.read_access_level)
logger.debug "Required level is #{@topic.read_access_level} but current level is #{current_user ? current_user.forum_level : 'not logged in'}"
redirect_to "/forums"
return
end
@page_title = "Forums: #{@topic.name}"
@canonical_tag = "/forums/#{@topic.url}"
@meta_description = "Forums"
kit_render "topic_index", :layout_o=>get_layout('threads')
end
|