Coding style
This commit is contained in:
parent
7b6c26ae08
commit
998d2019d9
11 changed files with 19 additions and 29 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace ForkBB\Models\Group;
|
||||
|
||||
use ForkBB\Models\DataModel;
|
||||
use RuntimeException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Model extends DataModel
|
||||
{
|
||||
|
|
|
@ -124,8 +124,8 @@ class Model
|
|||
*/
|
||||
public function setAttrs(array $attrs): self
|
||||
{
|
||||
$this->zAttrs = $attrs; //????
|
||||
$this->zAttrsCalc = [];
|
||||
$this->zAttrs = $attrs; //????
|
||||
$this->zAttrsCalc = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue