Skip to content

Commit 3736571

Browse files
committed
Use User::can('topic.*')
1 parent a08af9a commit 3736571

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

featherbb/Controller/Forum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function display($req, $res, $args)
4141
$sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
4242

4343
// Can we or can we not post new topics?
44-
if (($cur_forum['post_topics'] == '' && User::get()->g_post_topics == '1') || $cur_forum['post_topics'] == '1' || $is_admmod) {
44+
if (($cur_forum['post_topics'] == '' && User::can('topic.post')) || $cur_forum['post_topics'] == '1' || $is_admmod) {
4545
$post_link = "\t\t\t".'<p class="postlink conr"><a href="'.Router::pathFor('newTopic', ['fid' => $args['id']]).'">'.__('Post topic').'</a></p>'."\n";
4646
} else {
4747
$post_link = '';

featherbb/Controller/Post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function newpost($req, $res, $args)
7474
$is_admmod = (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || (User::can('mod.is_mod') && array_key_exists(User::get()->username, $mods_array))) ? true : false;
7575

7676
// Do we have permission to post?
77-
if ((($args['tid'] && (($cur_posting['post_replies'] == '' && User::get()->g_post_replies == '0') || $cur_posting['post_replies'] == '0')) ||
78-
($args['fid'] && (($cur_posting['post_topics'] == '' && User::get()->g_post_topics == '0') || $cur_posting['post_topics'] == '0')) ||
77+
if ((($args['tid'] && (($cur_posting['post_replies'] == '' && !User::can('topic.reply')) || $cur_posting['post_replies'] == '0')) ||
78+
($args['fid'] && (($cur_posting['post_topics'] == '' && !User::can('topic.post')) || $cur_posting['post_topics'] == '0')) ||
7979
(isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
8080
!$is_admmod) {
8181
throw new Error(__('No permission'), 403);

featherbb/Model/Topic.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function get_post_link($topic_id, $closed, $post_replies, $is_admmod)
177177
$closed = Container::get('hooks')->fire('model.topic.get_post_link_start', $closed, $topic_id, $post_replies, $is_admmod);
178178

179179
if ($closed == '0') {
180-
if (($post_replies == '' && User::get()->g_post_replies == '1') || $post_replies == '1' || $is_admmod) {
180+
if (($post_replies == '' && User::can('topic.reply')) || $post_replies == '1' || $is_admmod) {
181181
$post_link = "\t\t\t".'<p class="postlink conr"><a href="'.Router::pathFor('newReply', ['tid' => $topic_id]).'">'.__('Post reply').'</a></p>'."\n";
182182
} else {
183183
$post_link = '';
@@ -201,7 +201,7 @@ public function get_post_link($topic_id, $closed, $post_replies, $is_admmod)
201201
public function is_quickpost($post_replies, $closed, $is_admmod)
202202
{
203203
$quickpost = false;
204-
if (ForumSettings::get('o_quickpost') == '1' && ($post_replies == '1' || ($post_replies == '' && User::get()->g_post_replies == '1')) && ($closed == '0' || $is_admmod)) {
204+
if (ForumSettings::get('o_quickpost') == '1' && ($post_replies == '1' || ($post_replies == '' && User::can('topic.reply'))) && ($closed == '0' || $is_admmod)) {
205205
$quickpost = true;
206206
}
207207

@@ -962,7 +962,7 @@ public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
962962
}
963963
}
964964

965-
if (($cur_topic['post_replies'] == '' && User::get()->g_post_replies == '1') || $cur_topic['post_replies'] == '1') {
965+
if (($cur_topic['post_replies'] == '' && User::can('topic.reply')) || $cur_topic['post_replies'] == '1') {
966966
$cur_post['post_actions'][] = '<li class="postquote"><span><a href="'.Router::pathFor('newQuoteReply', ['tid' => $topic_id, 'qid' => $cur_post['id']]).'">'.__('Quote').'</a></span></li>';
967967
}
968968
}

0 commit comments

Comments
 (0)