Skip to content

Commit d9c2363

Browse files
committed
Use User::can('users.view')
1 parent 3736571 commit d9c2363

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

featherbb/Controller/Profile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function action($req, $res, $args)
232232
if ($args['action'] != 'change_pass' || !Input::query('key')) {
233233
if (User::get()->g_read_board == '0') {
234234
throw new Error(__('No view'), 403);
235-
} elseif (User::get()->g_view_users == '0' && (User::get()->is_guest || User::get()->id != $args['id'])) {
235+
} elseif (!User::can('users.view') && (User::get()->is_guest || User::get()->id != $args['id'])) {
236236
throw new Error(__('No permission'), 403);
237237
}
238238
}

featherbb/Controller/Userlist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function display($req, $res, $args)
2626
{
2727
Container::get('hooks')->fire('controller.userlist.display');
2828

29-
if (User::get()->g_view_users == '0') {
29+
if (!User::can('users.view')) {
3030
throw new Error(__('No permission'), 403);
3131
}
3232

featherbb/Model/Index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function print_categories_forums()
189189
$moderators = array();
190190

191191
foreach ($mods_array as $mod_username => $mod_id) {
192-
if (User::get()->g_view_users == '1') {
192+
if (User::can('users.view')) {
193193
$moderators[] = '<a href="'.Router::pathFor('userProfile', ['id' => $mod_id]).'">'.Utils::escape($mod_username).'</a>';
194194
} else {
195195
$moderators[] = Utils::escape($mod_username);
@@ -233,7 +233,7 @@ public function collect_stats()
233233
$stats['total_topics'] = intval($query['total_topics']);
234234
$stats['total_posts'] = intval($query['total_posts']);
235235

236-
if (User::get()->g_view_users == '1') {
236+
if (User::can('users.view')) {
237237
$stats['newest_user'] = '<a href="'.Router::pathFor('userProfile', ['id' => $stats['last_user']['id']]).'">'.Utils::escape($stats['last_user']['username']).'</a>';
238238
} else {
239239
$stats['newest_user'] = Utils::escape($stats['last_user']['username']);
@@ -268,7 +268,7 @@ public function fetch_users_online()
268268

269269
foreach($query as $user_online) {
270270
if ($user_online->user_id > 1) {
271-
if (User::get()->g_view_users == '1') {
271+
if (User::can('users.view')) {
272272
$online['users'][] = "\n\t\t\t\t".'<dd><a href="'.Router::pathFor('userProfile', ['id' => $user_online->user_id]).'">'.Utils::escape($user_online->ident).'</a>';
273273
} else {
274274
$online['users'][] = "\n\t\t\t\t".'<dd>'.Utils::escape($user_online->ident);

featherbb/Model/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ public function display_search_results($search)
727727
$cur_search['message'] = Container::get('parser')->parse_message($cur_search['message'], $cur_search['hide_smilies']);
728728
$pposter = Utils::escape($cur_search['pposter']);
729729

730-
if ($cur_search['poster_id'] > 1 && User::get()->g_view_users == '1') {
730+
if ($cur_search['poster_id'] > 1 && User::can('users.view')) {
731731
$cur_search['pposter_disp'] = '<strong><a href="'.Router::pathFor('userProfile', ['id' => $cur_search['poster_id']]).'">'.$pposter.'</a></strong>';
732732
} else {
733733
$cur_search['pposter_disp'] = '<strong>'.$pposter.'</strong>';

featherbb/Model/Topic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
863863

864864
// If the poster is a registered user
865865
if ($cur_post['poster_id'] > 1) {
866-
if (User::get()->g_view_users == '1') {
866+
if (User::can('users.view')) {
867867
$cur_post['username_formatted'] = '<a href="'.Url::base().'/user/'.$cur_post['poster_id'].'/">'.Utils::escape($cur_post['username']).'</a>';
868868
} else {
869869
$cur_post['username_formatted'] = Utils::escape($cur_post['username']);
@@ -1035,7 +1035,7 @@ public function display_posts_moderate($tid, $start_from)
10351035

10361036
// If the poster is a registered user
10371037
if ($cur_post->poster_id > 1) {
1038-
if (User::get()->g_view_users == '1') {
1038+
if (User::can('users.view')) {
10391039
$cur_post->poster_disp = '<a href="'.Router::pathFor('userProfile', ['id' => $cur_post->poster_id]).'">'.Utils::escape($cur_post->poster).'</a>';
10401040
} else {
10411041
$cur_post->poster_disp = Utils::escape($cur_post->poster);

featherbb/View/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<?php
8484
$navlinks[] = '<li id="navindex"'.(($active_page == 'index') ? ' class="isactive"' : '').'><a href="'.Url::base().'/">'.__('Index').'</a></li>';
8585

86-
if (User::get()->g_read_board == '1' && User::get()->g_view_users == '1') {
86+
if (User::get()->g_read_board == '1' && User::can('users.view')) {
8787
$navlinks[] = '<li id="navuserlist"'.(($active_page == 'userlist') ? ' class="isactive"' : '').'><a href="'.Router::pathFor('userList').'">'.__('User list').'</a></li>';
8888
}
8989

0 commit comments

Comments
 (0)