2018-01-08 Pages

This commit is contained in:
Visman 2018-01-08 16:19:49 +07:00
parent 709d7a3d25
commit 894008ac14
3 changed files with 19 additions and 19 deletions

View file

@ -252,14 +252,11 @@ class Auth extends Page
return $email;
}
$user = $this->c->users->create();
$user->__email = $email;
// email забанен
if ($this->c->bans->isBanned($user) > 0) {
if ($this->c->bans->isBanned($this->c->users->create(['email' => $email])) > 0) {
$v->addError('Banned email');
// нет пользователя с таким email
} elseif (! $user->load($email, 'email') instanceof User) {
} elseif (! ($user = $this->c->users->load($email, 'email')) instanceof User) {
$v->addError('Invalid email');
// за последний час уже был запрос на этот email
} elseif (! empty($user->last_email_sent) && time() - $user->last_email_sent < 3600) {
@ -300,7 +297,7 @@ class Auth extends Page
$user->group_id = $this->c->config->o_default_user_group;
$user->email_confirmed = 1;
$this->c->users->update($user);
$this->c->{'users_info update'};
$this->c->Cache->delete('stats');
$this->a['fIswev']['i'][] = \ForkBB\__('Account activated');
}

View file

@ -13,21 +13,24 @@ class Debug extends Page
*/
public function debug()
{
if ($this->c->DEBUG > 1) {
$total = 0;
$queries = $this->c->DB->getQueries();
foreach ($queries as $cur) {
$total += $cur[1];
if ($this->c->isInit('DB')) {
$this->numQueries = $this->c->DB->getCount();
if ($this->c->DEBUG > 1 ) {
$total = 0;
$queries = $this->c->DB->getQueries();
foreach ($queries as $cur) {
$total += $cur[1];
}
$this->queries = $queries;
$this->total = $total;
}
$this->queries = $queries;
$this->total = $total;
} else {
$this->queries = null;
$this->numQueries = 0;
}
$this->nameTpl = 'layouts/debug';
$this->onlinePos = null;
$this->numQueries = $this->c->DB->getCount();
$this->memory = memory_get_usage();
$this->peak = memory_get_peak_usage();
$this->time = microtime(true) - $this->c->START;

View file

@ -79,7 +79,7 @@ class Register extends Page
if ($this->c->bans->isBanned($user) > 0) {
$v->addError('Banned email');
// найден хотя бы 1 юзер с таким же email
} elseif (empty($v->getErrors()) && $user->load($email, 'email') !== 0) {
} elseif (empty($v->getErrors()) && 0 !== $this->c->users->load($email, 'email')) {
$v->addError('Dupe email');
}
return $email;
@ -148,11 +148,11 @@ class Register extends Page
$user->registered = time();
$user->registration_ip = $this->c->user->ip;
$newUserId = $user->insert();
$newUserId = $this->c->users->insert($user);
// обновление статистики по пользователям
if ($this->c->config->o_regs_verify != '1') {
$this->c->{'users_info update'};
$this->c->Cache->delete('stats');
}
// уведомление о регистрации
@ -246,7 +246,7 @@ class Register extends Page
$user->activate_string = null;
$this->c->users->update($user);
$this->c->{'users_info update'}; //????
$this->c->Cache->delete('stats'); //????
$this->c->Lang->load('register');