From 5d0ffc66338cf838d1185fd1d253b4a0d4b600b6 Mon Sep 17 00:00:00 2001 From: Visman Date: Mon, 29 Nov 2021 22:03:26 +0700 Subject: [PATCH] Use FORK_GROUP_UNVERIFIED --- app/Models/Pages/Register.php | 2 +- app/Models/User/Model.php | 2 +- app/Models/User/Stats.php | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Models/Pages/Register.php b/app/Models/Pages/Register.php index d163cfa8..33e5b4ac 100644 --- a/app/Models/Pages/Register.php +++ b/app/Models/Pages/Register.php @@ -150,7 +150,7 @@ class Register extends Page protected function regEnd(Validator $v): Page { if ('1' == $this->c->config->o_regs_verify) { - $groupId = 0; + $groupId = FORK_GROUP_UNVERIFIED; $key = $this->c->Secury->randomPass(31); } else { $groupId = $this->c->config->i_default_user_group; diff --git a/app/Models/User/Model.php b/app/Models/User/Model.php index b64dae2d..a0ca3eaa 100644 --- a/app/Models/User/Model.php +++ b/app/Models/User/Model.php @@ -41,7 +41,7 @@ class Model extends DataModel */ protected function getisUnverified(): bool { - return 0 === $this->group_id; + return $this->group_id === FORK_GROUP_UNVERIFIED; } /** diff --git a/app/Models/User/Stats.php b/app/Models/User/Stats.php index 7b04d08f..491d3bf0 100644 --- a/app/Models/User/Stats.php +++ b/app/Models/User/Stats.php @@ -19,19 +19,22 @@ class Stats extends Action */ public function stats(): array { + $vars = [ + ':gid' => FORK_GROUP_UNVERIFIED, + ]; $query = 'SELECT COUNT(u.id)-1 FROM ::users AS u - WHERE u.group_id!=0'; + WHERE u.group_id!=?i:gid'; - $total = $this->c->DB->query($query)->fetchColumn(); + $total = $this->c->DB->query($query, $vars)->fetchColumn(); $query = 'SELECT u.id, u.username FROM ::users AS u - WHERE u.group_id!=0 + WHERE u.group_id!=?i:gid ORDER BY u.registered DESC LIMIT 1'; - $last = $this->c->DB->query($query)->fetch(); + $last = $this->c->DB->query($query, $vars)->fetch(); return [ 'total' => $total,