Browse Source

Move rules to UserRules from User model

Visman 2 năm trước cách đây
mục cha
commit
27f6709174

+ 8 - 7
app/Controllers/Routing.php

@@ -24,9 +24,10 @@ class Routing
      */
     public function routing(): Page
     {
-        $user   = $this->c->user;
-        $config = $this->c->config;
-        $r      = $this->c->Router;
+        $user      = $this->c->user;
+        $userRules = $this->c->userRules;
+        $config    = $this->c->config;
+        $r         = $this->c->Router;
 
         // регистрация/вход/выход
         if ($user->isGuest) {
@@ -182,7 +183,7 @@ class Routing
                 );
             }
             // юзеры
-            if ($user->viewUsers) {
+            if ($userRules->viewUsers) {
                 // список пользователей
                 $r->add(
                     $r::GET,
@@ -447,7 +448,7 @@ class Routing
             }
         }
         // опросы
-        if ($user->usePoll) {
+        if ($userRules->usePoll) {
             $r->add(
                 $r::PST,
                 '/poll/{tid|i:[1-9]\d*}',
@@ -470,7 +471,7 @@ class Routing
                 'AdminStatistics'
             );
 
-            if ($this->c->userRules->viewIP) {
+            if ($userRules->viewIP) {
                 $r->add(
                     $r::GET,
                     '/admin/get/host/{ip:[0-9a-fA-F:.]+}',
@@ -526,7 +527,7 @@ class Routing
                 );
             }
 
-            if ($this->c->userRules->banUsers) {
+            if ($userRules->banUsers) {
                 $r->add(
                     $r::DUO,
                     '/admin/bans',

+ 1 - 1
app/Models/Forum/Forum.php

@@ -251,7 +251,7 @@ class Forum extends DataModel
             return [];
         }
 
-        $viewUsers = $this->c->user->viewUsers;
+        $viewUsers = $this->c->userRules->viewUsers;
 
         foreach ($attr as $id => &$cur) {
             $cur = [

+ 1 - 1
app/Models/Online/Info.php

@@ -24,7 +24,7 @@ class Info extends Method
             return null;
         }
 
-        $viewUsers            = $this->c->user->viewUsers;
+        $viewUsers            = $this->c->userRules->viewUsers;
         $this->model->maxNum  = $this->c->config->a_max_users['number'];
         $this->model->maxTime = $this->c->config->a_max_users['time'];
         $info                 = [];

+ 5 - 2
app/Models/Page.php

@@ -72,7 +72,10 @@ abstract class Page extends Model
         if (1 === $container->config->b_announcement) {
             $this->fAnnounce = $container->config->o_announcement_message;
         }
-        $this->user = $this->c->user; // передача текущего юзера в шаблон
+
+        // передача текущего юзера и его правил в шаблон
+        $this->user      = $this->c->user;
+        $this->userRules = $this->c->userRules;
 
         $this->pageHeader('mainStyle', 'link', 10000, [
             'rel'  => 'stylesheet',
@@ -121,7 +124,7 @@ abstract class Page extends Model
 
         if (
             1 === $this->user->g_read_board
-            && $this->user->viewUsers
+            && $this->userRules->viewUsers
         ) {
             $navGen[self::FI_USERS] = [
                 $r->link('Userlist'),

+ 1 - 1
app/Models/Pages/Admin.php

@@ -60,7 +60,7 @@ abstract class Admin extends Page
             'users' => [$r->link('AdminUsers'), 'Users'],
         ];
 
-        if ($this->c->userRules->banUsers) {
+        if ($this->userRules->banUsers) {
             $nav['bans'] = [$r->link('AdminBans'), 'Bans'];
         }
         if (

+ 2 - 2
app/Models/Pages/Admin/Bans.php

@@ -578,7 +578,7 @@ class Bans extends Admin
                     return $this->c->Message->message(['User is ban', $user->username]);
                 }
 
-                if ($this->c->userRules->canBanUser($user)) {
+                if ($this->userRules->canBanUser($user)) {
                     continue;
                 }
 
@@ -748,7 +748,7 @@ class Bans extends Admin
                 $v->addError('No user message');
             } elseif ($this->c->bans->banFromName($user->username) > 0) {
                 $v->addError(['User is ban', $user->username]);
-            } elseif (! $this->c->userRules->canBanUser($user)) {
+            } elseif (! $this->userRules->canBanUser($user)) {
                 if ($user->isGuest) {
                     $v->addError('Cannot ban guest message');
                 } elseif ($user->isAdmin) {

+ 3 - 3
app/Models/Pages/Admin/Users.php

@@ -107,7 +107,7 @@ abstract class Users extends Admin
                         return false;
                     }
 
-                    if (! $this->c->userRules->canBanUser($user)) {
+                    if (! $this->userRules->canBanUser($user)) {
                         $this->fIswev = [FORK_MESS_VLD, ['You are not allowed to ban the %s', $user->username]];
 
                         if ($user->isAdmMod) {
@@ -119,7 +119,7 @@ abstract class Users extends Admin
 
                     break;
                 case self::ACTION_DEL:
-                    if (! $this->c->userRules->canDeleteUser($user)) {
+                    if (! $this->userRules->canDeleteUser($user)) {
                         $this->fIswev = [FORK_MESS_VLD, ['You are not allowed to delete the %s', $user->username]];
 
                         if ($user->isAdmMod) {
@@ -131,7 +131,7 @@ abstract class Users extends Admin
 
                     break;
                 case self::ACTION_CHG:
-                    if (! $this->c->userRules->canChangeGroup($user, $profile)) {
+                    if (! $this->userRules->canChangeGroup($user, $profile)) {
                         $this->fIswev = [FORK_MESS_VLD, ['You are not allowed to change group for %s', $user->username]];
 
                         if ($user->isAdmin) {

+ 4 - 4
app/Models/Pages/Admin/Users/Action.php

@@ -55,13 +55,13 @@ class Action extends Users
         switch ($args['action']) {
 /*
             case self::ACTION_BAN:
-                if (! $this->c->userRules->banUsers) {
+                if (! $this->userRules->banUsers) {
                     $error = true;
                 }
                 break;
 */
             case self::ACTION_DEL:
-                if (! $this->c->userRules->deleteUsers) {
+                if (! $this->userRules->deleteUsers) {
                     $error = true;
                 }
 
@@ -69,12 +69,12 @@ class Action extends Users
             case self::ACTION_CHG:
                 if (
                     $profile
-                    && ! $this->c->userRules->canChangeGroup($this->c->users->load((int) $args['ids']), true)
+                    && ! $this->userRules->canChangeGroup($this->c->users->load((int) $args['ids']), true)
                 ) {
                     $error = true;
                 } elseif (
                     ! $profile
-                    && ! $this->c->userRules->changeGroup
+                    && ! $this->userRules->changeGroup
                 ) {
                     $error = true;
                 }

+ 10 - 10
app/Models/Pages/Admin/Users/Result.php

@@ -30,7 +30,7 @@ class Result extends Users
         }
 
         if (isset($data['ip'])) {
-            if (! $this->c->userRules->viewIP) {
+            if (! $this->userRules->viewIP) {
                 return $this->c->Message->message('Bad request');
             }
 
@@ -64,9 +64,9 @@ class Result extends Users
                 'token'          => 'token:AdminUsersResult',
                 'users'          => 'required|array',
                 'users.*'        => 'required|integer|min:1|max:9999999999',
-                'ban'            => $this->c->userRules->banUsers ? 'checkbox' : 'absent',
-                'delete'         => $this->c->userRules->deleteUsers ? 'checkbox' : 'absent',
-                'change_group'   => $this->c->userRules->changeGroup ? 'checkbox' : 'absent',
+                'ban'            => $this->userRules->banUsers ? 'checkbox' : 'absent',
+                'delete'         => $this->userRules->deleteUsers ? 'checkbox' : 'absent',
+                'change_group'   => $this->userRules->changeGroup ? 'checkbox' : 'absent',
             ])->addAliases([
                 'users'          => 'Select',
                 'users.*'        => 'Select',
@@ -82,17 +82,17 @@ class Result extends Users
             if ($v->validation($_POST)) {
                 if (
                     ! empty($v->ban)
-                    && $this->c->userRules->banUsers
+                    && $this->userRules->banUsers
                 ) {
                     $action = self::ACTION_BAN;
                 } elseif (
                     ! empty($v->delete)
-                    && $this->c->userRules->deleteUsers
+                    && $this->userRules->deleteUsers
                 ) {
                     $action = self::ACTION_DEL;
                 } elseif (
                     ! empty($v->change_group)
-                    && $this->c->userRules->changeGroup
+                    && $this->userRules->changeGroup
                 ) {
                     $action = self::ACTION_CHG;
                 } else {
@@ -251,19 +251,19 @@ class Result extends Users
             'btns'   => [],
         ];
 
-        if ($this->c->userRules->banUsers) {
+        if ($this->userRules->banUsers) {
             $form['btns']['ban'] = [
                 'type'  => 'submit',
                 'value' => __('Ban'),
             ];
         }
-        if ($this->c->userRules->deleteUsers) {
+        if ($this->userRules->deleteUsers) {
             $form['btns']['delete'] = [
                 'type'  => 'submit',
                 'value' => __('Delete'),
             ];
         }
-        if ($this->c->userRules->changeGroup) {
+        if ($this->userRules->changeGroup) {
             $form['btns']['change_group'] = [
                 'type'  => 'submit',
                 'value' => __('Change group'),

+ 1 - 1
app/Models/Pages/Admin/Users/View.php

@@ -119,7 +119,7 @@ class View extends Users
         $this->nameTpl    = 'admin/users';
         $this->formSearch = $this->form($data);
 
-        if ($this->c->userRules->viewIP) {
+        if ($this->userRules->viewIP) {
             $this->formIP = $this->formIP($data);
         }
 

+ 3 - 3
app/Models/Pages/Edit.php

@@ -71,7 +71,7 @@ class Edit extends Page
 
                 if (
                     $firstPost
-                    && $this->user->usePoll
+                    && $this->userRules->usePoll
                     && $v->poll_enable
                 ) {
                     $this->poll = $this->c->polls->create($v->poll);
@@ -91,7 +91,7 @@ class Edit extends Page
 
         if (
             $firstPost
-            && $this->user->usePoll
+            && $this->userRules->usePoll
         ) {
             $poll = $topic->poll;
 
@@ -199,7 +199,7 @@ class Edit extends Page
                 $topic->stick_fp = $v->stick_fp ? 1 : 0;
             }
             // опрос
-            if ($this->user->usePoll) {
+            if ($this->userRules->usePoll) {
                 $this->changePoll($topic, $v);
             }
         }

+ 1 - 1
app/Models/Pages/Index.php

@@ -26,7 +26,7 @@ class Index extends Page
         // крайний пользователь // ???? может в stats переместить?
         $this->c->stats->userLast = [
             'name' => $this->c->stats->userLast['username'],
-            'link' => $this->user->viewUsers
+            'link' => $this->userRules->viewUsers
                 ? $this->c->Router->link(
                     'User',
                     [

+ 2 - 2
app/Models/Pages/Post.php

@@ -71,7 +71,7 @@ class Post extends Page
                 );
 
                 if (
-                    $this->user->usePoll
+                    $this->userRules->usePoll
                     && $v->poll_enable
                 ) {
                     $this->poll = $this->c->polls->create($v->poll);
@@ -264,7 +264,7 @@ class Post extends Page
             $topic->first_post_id = $post->id;
 
             if (
-                $this->user->usePoll
+                $this->userRules->usePoll
                 && $v->poll_enable
             ) {
                 $topic->poll_type  = $v->poll['duration'] > 0 ? 1000 + $v->poll['duration'] : 1; // ???? перенести в модель poll?

+ 1 - 1
app/Models/Pages/PostFormTrait.php

@@ -182,7 +182,7 @@ trait PostFormTrait
         if (
             $first
             && $notPM
-            && $this->user->usePoll
+            && $this->userRules->usePoll
         ) {
             $term = $edit && $model->parent->poll_term
                 ? $model->parent->poll_term

+ 1 - 1
app/Models/Pages/PostValidatorTrait.php

@@ -218,7 +218,7 @@ trait PostValidatorTrait
         if (
             $first
             && $notPM
-            && $this->user->usePoll
+            && $this->userRules->usePoll
         ) {
             $v->addValidators([
                 'check_poll'  => [$this, 'vCheckPoll'],

+ 3 - 3
app/Models/Pages/Profile/View.php

@@ -250,7 +250,7 @@ class View extends Profile
                     'class'   => ['pline'],
                     'type'    => 'link',
                     'caption' => 'Posts info',
-                    'value'   => $this->user->showPostCount ? num($this->curUser->num_posts) : __('Show posts'),
+                    'value'   => $this->userRules->showPostCount ? num($this->curUser->num_posts) : __('Show posts'),
                     'href'    => $this->c->Router->link(
                         'SearchAction',
                         [
@@ -264,7 +264,7 @@ class View extends Profile
                     'class'   => ['pline'],
                     'type'    => 'link',
                     'caption' => 'Topics info',
-                    'value'   => $this->user->showPostCount ? num($this->curUser->num_topics) : __('Show topics'),
+                    'value'   => $this->userRules->showPostCount ? num($this->curUser->num_topics) : __('Show topics'),
                     'href'    => $this->c->Router->link(
                         'SearchAction',
                         [
@@ -274,7 +274,7 @@ class View extends Profile
                     ),
                     'title'   => __('Show topics'),
                 ];
-            } elseif ($this->user->showPostCount) {
+            } elseif ($this->userRules->showPostCount) {
                 $fields['posts'] = [
                     'class'   => ['pline'],
                     'type'    => 'str',

+ 0 - 1
app/Models/Pages/Topic.php

@@ -148,7 +148,6 @@ class Topic extends Page
         $this->crumbs       = $this->crumbs($topic);
         $this->online       = $this->c->Online->calc($this)->info();
         $this->stats        = null;
-        $this->showIpAddrs  = $this->c->userRules->viewIP;
 
         if (
             $topic->canReply

+ 5 - 5
app/Models/Pages/Userlist.php

@@ -47,10 +47,10 @@ class Userlist extends Page
         $prefix = 'POST' === $method ? 'required|' : '';
         $v = $this->c->Validator->reset()
             ->addRules([
-                'sort'  => $prefix . 'string|in:username,registered' . ($this->user->showPostCount ? ',num_posts' : ''),
+                'sort'  => $prefix . 'string|in:username,registered' . ($this->userRules->showPostCount ? ',num_posts' : ''),
                 'dir'   => $prefix . 'string|in:ASC,DESC',
                 'group' => $prefix . 'string|in:' . \implode(',', \array_keys($this->groupList)),
-                'name'  => $prefix . 'string|min:1|max:25' . ($this->user->searchUsers ? '' : '|in:*'),
+                'name'  => $prefix . 'string|min:1|max:25' . ($this->userRules->searchUsers ? '' : '|in:*'),
             ]);
 
         $error = true;
@@ -178,14 +178,14 @@ class Userlist extends Page
             'btns'   => [
                 'submit' => [
                     'type'  => 'submit',
-                    'value' => __($this->user->searchUsers ? 'Search btn' : 'Submit'),
+                    'value' => __($this->userRules->searchUsers ? 'Search btn' : 'Submit'),
                 ],
             ],
         ];
 
         $fields = [];
 
-        if ($this->user->searchUsers) {
+        if ($this->userRules->searchUsers) {
             $fields['name'] = [
                 'class'     => ['w0'],
                 'type'      => 'text',
@@ -212,7 +212,7 @@ class Userlist extends Page
             'type'    => 'select',
             'options' => [
                 ['username', __('Sort by name')],
-                ['num_posts', __('Sort by number'), $this->user->showPostCount ? null : true],
+                ['num_posts', __('Sort by number'), $this->userRules->showPostCount ? null : true],
                 ['registered', __('Sort by date')],
             ],
             'value'   => $v->sort,

+ 3 - 3
app/Models/Poll/Poll.php

@@ -133,7 +133,7 @@ class Poll extends DataModel
     protected function getcanVote(): bool
     {
         return $this->tid > 0
-            && $this->c->user->usePoll
+            && $this->c->userRules->usePoll
             && $this->isOpen
             && ! $this->userVoted;
     }
@@ -144,7 +144,7 @@ class Poll extends DataModel
     protected function getcanSeeResult(): bool
     {
         return (
-                $this->c->user->usePoll
+                $this->c->userRules->usePoll
                 || 1 === $this->c->config->b_poll_guest
             )
             && (
@@ -159,7 +159,7 @@ class Poll extends DataModel
      */
     protected function getcanEdit(): bool
     {
-        return $this->c->user->usePoll
+        return $this->c->userRules->usePoll
             && (
                 0 === $this->c->config->i_poll_time
                 || $this->tid < 1

+ 56 - 0
app/Models/Rules/Users.php

@@ -88,4 +88,60 @@ class Users extends Rules
 
         return $this->profileRules->setUser($user)->changeGroup;
     }
+
+    /**
+     * Статус возможности использования опросов
+     */
+    protected function getusePoll(): bool
+    {
+        return ! $this->user->isGuest && 1 === $this->c->config->b_poll_enabled;
+    }
+
+    /**
+     * Статус показа количества сообщений
+     */
+    protected function getshowPostCount(): bool
+    {
+        return 1 === $this->c->config->b_show_post_count || $this->user->isAdmMod;
+    }
+
+    /**
+     * Статус показа подписи
+     */
+    protected function getshowSignature(): bool
+    {
+        return 1 === $this->user->show_sig;
+    }
+
+    /**
+     * Статус показа информации пользователя
+     */
+    protected function getshowUserInfo(): bool
+    {
+        return $this->user->isAdmin || 1 === $this->c->config->b_show_user_info;
+    }
+
+    /**
+     * Статус показа аватаров
+     */
+    protected function getshowAvatar(): bool
+    {
+        return 1 === $this->c->config->b_avatars && 1 === $this->user->show_avatars;
+    }
+
+    /**
+     * Статус поиска пользователей
+     */
+    protected function getsearchUsers(): bool
+    {
+        return $this->user->isAdmin || 1 === $this->user->g_search_users;
+    }
+
+    /**
+     * Статус видимости профилей пользователей
+     */
+    protected function getviewUsers(): bool
+    {
+        return $this->user->isAdmin || 1 === $this->user->g_view_users;
+    }
 }

+ 2 - 57
app/Models/User/User.php

@@ -30,11 +30,9 @@ class User extends DataModel
         parent::__construct($container);
 
         $this->zDepend = [
-            'group_id'     => ['isUnverified', 'isGuest', 'isAdmin', 'isAdmMod', 'isBanByName', 'link', 'viewUsers', 'showPostCount', 'searchUsers', 'usePoll', 'usePM'],
+            'group_id'     => ['isUnverified', 'isGuest', 'isAdmin', 'isAdmMod', 'isBanByName', 'link', 'usePM'],
             'id'           => ['isGuest', 'link', 'online'],
             'last_visit'   => ['currentVisit'],
-            'show_sig'     => ['showSignature'],
-            'show_avatars' => ['showAvatar'],
             'signature'    => ['isSignature'],
             'email'        => ['email_normal'],
             'username'     => ['username_normal'],
@@ -260,54 +258,6 @@ class User extends DataModel
             : '';
     }
 
-    /**
-     * Статус видимости профилей пользователей
-     */
-    protected function getviewUsers(): bool
-    {
-        return $this->isAdmin || 1 === $this->g_view_users;
-    }
-
-    /**
-     * Статус поиска пользователей
-     */
-    protected function getsearchUsers(): bool
-    {
-        return $this->isAdmin || 1 === $this->g_search_users;
-    }
-
-    /**
-     * Статус показа аватаров
-     */
-    protected function getshowAvatar(): bool
-    {
-        return 1 === $this->c->config->b_avatars && 1 === $this->show_avatars;
-    }
-
-    /**
-     * Статус показа информации пользователя
-     */
-    protected function getshowUserInfo(): bool
-    {
-        return $this->isAdmin || 1 === $this->c->config->b_show_user_info;
-    }
-
-    /**
-     * Статус показа подписи
-     */
-    protected function getshowSignature(): bool
-    {
-        return 1 === $this->show_sig;
-    }
-
-    /**
-     * Статус показа количества сообщений
-     */
-    protected function getshowPostCount(): bool
-    {
-        return 1 === $this->c->config->b_show_post_count || $this->isAdmMod;
-    }
-
     /**
      * Число тем на одну страницу
      */
@@ -396,13 +346,8 @@ class User extends DataModel
     }
 
     /**
-     * Статус возможности использования опросов
+     * Информация для лога
      */
-    protected function getusePoll(): bool
-    {
-        return ! $this->isGuest && 1 === $this->c->config->b_poll_enabled;
-    }
-
     public function fLog(): string
     {
         return $this->isGuest

+ 6 - 6
app/templates/pm/topic.forkbb.php

@@ -59,19 +59,19 @@
         <address class="f-post-user">
           <div class="f-post-usticky">
             <ul hidden class="f-user-info-first">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}" rel="author">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>
         @endif
             </ul>
-        @if ($p->user->showAvatar && $post->user->avatar)
+        @if ($p->userRules->showAvatar && $post->user->avatar)
             <p class="f-avatar">
               <img alt="{{ $post->user->username }}" src="{{ $post->user->avatar }}" loading="lazy">
             </p>
         @endif
             <ul class="f-user-info">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}" rel="author">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>
@@ -80,11 +80,11 @@
         @if (! $post->user->isGuest)
               <li class="f-userstatus">{!! __($post->user->online ? 'Online' : 'Offline') !!}</li>
         @endif
-        @if ($p->user->showUserInfo && $p->user->showPostCount && $post->user->num_posts)
+        @if ($p->userRules->showUserInfo && $p->userRules->showPostCount && $post->user->num_posts)
               <li class="f-postcount"><span class="f-psfont">{!! __(['%s post', $post->user->num_posts, num($post->user->num_posts)]) !!}</span></li>
         @endif
             </ul>
-        @if ($p->user->showUserInfo)
+        @if ($p->userRules->showUserInfo)
             <ul class="f-user-info-add">
             @if ($p->user->isAdmMod && '' != $post->user->admin_note)
               <li class="f-admin-note" title="{{ __('Admin note') }}">{{ $post->user->admin_note }}</li>
@@ -109,7 +109,7 @@
           <div class="f-post-main">
             {!! $post->html() !!}
           </div>
-        @if ($p->user->showSignature && $post->user->isSignature)
+        @if ($p->userRules->showSignature && $post->user->isSignature)
           <aside class="f-post-sign">
             <div class="f-sign-brd">
               <small>- - -</small>

+ 7 - 7
app/templates/topic.forkbb.php

@@ -70,19 +70,19 @@
         <address class="f-post-user">
           <div class="f-post-usticky">
             <ul hidden class="f-user-info-first">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}" rel="author">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>
         @endif
             </ul>
-        @if ($p->user->showAvatar && $post->user->avatar)
+        @if ($p->userRules->showAvatar && $post->user->avatar)
             <p class="f-avatar">
               <img alt="{{ $post->user->username }}" src="{{ $post->user->avatar }}" loading="lazy">
             </p>
         @endif
             <ul class="f-user-info">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}" rel="author">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>
@@ -91,14 +91,14 @@
         @if (! $post->user->isGuest)
               <li class="f-userstatus">{!! __($post->user->online ? 'Online' : 'Offline') !!}</li>
         @endif
-        @if ($p->user->showUserInfo && $p->user->showPostCount && $post->user->num_posts)
+        @if ($p->userRules->showUserInfo && $p->userRules->showPostCount && $post->user->num_posts)
               <li class="f-postcount"><span class="f-psfont">{!! __(['%s post', $post->user->num_posts, num($post->user->num_posts)]) !!}</span></li>
         @endif
         @if ($linkPromote = $p->user->linkPromote($post))
               <li class="f-promoteuser"><a href="{{ $linkPromote }}" title="{{ __('Promote user title') }}"><span class="f-psfont">{!! __('Promote user') !!}</span></a></li>
         @endif
             </ul>
-        @if ($p->user->showUserInfo)
+        @if ($p->userRules->showUserInfo)
             <ul class="f-user-info-add">
             @if ($p->user->isAdmMod && '' != $post->user->admin_note)
               <li class="f-admin-note" title="{{ __('Admin note') }}">{{ $post->user->admin_note }}</li>
@@ -109,7 +109,7 @@
             @if ($post->user->location)
               <li class="f-location"><span class="f-psfont">{!! __(['From %s', $post->user->censorLocation]) !!}</span></li>
             @endif
-            @if ($p->showIpAddrs)
+            @if ($p->userRules->viewIP)
               <li class="f-poster-ip"><a href="{{ $post->linkGetHost }}" title="{{ $post->poster_ip }}"><span class="f-psfont">{!! __('IP address logged') !!}</span></a></li>
             @endif
             @if ($post->user->url)
@@ -129,7 +129,7 @@
             @include ('layouts/poll')
         @endif
           </div>
-        @if ($p->user->showSignature && $post->user->isSignature)
+        @if ($p->userRules->showSignature && $post->user->isSignature)
           <aside class="f-post-sign">
             <div class="f-sign-brd">
               <small>- - -</small>

+ 2 - 2
app/templates/topic_in_search.forkbb.php

@@ -52,14 +52,14 @@
         <address class="f-post-user">
           <div class="f-post-usticky">
             <ul hidden class="f-user-info-first">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>
         @endif
             </ul>
             <ul class="f-user-info">
-        @if ($p->user->viewUsers && $post->user->link)
+        @if ($p->userRules->viewUsers && $post->user->link)
               <li class="f-username"><a href="{{ $post->user->link }}">{{ $post->user->username }}</a></li>
         @else
               <li class="f-username">{{ $post->user->username }}</li>

+ 5 - 5
app/templates/userlist.forkbb.php

@@ -34,9 +34,9 @@
     </div>
 @if ($form = $p->form)
     <section id="fork-usrlstform"  class="f-main">
-      <h2>{!! __($p->user->searchUsers ? 'User search head' : 'User sort head') !!}</h2>
+      <h2>{!! __($p->userRules->searchUsers ? 'User search head' : 'User sort head') !!}</h2>
       <details>
-        <summary>{!! __($p->user->searchUsers ? 'User search head' : 'User sort head') !!}</summary>
+        <summary>{!! __($p->userRules->searchUsers ? 'User search head' : 'User sort head') !!}</summary>
         <div class="f-fdiv">
     @include ('layouts/form')
         </div>
@@ -61,7 +61,7 @@
               <span class="f-hc-tname">{!! __('Title') !!}</span>
               <small>),</small>
             </span>
-    @if ($p->user->showPostCount)
+    @if ($p->userRules->showPostCount)
             <span class="f-hcell f-cnumposts">
               <span class="f-hc-table">
                 <span class="f-hc-tasc"><a @if (2 === $p->activeLink) class="active" @endif href="{{ $p->links[2] }}">▲</a></span>
@@ -81,13 +81,13 @@
           </li>
     @foreach ($p->userList as $user)
           <li class="f-row" value="{{ ++$p->startNum }}">
-        @if ($p->user->viewUsers && $user->link)
+        @if ($p->userRules->viewUsers && $user->link)
             <span class="f-cell f-cusername"><a href="{{ $user->link }}">{{ $user->username }}</a></span>
         @else
             <span class="f-cell f-cusername">{{ $user->username }}</span>
         @endif
             <span class="f-cell f-ctitle"><small>(</small><i>{{ $user->title() }}</i><small>),</small></span>
-        @if ($p->user->showPostCount)
+        @if ($p->userRules->showPostCount)
             <span class="f-cell f-cnumposts">{!! __(['<b>%s</b><small> post,</small>', $user->num_posts, num($user->num_posts)]) !!}</span>
         @endif
             <span class="f-cell f-cdatereg">{!! __(['<small>registered: </small><b>%s</b>', dt($user->registered, true)]) !!}</span>