Skip to content

Commit e64445e

Browse files
committed
Moving nav links of mod controls to forum and topic view files
1 parent 273f9a3 commit e64445e

File tree

9 files changed

+104
-48
lines changed

9 files changed

+104
-48
lines changed

featherbb/Controller/Forum.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ public function dealposts($req, $res, $args)
242242
)->addTemplate('moderate/delete_topics.php')->display();
243243
}
244244

245-
246245
// Open or close one or more topics
247246
elseif (Input::post('open') || Input::post('close')) {
248247
$action = (Input::post('open')) ? 0 : 1;
@@ -260,5 +259,23 @@ public function dealposts($req, $res, $args)
260259
return Router::redirect(Router::pathFor('moderateForum', array('id' => $args['id'], 'name' => $args['name'], 'page' => $args['page'])), $redirect_msg);
261260
}
262261
}
262+
263+
// Stick or unstick one or more topics
264+
elseif (Input::post('stick') || Input::post('unstick')) {
265+
$action = (Input::post('stick')) ? 1 : 0;
266+
267+
// There could be an array of topic IDs in $_POST
268+
if (Input::post('stick') || Input::post('unstick')) {
269+
$topics = Input::post('topics') ? @array_map('intval', @array_keys(Input::post('topics'))) : array();
270+
if (empty($topics)) {
271+
throw new Error(__('No topics selected'), 400);
272+
}
273+
274+
$this->model->stick_multiple_topics($action, $topics);
275+
276+
$redirect_msg = ($action) ? __('Stick topics redirect') : __('Unstick topics redirect');
277+
return Router::redirect(Router::pathFor('moderateForum', array('id' => $args['id'], 'name' => $args['name'], 'page' => $args['page'])), $redirect_msg);
278+
}
279+
}
263280
}
264281
}

featherbb/Model/Forum.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,14 @@ public function close_multiple_topics($action, $topics)
518518
$close_multiple_topics = $close_multiple_topics->update_many('closed', $action);
519519
}
520520

521+
public function stick_multiple_topics($action, $topics)
522+
{
523+
$stick_multiple_topics = DB::for_table('topics')
524+
->where_in('id', $topics);
525+
$stick_multiple_topics = Container::get('hooks')->fireDB('model.forum.stick_topic', $stick_multiple_topics);
526+
$stick_multiple_topics = $stick_multiple_topics->update_many('sticky', $action);
527+
}
528+
521529
public function delete_topics($topics, $fid)
522530
{
523531
Container::get('hooks')->fire('model.forum.delete_topics', $topics, $fid);

featherbb/View/footer.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,6 @@
2222
<div id="brdfooter" class="block">
2323
<h2><span><?php _e('Board footer') ?></span></h2>
2424
<div class="box">
25-
<?php
26-
27-
if (isset($active_page) && ($active_page == 'Forum' || $active_page == 'Topic') && User::isAdminMod()) {
28-
echo "\t\t\t\t".'<div id="modcontrols" class="inbox">'."\n";
29-
30-
if ($active_page == 'Forum') {
31-
echo "\t\t\t\t\t".'<dl>'."\n";
32-
echo "\t\t\t\t\t\t".'<dt><strong>'.__('Mod controls').'</strong></dt>'."\n";
33-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moderateForum', ['id' => $fid, 'name' => $url_forum, 'page' => $page_number]).'">'.__('Moderate forum').'</a></span></dd>'."\n";
34-
echo "\t\t\t\t\t".'</dl>'."\n";
35-
} elseif ($active_page == 'Topic') {
36-
if (isset($pid)) {
37-
$parameter = $pid;
38-
} elseif (isset($page_number) && $page_number != 1) {
39-
$parameter = $page_number;
40-
} else {
41-
$parameter = '';
42-
}
43-
echo "\t\t\t\t\t".'<dl>'."\n";
44-
echo "\t\t\t\t\t\t".'<dt><strong>'.__('Mod controls').'</strong></dt>'."\n";
45-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moderateTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject']), 'fid' => $fid, 'page' => $page_number]).'">'.__('Moderate topic').'</a></span></dd>'."\n";
46-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moveTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject']), 'fid' => $fid]).'">'.__('Move topic').'</a></span></dd>'."\n";
47-
48-
if ($cur_topic['closed'] == '1') {
49-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('openTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Open topic').'</a></span></dd>'."\n";
50-
} else {
51-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('closeTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Close topic').'</a></span></dd>'."\n";
52-
}
53-
54-
if ($cur_topic['sticky'] == '1') {
55-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('unstickTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Unstick topic').'</a></span></dd>'."\n";
56-
} else {
57-
echo "\t\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('stickTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Stick topic').'</a></span></dd>'."\n";
58-
}
59-
60-
echo "\t\t\t\t\t".'</dl>'."\n";
61-
}
62-
63-
Container::get('hooks')->fire('view.footer.mod.actions'); ?>
64-
<div class="clearer"></div>
65-
</div>
66-
<?php } ?>
6725
<div id="brdfooternav" class="inbox">
6826
<?php
6927
// Display the "Jump to" drop list

featherbb/View/forum.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@
9393
<div class="pagepost">
9494
<p class="pagelink conl"><?= $paging_links ?></p>
9595
<?= $post_link ?>
96+
<?php
97+
if (isset($active_page) && ($active_page == 'Forum') && User::isAdminMod()) {
98+
echo "\t\t\t".'<div id="modcontrols" class="inbox">'."\n";
99+
echo "\t\t\t\t".'<dl>'."\n";
100+
echo "\t\t\t\t\t".'<dt><strong>'.__('Mod controls').'</strong></dt>'."\n";
101+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moderateForum', ['id' => $fid, 'name' => $url_forum, 'page' => $page_number]).'">'.__('Moderate forum').'</a></span></dd>'."\n";
102+
echo "\t\t\t\t".'</dl>'."\n";
103+
echo "\t\t\t".'</div>'."\n";
104+
}
105+
Container::get('hooks')->fire('view.forum.mod.actions');
106+
?>
96107
</div>
97108
<ul class="crumbs">
98109
<li><a href="<?= Url::base() ?>/"><?php _e('Index') ?></a></li>

featherbb/View/moderate/moderator_forum.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@
9191
<div class="inbox crumbsplus">
9292
<div class="pagepost">
9393
<p class="pagelink conl"><?= $paging_links ?></p>
94-
<p class="conr modbuttons"><input type="submit" name="move_topics" value="<?php _e('Move') ?>"<?= $button_status ?> /> <input type="submit" name="delete_topics" value="<?php _e('Delete') ?>"<?= $button_status ?> /> <input type="submit" name="merge_topics" value="<?php _e('Merge') ?>"<?= $button_status ?> /> <input type="submit" name="open" value="<?php _e('Open') ?>"<?= $button_status ?> /> <input type="submit" name="close" value="<?php _e('Close') ?>"<?= $button_status ?> /></p>
94+
<p class="conr modbuttons">
95+
<input type="submit" name="move_topics" value="<?php _e('Move') ?>"<?= $button_status ?> />
96+
<input type="submit" name="delete_topics" value="<?php _e('Delete') ?>"<?= $button_status ?> />
97+
<input type="submit" name="merge_topics" value="<?php _e('Merge') ?>"<?= $button_status ?> />
98+
<input type="submit" name="open" value="<?php _e('Open') ?>"<?= $button_status ?> />
99+
<input type="submit" name="close" value="<?php _e('Close') ?>"<?= $button_status ?> />
100+
<input type="submit" name="stick" value="<?php _e('Stick') ?>"<?= $button_status ?> />
101+
<input type="submit" name="unstick" value="<?php _e('Unstick') ?>"<?= $button_status ?> />
102+
</p>
95103
<div class="clearer"></div>
96104
</div>
97105
<ul class="crumbs">

featherbb/View/topic.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,38 @@
110110
<div class="pagepost">
111111
<p class="pagelink conl"><?= $paging_links ?></p>
112112
<?= $post_link ?>
113+
<?php
114+
if (isset($active_page) && $active_page == 'Topic' && User::isAdminMod()) {
115+
if (isset($pid)) {
116+
$parameter = $pid;
117+
} elseif (isset($page_number) && $page_number != 1) {
118+
$parameter = $page_number;
119+
} else {
120+
$parameter = '';
121+
}
122+
echo "\t\t\t".'<div id="modcontrols" class="inbox">'."\n";
123+
echo "\t\t\t\t".'<dl>'."\n";
124+
echo "\t\t\t\t\t".'<dt><strong>'.__('Mod controls').'</strong></dt>'."\n";
125+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moderateTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject']), 'fid' => $fid, 'page' => $page_number]).'">'.__('Moderate topic').'</a></span></dd>'."\n";
126+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('moveTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject']), 'fid' => $fid]).'">'.__('Move topic').'</a></span></dd>'."\n";
127+
128+
if ($cur_topic['closed'] == '1') {
129+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('openTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Open topic').'</a></span></dd>'."\n";
130+
} else {
131+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('closeTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Close topic').'</a></span></dd>'."\n";
132+
}
133+
134+
if ($cur_topic['sticky'] == '1') {
135+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('unstickTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Unstick topic').'</a></span></dd>'."\n";
136+
} else {
137+
echo "\t\t\t\t\t".'<dd><span><a href="'.Router::pathFor('stickTopic', ['id' => $tid, 'name' => Url::url_friendly($cur_topic['subject'])]).'">'.__('Stick topic').'</a></span></dd>'."\n";
138+
}
139+
140+
echo "\t\t\t\t".'</dl>'."\n";
141+
echo "\t\t\t".'</div>'."\n";
142+
}
143+
Container::get('hooks')->fire('view.topic.mod.actions');
144+
?>
113145
</div>
114146
<ul class="crumbs">
115147
<li><a href="<?= Url::base() ?>/"><?php _e('Index') ?></a></li>

featherbb/lang/English/misc.mo

188 Bytes
Binary file not shown.

featherbb/lang/English/misc.po

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgstr ""
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
1313
"Language: en\n"
14-
"X-Generator: Poedit 1.8.4\n"
14+
"X-Generator: Poedit 1.5.4\n"
1515
"X-Poedit-SourceCharset: UTF-8\n"
1616

1717
msgid "Mark read redirect"
@@ -33,7 +33,9 @@ msgid "Too long email message"
3333
msgstr "Messages cannot be longer than 65535 characters (64 KB)."
3434

3535
msgid "Email flood"
36-
msgstr "At least %s seconds have to pass between sent emails. Please wait %s seconds and try sending again."
36+
msgstr ""
37+
"At least %s seconds have to pass between sent emails. Please wait %s seconds "
38+
"and try sending again."
3739

3840
msgid "Email sent redirect"
3941
msgstr "Email sent."
@@ -48,7 +50,9 @@ msgid "Email message"
4850
msgstr "Message"
4951

5052
msgid "Email disclosure note"
51-
msgstr "Please note that by using this form, your email address will be disclosed to the recipient."
53+
msgstr ""
54+
"Please note that by using this form, your email address will be disclosed to "
55+
"the recipient."
5256

5357
msgid "Write email"
5458
msgstr "Write and submit your email message"
@@ -60,7 +64,9 @@ msgid "Reason too long"
6064
msgstr "Your message must be under 65535 bytes (~64kb)."
6165

6266
msgid "Report flood"
63-
msgstr "At least %s seconds have to pass between reports. Please wait %s seconds and try sending again."
67+
msgstr ""
68+
"At least %s seconds have to pass between reports. Please wait %s seconds and "
69+
"try sending again."
6470

6571
msgid "Report redirect"
6672
msgstr "Post reported."
@@ -116,6 +122,12 @@ msgstr "Open"
116122
msgid "Close"
117123
msgstr "Close"
118124

125+
msgid "Stick"
126+
msgstr "Stick"
127+
128+
msgid "Unstick"
129+
msgstr "Unstick"
130+
119131
msgid "Move topic"
120132
msgstr "Move topic"
121133

@@ -173,9 +185,15 @@ msgstr "You must select at least two topics for merge."
173185
msgid "Stick topic redirect"
174186
msgstr "Topic sticked."
175187

188+
msgid "Stick topics redirect"
189+
msgstr "Topics sticked."
190+
176191
msgid "Unstick topic redirect"
177192
msgstr "Topic unsticked."
178193

194+
msgid "Unstick topics redirect"
195+
msgstr "Topics unsticked."
196+
179197
msgid "Merge topics"
180198
msgstr "Merge topics"
181199

style/themes/FeatherBB/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,10 @@ img {
17441744
font-size: 14px;
17451745
text-align: center;
17461746
}
1747+
#modcontrols.inbox dl {
1748+
margin: auto;
1749+
width:40%;
1750+
}
17471751
#modcontrols.inbox dl dt {
17481752
margin-bottom: 5px;
17491753
}

0 commit comments

Comments
 (0)