Skip to content

Commit a786823

Browse files
committed
Fix topic moderation
1 parent eaca847 commit a786823

File tree

3 files changed

+48
-42
lines changed

3 files changed

+48
-42
lines changed

featherbb/Controller/Topic.php

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,23 @@ public function moderate($req, $res, $args)
229229
$start_from = Container::get('user')->disp_posts * ($p - 1);
230230

231231
// Delete one or more posts
232-
if (Input::post('delete_posts') || Input::post('delete_posts_comply')) {
233-
$posts = $this->model->delete_posts($args['id'], $args['fid']);
234-
235-
View::setPageInfo(array(
236-
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Moderate')),
237-
'active_page' => 'moderate',
238-
'posts' => $posts,
239-
)
240-
)->addTemplate('moderate/delete_posts.php')->display();
232+
if (Input::post('delete_posts_comply')) {
233+
return $this->model->delete_posts($args['id'], $args['fid']);
241234
}
242-
if (Input::post('split_posts') || Input::post('split_posts_comply')) {
243-
235+
else if (Input::post('delete_posts')) {
236+
$posts = $this->model->delete_posts($args['id'], $args['fid']);
237+
238+
View::setPageInfo(array(
239+
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Moderate')),
240+
'active_page' => 'moderate',
241+
'posts' => $posts,
242+
)
243+
)->addTemplate('moderate/delete_posts.php')->display();
244+
}
245+
else if (Input::post('split_posts_comply')) {
246+
return $this->model->split_posts($args['id'], $args['fid'], $p);
247+
}
248+
else if (Input::post('split_posts')) {
244249
View::setPageInfo(array(
245250
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Moderate')),
246251
'focus_element' => array('subject','new_subject'),
@@ -251,37 +256,37 @@ public function moderate($req, $res, $args)
251256
'list_forums' => $this->model->get_forum_list_split($args['fid']),
252257
)
253258
)->addTemplate('moderate/split_posts.php')->display();
254-
255259
}
260+
else {
261+
// Show the moderate posts view
256262

257-
// Show the moderate posts view
263+
// Used to disable the Move and Delete buttons if there are no replies to this topic
264+
$button_status = ($cur_topic['num_replies'] == 0) ? ' disabled="disabled"' : '';
258265

259-
// Used to disable the Move and Delete buttons if there are no replies to this topic
260-
$button_status = ($cur_topic['num_replies'] == 0) ? ' disabled="disabled"' : '';
266+
/*if (isset($_GET['action']) && $_GET['action'] == 'all') {
267+
Container::get('user')->disp_posts = $cur_topic['num_replies'] + 1;
268+
}*/
261269

262-
/*if (isset($_GET['action']) && $_GET['action'] == 'all') {
263-
Container::get('user')->disp_posts = $cur_topic['num_replies'] + 1;
264-
}*/
270+
if (ForumSettings::get('o_censoring') == '1') {
271+
$cur_topic['subject'] = Utils::censor($cur_topic['subject']);
272+
}
265273

266-
if (ForumSettings::get('o_censoring') == '1') {
267-
$cur_topic['subject'] = Utils::censor($cur_topic['subject']);
274+
View::setPageInfo(array(
275+
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), Utils::escape($cur_topic['forum_name']), Utils::escape($cur_topic['subject'])),
276+
'page' => $p,
277+
'active_page' => 'moderate',
278+
'cur_topic' => $cur_topic,
279+
'url_topic' => Url::url_friendly($cur_topic['subject']),
280+
'url_forum' => Url::url_friendly($cur_topic['forum_name']),
281+
'fid' => $args['fid'],
282+
'id' => $args['id'],
283+
'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'moderate/topic/' . $args['id'] . '/forum/' . $args['fid'] . '/action/moderate/#'),
284+
'post_data' => $this->model->display_posts_moderate($args['id'], $start_from),
285+
'button_status' => $button_status,
286+
'start_from' => $start_from,
287+
)
288+
)->addTemplate('moderate/posts_view.php')->display();
268289
}
269-
270-
View::setPageInfo(array(
271-
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), Utils::escape($cur_topic['forum_name']), Utils::escape($cur_topic['subject'])),
272-
'page' => $p,
273-
'active_page' => 'moderate',
274-
'cur_topic' => $cur_topic,
275-
'url_topic' => Url::url_friendly($cur_topic['subject']),
276-
'url_forum' => Url::url_friendly($cur_topic['forum_name']),
277-
'fid' => $args['fid'],
278-
'id' => $args['id'],
279-
'paging_links' => '<span class="pages-label">'.__('Pages').' </span>'.Url::paginate($num_pages, $p, 'moderate/topic/'.$args['id'].'/forum/'.$args['fid'].'/action/moderate/#'),
280-
'post_data' => $this->model->display_posts_moderate($args['id'], $start_from),
281-
'button_status' => $button_status,
282-
'start_from' => $start_from,
283-
)
284-
)->addTemplate('moderate/posts_view.php')->display();
285290
}
286291

287292
public function action($req, $res, $args)

featherbb/Model/Topic.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,10 @@ public function delete_posts($tid, $fid)
621621
Forum::update($fid);
622622
return Router::redirect(Router::pathFor('Topic', array('id' => $tid)), __('Delete posts redirect'));
623623
}
624-
625-
$posts = Container::get('hooks')->fire('model.topic.delete_posts', $posts);
626-
return $posts;
624+
else {
625+
$posts = Container::get('hooks')->fire('model.topic.delete_posts', $posts);
626+
return $posts;
627+
}
627628
}
628629

629630
public function get_topic_info($fid, $tid)

featherbb/View/moderate/posts_view.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
<div class="postbody">
5454
<div class="postleft">
5555
<dl>
56-
<dt><strong><?= Utils::escape($post['poster_disp']) ?></strong></dt>
57-
<dd class="usertitle"><strong><?= Utils::escape($post['user_title']) ?></strong></dd>
56+
<dt><strong><?= $post['poster_disp'] ?></strong></dt>
57+
<dd class="usertitle"><strong><?= $post['user_title'] ?></strong></dd>
5858
</dl>
5959
</div>
6060
<div class="postright">
6161
<h3 class="nosize"><?php _e('Message') ?></h3>
6262
<div class="postmsg">
63-
<?= Utils::escape($post['message'])."\n" ?>
63+
<?= $post['message']."\n" ?>
6464
<?php if ($post['edited'] != '') {
6565
echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.__('Last edit').' '.Utils::escape($post['edited_by']).' ('.Utils::format_time($post['edited']).')</em></p>'."\n";
6666
}

0 commit comments

Comments
 (0)