Revert "Small changes that break everything"

This reverts commit e61bd6c3c0.
This commit is contained in:
Visman 2022-01-17 18:06:49 +07:00
parent e61bd6c3c0
commit efaf3112d8
39 changed files with 79 additions and 93 deletions

View file

@ -213,7 +213,7 @@ class FileCache implements CacheInterface
if (! \preg_match('%^[a-z0-9_\.]+$%Di', $key)) {
throw new InvalidArgumentException('Key is not a legal value');
}
if ('poll' === \substr($key, 0, 4)) {
if ('poll' == \substr($key, 0, 4)) {
return $this->cacheDir . "/polls/{$key}.php";
} else {
return $this->cacheDir . "/cache_{$key}.php";

View file

@ -175,7 +175,7 @@ class Container
$value = \preg_replace_callback(
'~\\\%|%([a-z0-9_]+(?:\.[a-z0-9_]+)*)%~i',
function ($matches) {
return '\\%' === $matches[0] ? '%' : $this->__get($matches[1]);
return '\\%' == $matches[0] ? '%' : $this->__get($matches[1]);
},
$value
);

View file

@ -226,7 +226,7 @@ class Mysql
$table = $this->tName($table);
$vars = [
':tname' => $table,
':index' => 'PRIMARY' === $index ? $index : $table . '_' . $index,
':index' => 'PRIMARY' == $index ? $index : $table . '_' . $index,
];
$query = 'SELECT 1
FROM INFORMATION_SCHEMA.STATISTICS
@ -418,7 +418,7 @@ class Mysql
$stmt->closeCursor();
$type = $result['COLUMN_TYPE'];
$allowNull = 'YES' === $result['IS_NULLABLE'];
$allowNull = 'YES' == $result['IS_NULLABLE'];
$default = $result['COLUMN_DEFAULT'];
$collate = \str_replace('utf8mb4_', '', $result['COLLATION_NAME'], $count);
@ -444,7 +444,7 @@ class Mysql
$query = "ALTER TABLE `{$table}` ADD ";
if ('PRIMARY' === $index) {
if ('PRIMARY' == $index) {
$query .= 'PRIMARY KEY';
} else {
$this->nameCheck($index);
@ -471,7 +471,7 @@ class Mysql
$query = "ALTER TABLE `{$table}` DROP ";
if ('PRIMARY' === $index) {
if ('PRIMARY' == $index) {
$query .= "PRIMARY KEY";
} else {
$this->nameCheck($index);

View file

@ -308,7 +308,7 @@ class Sqlite
break;
}
} while ('' !== \trim($subSchema));
} while ('' != \trim($subSchema));
return $result;
}

View file

@ -261,11 +261,11 @@ class Lang
continue;
// комментарий
} elseif ('#' === $line[0]) {
} elseif ('#' == $line[0]) {
continue;
// многострочное содержимое
} elseif ('"' === $line[0]) {
} elseif ('"' == $line[0]) {
if (isset($curComm)) {
$curVal .= $this->originalLine($line);
}
@ -336,8 +336,8 @@ class Lang
{
if (
isset($line[1])
&& '"' === $line[0]
&& '"' === $line[-1]
&& '"' == $line[0]
&& '"' == $line[-1]
) {
$line = \substr($line, 1, -1);
}

View file

@ -197,7 +197,7 @@ class Router
*/
public function route(string $method, string $uri): array
{
$head = 'HEAD' === $method;
$head = 'HEAD' == $method;
if (
empty($this->methods[$method])

View file

@ -54,7 +54,7 @@ class BanList extends Model
{
$val = \trim($val ?? '');
if ('' === $val) {
if ('' == $val) {
return null;
} elseif ($toLower) {
return \mb_strtolower($val, 'UTF-8');

View file

@ -57,7 +57,7 @@ class Filter extends Method
|| 'ILIKE' === $like
) {
// кроме * есть другие символы
if ('' !== \trim($rule[1], '*')) {
if ('' != \trim($rule[1], '*')) {
$where[] = "b.{$field} {$like} ?{$fields[$field]} ESCAPE '#'";
$vars[] = \str_replace(['#', '%', '_', '*'], ['##', '#%', '#_', '%'], $rule[1]);
}

View file

@ -29,9 +29,9 @@ class Insert extends Method
}
if (
'' === $ban['username']
&& '' === $ban['ip']
&& '' === $ban['email']
'' == $ban['username']
&& '' == $ban['ip']
&& '' == $ban['email']
) {
throw new InvalidArgumentException('Empty ban');
}

View file

@ -30,9 +30,9 @@ class Update extends Method
}
if (
'' === $ban['username']
&& '' === $ban['ip']
&& '' === $ban['email']
'' == $ban['username']
&& '' == $ban['ip']
&& '' == $ban['email']
) {
throw new InvalidArgumentException('Empty ban');
}

View file

@ -33,7 +33,7 @@ class Load extends Method
$value = \json_decode($row['conf_value'], true, 512, \JSON_THROW_ON_ERROR);
break;
case 'b':
$value = '1' === $row['conf_value'] ? 1 : 0;
$value = '1' == $row['conf_value'] ? 1 : 0;
break;
case 'i':
if (null !== $row['conf_value']) {

View file

@ -127,7 +127,7 @@ class Online extends Model
if ($cur['user_id'] > 0) {
$users[$cur['user_id']] = $cur['ident'];
// гость
} elseif ('' === $cur['o_name']) {
} elseif ('' == $cur['o_name']) {
$guests[] = $cur['ident'];
// бот
} else {

View file

@ -249,23 +249,15 @@ abstract class Page extends Model
if (
1 === $this->user->g_read_board
&& '' !== $this->c->config->o_additional_navlinks
&& '' != $this->c->config->o_additional_navlinks
) {
// position|name|link[|id]\n
if (
\preg_match_all(
'%^(\d+)\|([^\|\n\r]+)\|([^\|\n\r]+)(?:\|([^\|\n\r]+))?%m',
$this->c->config->o_additional_navlinks . "\n",
$matches
)
) {
if (\preg_match_all('%^(\d+)\|([^\|\n\r]+)\|([^\|\n\r]+)(?:\|([^\|\n\r]+))?%m', $this->c->config->o_additional_navlinks . "\n", $matches)) {
$k = \count($matches[0]);
for ($i = 0; $i < $k; ++$i) {
if (empty($matches[4][$i])) {
$matches[4][$i] = 'extra' . $i;
}
if (isset($navGen[$matches[4][$i]])) {
$navGen[$matches[4][$i]] = [$matches[3][$i], $matches[2][$i], $matches[2][$i]];
} else {

View file

@ -313,8 +313,7 @@ class Bans extends Admin
foreach ($data as $field => $value) {
if (
null === $value
|| '' === $value
'' == $value
|| 'order_by' === $field
|| 'direction' === $field
) {
@ -361,10 +360,10 @@ class Bans extends Admin
return $this->c->Message->message('Bad request');
}
$idsN = $this->forFilter($data);
$number = \count($idsN);
$idsN = $this->forFilter($data);
if (! $number) {
$number = \count($idsN);
if (0 == $number) {
$this->fIswev = ['i', 'No bans found'];
return $this->view([], 'GET', $data);
@ -845,9 +844,9 @@ class Bans extends Admin
{
if (
$this->banCount < 1
&& '' === $v->username
&& '' === $v->ip
&& '' === $v->email
&& '' == $v->username
&& '' == $v->ip
&& '' == $v->email
) {
$v->addError('Must enter message');
}

View file

@ -332,7 +332,7 @@ class Groups extends Admin
}
if (
isset($data['g_promote_next_group'])
&& 0 === $data['g_promote_next_group'] * $data['g_promote_min_posts']
&& 0 == $data['g_promote_next_group'] * $data['g_promote_min_posts']
) {
$data['g_promote_next_group'] = 0;
$data['g_promote_min_posts'] = 0;

View file

@ -96,15 +96,12 @@ class Smilies extends Parser
$new = $v->smilies;
foreach ($new as $id => $cur) {
if (
isset($old[$id])
&& $cur !== $old[$id]
) {
if (isset($old[$id]) && $cur != $old[$id]) {
$this->c->smilies->update($id, $cur);
}
}
if ($v->new_sm_code) {
if ('' != $v->new_sm_code) {
$this->c->smilies->insert([
'sm_code' => $v->new_sm_code,
'sm_position' => $v->new_sm_position,

View file

@ -42,8 +42,7 @@ class Result extends Users
}
$number = \count($idsN);
if (! $number) {
if (0 == $number) {
$view = $this->c->AdminUsers;
$view->fIswev = ['i', 'No users found'];

View file

@ -39,7 +39,7 @@ class Stat extends Users
$user = $this->c->users->load($args['id']);
if (! $number) {
if (0 == $number) {
$this->fIswev = ['i', 'Results no posts found'];
}

View file

@ -287,7 +287,7 @@ class Post extends Page
! $merge
&& ! $this->user->isGuest
) {
if (0 === $forum->no_sum_mess) {
if (0 == $forum->no_sum_mess) {
$this->user->num_posts = $this->user->num_posts + 1;
if (

View file

@ -22,7 +22,7 @@ trait PostValidatorTrait
public function vCheckSubject(Validator $v, string $subject, $attr, bool $executive): string
{
// после цензуры заголовок темы путой
if ('' === $this->c->censorship->censor($subject)) {
if ('' == $this->c->censorship->censor($subject)) {
$v->addError('No subject after censoring');
// заголовок темы только заглавными буквами
} elseif (
@ -45,7 +45,7 @@ trait PostValidatorTrait
$prepare = null;
// после цензуры текст сообщения пустой
if ('' === $this->c->censorship->censor($message)) {
if ('' == $this->c->censorship->censor($message)) {
$v->addError('No message after censoring');
// проверка парсером
} else {

View file

@ -125,7 +125,7 @@ abstract class Profile extends Page
];
}
if (
'edit' !== $type
'edit' != $type
&& $this->rules->editProfile
) {
$btns['edit-profile'] = [
@ -138,14 +138,14 @@ abstract class Profile extends Page
__('Edit '),
];
}
if ('view' !== $type) {
if ('view' != $type) {
$btns['view-profile'] = [
$this->curUser->link,
__('View '),
];
}
if (
'config' !== $type
'config' != $type
&& $this->rules->editConfig
) {
$btns['edit-settings'] = [

View file

@ -172,11 +172,11 @@ class Edit extends Profile
*/
public function vCheckSignature(Validator $v, string $signature): string
{
if ('' !== $signature) {
if ('' != $signature) {
$prepare = null;
// после цензуры текст сообщения пустой
if ('' === $this->c->censorship->censor($signature)) {
if ('' == $this->c->censorship->censor($signature)) {
$v->addError('No signature after censoring');
// количество строк
} elseif (\substr_count($signature, "\n") >= $this->curUser->g_sig_lines) {

View file

@ -91,7 +91,7 @@ class View extends Profile
// примечание администрации
if (
$this->user->isAdmMod
&& '' !== $this->curUser->admin_note
&& '' != $this->curUser->admin_note
) {
$form['sets']['note'] = [
'class' => ['data'],
@ -109,7 +109,7 @@ class View extends Profile
// личное
$fields = [];
if ('' !== $this->curUser->realname) {
if ('' != $this->curUser->realname) {
$fields['realname'] = [
'class' => ['pline'],
'type' => 'str',
@ -129,7 +129,7 @@ class View extends Profile
'caption' => 'Gender',
];
}
if ('' !== $this->curUser->location) {
if ('' != $this->curUser->location) {
$fields['location'] = [
'class' => ['pline'],
'type' => 'str',

View file

@ -186,7 +186,7 @@ class Register extends Page
// уведомление о регистрации
if (
1 === $this->c->config->b_regs_report
&& '' !== $this->c->config->o_mailing_list
&& '' != $this->c->config->o_mailing_list
) {
$this->c->Lang->load('common', $this->c->config->o_default_lang);
@ -294,7 +294,7 @@ class Register extends Page
// уведомление о дубликате email
if (
1 === $this->c->config->b_regs_report
&& '' !== $this->c->config->o_mailing_list
&& '' != $this->c->config->o_mailing_list
) {
$this->c->Lang->load('common', $this->c->config->o_default_lang);

View file

@ -481,7 +481,7 @@ class Search extends Page
) {
break;
}
if ('forums_subscriptions' === $action) {
if ('forums_subscriptions' == $action) {
$list = $model->actionF($action, $forum, $user->id);
} elseif ($asTopicsList) {
$list = $model->actionT($action, $forum, $user->id);
@ -514,7 +514,7 @@ class Search extends Page
$this->nameTpl = 'forum';
if ('forums_subscriptions' === $action) {
if ('forums_subscriptions' == $action) {
$this->c->Lang->load('subforums');
$model->subforums = $list;

View file

@ -274,8 +274,7 @@ class Poll extends DataModel
foreach (\array_keys($this->question) as $q) {
if ($this->type[$q] > 1) {
$count = \count($vote[$q]);
if (! $count) {
if (0 == $count) {
return __(['No vote on question %s', $q]);
} elseif ($count > $this->type[$q]) {
return __(['Too many answers selected in question %s', $q]);

View file

@ -116,24 +116,24 @@ class Post extends DataModel
return false;
} elseif ($this->c->user->isModerator($this)) {
return true;
} elseif (1 === $this->parent->closed) {
} elseif ('1' == $this->parent->closed) {
return false;
}
return $this->user->id === $this->c->user->id
&& (
(
$this->id === $this->parent->first_post_id
$this->id == $this->parent->first_post_id
&& 1 === $this->c->user->g_delete_topics
)
|| (
$this->id !== $this->parent->first_post_id
$this->id != $this->parent->first_post_id
&& 1 === $this->c->user->g_delete_posts
)
)
&& (
0 === $this->c->user->g_deledit_interval
|| 1 === $this->edit_post
'0' == $this->c->user->g_deledit_interval
|| '1' == $this->edit_post
|| \time() - $this->posted < $this->c->user->g_deledit_interval
);
}
@ -165,15 +165,15 @@ class Post extends DataModel
return false;
} elseif ($this->c->user->isModerator($this)) {
return true;
} elseif (1 === $this->parent->closed) {
} elseif ('1' == $this->parent->closed) {
return false;
}
return $this->user->id === $this->c->user->id
&& 1 === $this->c->user->g_edit_posts
&& (
0 === $this->c->user->g_deledit_interval
|| 1 === $this->edit_post
'0' == $this->c->user->g_deledit_interval
|| '1' == $this->edit_post
|| \time() - $this->posted < $this->c->user->g_deledit_interval
|| (
$this->user->id === $this->editor_id

View file

@ -70,7 +70,7 @@ class Execute extends Method
&& \time() - $row['search_time'] < 60 * 5
) { //????
$result = \explode("\n", $row['search_data']);
$this->model->queryIds = '' === $result[0] ? [] : \array_map('\\intval', \explode(',', $result[0]));
$this->model->queryIds = '' == $result[0] ? [] : \array_map('\\intval', \explode(',', $result[0]));
$this->model->queryNoCache = false;
return true;

View file

@ -23,8 +23,8 @@ class Insert extends Method
if (
isset($data['id'])
|| ! isset($data['sm_code'], $data['sm_position'], $data['sm_image'])
|| '' === $data['sm_code']
|| '' === $data['sm_image']
|| '' == $data['sm_code']
|| '' == $data['sm_image']
) {
throw new InvalidArgumentException('Expected an array with a smile description');
}

View file

@ -24,8 +24,8 @@ class Update extends Method
if (
isset($data['id'])
|| ! isset($data['sm_code'], $data['sm_position'], $data['sm_image'])
|| '' === $data['sm_code']
|| '' === $data['sm_image']
|| '' == $data['sm_code']
|| '' == $data['sm_image']
) {
throw new InvalidArgumentException('Expected an array with a smile description');
}

View file

@ -122,7 +122,7 @@ class Current extends Action
*/
protected function isBot(string $agent) /* string|false */
{
if ('' === $agent) {
if ('' == $agent) {
return false;
}
$agentL = \strtolower($agent);

View file

@ -57,7 +57,7 @@ class Filter extends Action
|| 'ILIKE' === $like
) {
// кроме * есть другие символы
if ('' !== \trim($rule[1], '*')) {
if ('' != \trim($rule[1], '*')) {
$where[] = "u.{$field} {$like} ?{$fields[$field]} ESCAPE '#'";
$vars[] = \str_replace(['#', '%', '_', '*'], ['##', '#%', '#_', '%'], $rule[1]);
}

View file

@ -24,7 +24,7 @@ class Promote extends Action
$count = \count($args);
// перемещение всех пользователей из группы 0 в группу 1
if (2 === $count) {
if (2 == $count) {
$vars = [
':old' => $args[0]->g_id,
':new' => $args[1]->g_id,
@ -35,7 +35,7 @@ class Promote extends Action
return $this->c->DB->exec($query, $vars);
// продвижение всех пользователей в группе 0
} elseif (1 === $count) {
} elseif (1 == $count) {
$vars = [
':old' => $args[0]->g_id,
':new' => $args[0]->g_promote_next_group,

View file

@ -220,9 +220,9 @@ class User extends DataModel
{
if ($this->isBanByName) {
return __('Banned');
} elseif ('' !== $this->title) {
} elseif ('' != $this->title) {
return $this->censorTitle;
} elseif ('' !== $this->g_user_title) {
} elseif ('' != $this->g_user_title) {
return $this->censorG_user_title;
} elseif ($this->isGuest) {
return __('Guest');
@ -248,7 +248,7 @@ class User extends DataModel
{
return $this->g_sig_length > 0
&& $this->g_sig_lines > 0
&& '' !== $this->signature;
&& '' != $this->signature;
}
/**

View file

@ -117,9 +117,9 @@ function dt(int $arg, bool $dateOnly = false, string $dateFormat = null, string
if (! $noText) {
$now = \time() + $diff;
if ($date === \gmdate($dateFormat, $now)) {
if ($date == \gmdate($dateFormat, $now)) {
$date = __('Today');
} elseif ($date === \gmdate($dateFormat, $now - 86400)) {
} elseif ($date == \gmdate($dateFormat, $now - 86400)) {
$date = __('Yesterday');
}
}

View file

@ -16,7 +16,7 @@
<div id="fork" @if ($p->fNavigation) class="f-with-nav" @endif>
<header id="fork-header">
<h1 id="id-fhth1"><a id="id-fhtha" href="{{ $p->fRootLink }}">{{ $p->fTitle }}</a></h1>
@if ('' !== $p->fDescription)
@if ('' != $p->fDescription)
<p id="id-fhtdesc">{!! $p->fDescription !!}</p>
@endif
</header>

View file

@ -10,7 +10,7 @@
<a class="f-ftname" href="{{ $cur->redirect_url }}">{{ $cur->forum_name }}</a>
</span>
</h3>
@if ('' !== $cur->forum_desc)
@if ('' != $cur->forum_desc)
<p class="f-fdesc">{!! $cur->forum_desc !!}</p>
@endif
</div>
@ -45,7 +45,7 @@
@endforeach
</dl><!-- endinline -->
@endif
@if ('' !== $cur->forum_desc)
@if ('' != $cur->forum_desc)
<p class="f-fdesc">{!! $cur->forum_desc !!}</p>
@endif
@if ($cur->moderators)

View file

@ -79,7 +79,7 @@
</ul>
@if (! $post->user->isGuest && $p->user->showUserInfo)
<ul class="f-user-info-add">
@if ($p->user->isAdmMod && '' !== $post->user->admin_note)
@if ($p->user->isAdmMod && '' != $post->user->admin_note)
<li class="f-admin-note" title="{{ __('Admin note') }}">{{ $post->user->admin_note }}</li>
@endif
<li>{!! __(['Registered: %s', dt($post->user->registered, true)]) !!}</li>

View file

@ -91,7 +91,7 @@
</ul>
@if (! $post->user->isGuest && $p->user->showUserInfo)
<ul class="f-user-info-add">
@if ($p->user->isAdmMod && '' !== $post->user->admin_note)
@if ($p->user->isAdmMod && '' != $post->user->admin_note)
<li class="f-admin-note" title="{{ __('Admin note') }}">{{ $post->user->admin_note }}</li>
@endif
<li>{!! __(['Registered: %s', dt($post->user->registered, true)]) !!}</li>