Visman 5 vuotta sitten
vanhempi
commit
998d2019d9

+ 8 - 7
app/Models/Cookie/Model.php

@@ -2,9 +2,9 @@
 
 namespace ForkBB\Models\Cookie;
 
+use ForkBB\Core\Container;
 use ForkBB\Models\Model as ParentModel;
 use ForkBB\Models\User\Model as User;
-use ForkBB\Core\Container;
 use RuntimeException;
 
 class Model extends ParentModel
@@ -165,21 +165,22 @@ class Model extends ParentModel
 
         if (
             $remember
-            || (null === $remember
+            || (
+                null === $remember
                 && $this->uId === (int) $user->id
                 && $this->uRemember
             )
         ) {
             $expTime = \time() + $this->time;
-            $expire = $expTime;
-            $pfx = '';
+            $expire  = $expTime;
+            $pfx     = '';
         } else {
             $expTime = \time() + $this->c->config->o_timeout_visit;
-            $expire = 0;
-            $pfx = '-';
+            $expire  = 0;
+            $pfx     = '-';
         }
         $passHash = $this->c->Secury->hmac($user->password . $expTime, $this->key2);
-        $ckHash = $this->c->Secury->hmac($pfx . $user->id . $expTime . $passHash, $this->key1);
+        $ckHash   = $this->c->Secury->hmac($pfx . $user->id . $expTime . $passHash, $this->key1);
 
         return $this->set(self::NAME, $pfx . $user->id . '_' . $expTime . '_' . $passHash . '_' . $ckHash, $expire);
     }

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

@@ -100,7 +100,7 @@ class LoadTree extends Action
 
         // предварительная проверка разделов
         $time = [];
-        $max = \max((int) $this->c->user->last_visit, (int) $this->c->user->u_mark_all_read);
+        $max  = \max((int) $this->c->user->last_visit, (int) $this->c->user->u_mark_all_read);
         foreach ($list as $forum) {
             $t = \max($max, (int) $forum->mf_mark_all_read);
             if ($forum->last_post > $t) {

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

@@ -124,7 +124,7 @@ class Manager extends ManagerModel
         ++$depth;
         foreach ($forum->subforums as $sub) {
             $sub->__depth = $depth;
-            $list[] = $sub;
+            $list[]       = $sub;
 
             $list = $this->depthList($sub, $depth, $list);
         }

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

@@ -39,7 +39,10 @@ class Model extends DataModel
     {
         $user = $this->c->user;
         return 1 == $this->post_topics
-            || (null === $this->post_topics && 1 == $user->g_post_topics)
+            || (
+                null === $this->post_topics
+                && 1 == $user->g_post_topics
+            )
             || $user->isAdmin
             || $user->isModerator($this);
     }

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

@@ -46,7 +46,7 @@ class Refresh extends Action
             $stmt = $this->c->DB->query($sql, $vars);
             while ($row = $stmt->fetch()) {
                 $row['moderators'] = $this->formatModers($row['moderators']);
-                $list[$row['id']] = $row;
+                $list[$row['id']]  = $row;
             }
 
             if (! empty($list)) {

+ 0 - 5
app/Models/Group/Delete.php

@@ -4,8 +4,6 @@ namespace ForkBB\Models\Group;
 
 use ForkBB\Models\Action;
 use ForkBB\Models\Group\Model as Group;
-use InvalidArgumentException;
-use RuntimeException;
 
 class Delete extends Action
 {
@@ -14,9 +12,6 @@ class Delete extends Action
      *
      * @param Group $group
      * @param Group $new
-     *
-     * @throws InvalidArgumentException
-     * @throws RuntimeException
      */
     public function delete(Group $group, Group $new = null): void
     {

+ 0 - 1
app/Models/Group/Manager.php

@@ -4,7 +4,6 @@ namespace ForkBB\Models\Group;
 
 use ForkBB\Models\ManagerModel;
 use ForkBB\Models\Group\Model as Group;
-use RuntimeException;
 
 class Manager extends ManagerModel
 {

+ 0 - 2
app/Models/Group/Model.php

@@ -3,8 +3,6 @@
 namespace ForkBB\Models\Group;
 
 use ForkBB\Models\DataModel;
-use RuntimeException;
-use InvalidArgumentException;
 
 class Model extends DataModel
 {

+ 2 - 2
app/Models/Model.php

@@ -124,8 +124,8 @@ class Model
      */
     public function setAttrs(array $attrs): self
     {
-        $this->zAttrs      = $attrs; //????
-        $this->zAttrsCalc  = [];
+        $this->zAttrs     = $attrs; //????
+        $this->zAttrsCalc = [];
 
         return $this;
     }

+ 2 - 5
app/Models/User/ChangeGroup.php

@@ -29,14 +29,11 @@ class ChangeGroup extends Action
             throw new InvalidArgumentException('Expected group number');
         }
 
-        $ids = [];
-        $moderators = [];
+        $ids          = [];
+        $moderators   = [];
         $adminPresent = $newGroup->groupAdmin;
         $unverPresent = false;
         foreach ($users as $user) {
-            if (! $user instanceof User) {
-                throw new InvalidArgumentException('Expected User');
-            }
             if ($user->isGuest) {
                 throw new RuntimeException('Guest can not change group');
             }

+ 0 - 3
app/Models/User/Delete.php

@@ -29,9 +29,6 @@ class Delete extends Action
         $moderators   = [];
         $adminPresent = false;
         foreach ($users as $user) {
-            if (! $user instanceof User) {
-                throw new InvalidArgumentException('Expected User');
-            }
             if ($user->isGuest) {
                 throw new RuntimeException('Guest can not be deleted');
             }