diff --git a/admin/admin_forums.php b/admin/admin_forums.php
index eea9a869f..4396d5926 100644
--- a/admin/admin_forums.php
+++ b/admin/admin_forums.php
@@ -767,6 +767,8 @@ print_page('admin_forums.tpl', 'admin');
*/
function get_info($mode, $id)
{
+ $table = null;
+ $idfield = null;
switch ($mode) {
case 'category':
$table = BB_CATEGORIES;
@@ -812,6 +814,10 @@ function get_info($mode, $id)
*/
function get_list($mode, $id, $select)
{
+ $table = null;
+ $idfield = null;
+ $order = null;
+ $namefield = null;
switch ($mode) {
case 'category':
$table = BB_CATEGORIES;
@@ -861,6 +867,10 @@ function get_list($mode, $id, $select)
*/
function renumber_order($mode, $cat = 0)
{
+ $table = null;
+ $catfield = null;
+ $orderfield = null;
+ $idfield = null;
switch ($mode) {
case 'category':
$table = BB_CATEGORIES;
diff --git a/admin/admin_rebuild_search.php b/admin/admin_rebuild_search.php
index 8ade33361..35224be4c 100644
--- a/admin/admin_rebuild_search.php
+++ b/admin/admin_rebuild_search.php
@@ -489,6 +489,7 @@ function get_rebuild_session_details($id, $details = 'all')
function get_processed_posts($mode = 'session')
{
global $last_session_data;
+ $row = [];
if ($mode == 'total') {
$sql = 'SELECT SUM(session_posts) as posts FROM ' . BB_SEARCH_REBUILD;
@@ -542,6 +543,7 @@ function clear_search_tables($mode = '')
// We limit the result to 200, in order to avoid white (255).
function create_percent_color($percent)
{
+ $percent_color = null;
$percent_ary = array(
'r' => array(86, 100),
'g' => array(0, 50),
diff --git a/bt/announce.php b/bt/announce.php
index bae3b0364..7195da42e 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -45,33 +45,21 @@ if (!isset($_GET[$passkey_key]) || !is_string($_GET[$passkey_key]) || strlen($_G
// Input var names
// String
-$input_vars_str = array(
- 'info_hash',
- 'peer_id',
- 'event',
- $passkey_key,
-);
+$input_vars_str = ['info_hash', 'peer_id', 'event', $passkey_key];
// Numeric
-$input_vars_num = array(
- 'port',
- 'uploaded',
- 'downloaded',
- 'left',
- 'numwant',
- 'compact',
-);
+$input_vars_num = ['port', 'uploaded', 'downloaded', 'left', 'numwant', 'compact'];
// Init received data
// String
foreach ($input_vars_str as $var_name) {
- $$var_name = isset($_GET[$var_name]) ? (string)$_GET[$var_name] : null;
+ ${$var_name} = isset($_GET[$var_name]) ? (string)$_GET[$var_name] : null;
}
// Numeric
foreach ($input_vars_num as $var_name) {
- $$var_name = isset($_GET[$var_name]) ? (float)$_GET[$var_name] : null;
+ ${$var_name} = isset($_GET[$var_name]) ? (float)$_GET[$var_name] : null;
}
// Passkey
-$passkey = $$passkey_key ?? null;
+$passkey = ${$passkey_key} ?? null;
// Verify request
// Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey)
@@ -351,7 +339,7 @@ if ($stopped) {
}
// Store peer info in cache
-$lp_info = array(
+$lp_info = [
'downloaded' => (float)$downloaded,
'releaser' => (int)$releaser,
'seeder' => (int)$seeder,
@@ -360,7 +348,7 @@ $lp_info = array(
'uploaded' => (float)$uploaded,
'user_id' => (int)$user_id,
'tor_type' => (int)$tor_type,
-);
+];
$lp_info_cached = CACHE('tr_cache')->set(PEER_HASH_PREFIX . $peer_hash, $lp_info, PEER_HASH_EXPIRE);
@@ -387,13 +375,10 @@ if (!$output) {
$peers .= pack('Nn', ip2long(decode_ip($peer['ip'])), $peer['port']);
}
} else {
- $peers = array();
+ $peers = [];
foreach ($rowset as $peer) {
- $peers[] = array(
- 'ip' => decode_ip($peer['ip']),
- 'port' => (int)$peer['port'],
- );
+ $peers[] = ['ip' => decode_ip($peer['ip']), 'port' => (int)$peer['port']];
}
}
@@ -412,13 +397,13 @@ if (!$output) {
$leechers = $row['leechers'];
}
- $output = array(
+ $output = [
'interval' => (int)$announce_interval,
'min interval' => (int)$announce_interval,
'peers' => $peers,
'complete' => (int)$seeders,
'incomplete' => (int)$leechers,
- );
+ ];
$peers_list_cached = CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE);
}
diff --git a/bt/scrape.php b/bt/scrape.php
index 201675415..dde894370 100644
--- a/bt/scrape.php
+++ b/bt/scrape.php
@@ -51,11 +51,11 @@ $row = DB()->fetch_row("
LIMIT 1
");
-$output['files'][$info_hash] = array(
+$output['files'][$info_hash] = [
'complete' => (int)$row['seeders'],
'downloaded' => (int)$row['complete_count'],
'incomplete' => (int)$row['leechers'],
-);
+];
echo \Rych\Bencode\Bencode::encode($output);
diff --git a/install/upgrade/changes.txt b/install/upgrade/changes.txt
index fd0fab693..6a85ca272 100644
--- a/install/upgrade/changes.txt
+++ b/install/upgrade/changes.txt
@@ -48,6 +48,4 @@ UPDATE `bb_smilies` SET `code` = ':cd:', `smile_url` = 'cd.gif', `emoticon` = 'c
// 2.3.1-rc2
ALTER TABLE `bb_search_results` CHANGE `search_id` `search_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `bb_users` CHANGE `autologin_id` `autologin_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
-
-// 2.3.1-rc3
DELETE FROM `bb_config` WHERE `config_name` = 'cron_enabled';
diff --git a/library/attach_mod/includes/functions_attach.php b/library/attach_mod/includes/functions_attach.php
index 9f27cb9ed..ef7d20cc5 100644
--- a/library/attach_mod/includes/functions_attach.php
+++ b/library/attach_mod/includes/functions_attach.php
@@ -473,6 +473,7 @@ function _set_var(&$result, $var, $type, $multibyte = false)
*/
function get_var($var_name, $default, $multibyte = false)
{
+ $type = null;
if (!isset($_REQUEST[$var_name]) ||
(is_array($_REQUEST[$var_name]) && !is_array($default)) ||
(is_array($default) && !is_array($_REQUEST[$var_name]))) {
diff --git a/library/attach_mod/includes/functions_delete.php b/library/attach_mod/includes/functions_delete.php
index b58ed4531..93fa89a05 100644
--- a/library/attach_mod/includes/functions_delete.php
+++ b/library/attach_mod/includes/functions_delete.php
@@ -16,6 +16,7 @@
*/
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
{
+ $lang = [];
// Generate Array, if it's not an array
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
return;
diff --git a/library/attach_mod/includes/functions_filetypes.php b/library/attach_mod/includes/functions_filetypes.php
index d1edb2a16..ed1f0e12b 100644
--- a/library/attach_mod/includes/functions_filetypes.php
+++ b/library/attach_mod/includes/functions_filetypes.php
@@ -51,6 +51,10 @@ function read_byte($fp)
*/
function image_getdimension($file)
{
+ $xmax = null;
+ $xmin = null;
+ $ymax = null;
+ $ymin = null;
$size = @getimagesize($file);
if ($size[0] != 0 || $size[1] != 0) {
diff --git a/library/attach_mod/includes/functions_includes.php b/library/attach_mod/includes/functions_includes.php
index 121132478..5814c518c 100644
--- a/library/attach_mod/includes/functions_includes.php
+++ b/library/attach_mod/includes/functions_includes.php
@@ -29,6 +29,7 @@ function attach_build_auth_levels($is_auth, &$s_auth_can)
function attachment_quota_settings($admin_mode, $submit = false, $mode)
{
global $template, $lang, $attach_config;
+ $this_userdata = [];
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
$upload_dir = $attach_config['upload_dir'];
diff --git a/library/attach_mod/includes/functions_selects.php b/library/attach_mod/includes/functions_selects.php
index 195e420e9..711b78d82 100644
--- a/library/attach_mod/includes/functions_selects.php
+++ b/library/attach_mod/includes/functions_selects.php
@@ -98,6 +98,7 @@ function download_select($select_name, $group_id = 0)
function category_select($select_name, $group_id = 0)
{
global $types_category, $modes_category;
+ $category_type = null;
$sql = 'SELECT group_id, cat_id FROM ' . BB_EXTENSION_GROUPS;
@@ -172,6 +173,7 @@ function size_select($select_name, $size_compare)
function quota_limit_select($select_name, $default_quota = 0)
{
global $lang;
+ $quota_name = [];
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
@@ -203,6 +205,7 @@ function quota_limit_select($select_name, $default_quota = 0)
function default_quota_limit_select($select_name, $default_quota = 0)
{
global $lang;
+ $quota_name = [];
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
diff --git a/library/attach_mod/includes/functions_thumbs.php b/library/attach_mod/includes/functions_thumbs.php
index 6819187ad..def96b034 100644
--- a/library/attach_mod/includes/functions_thumbs.php
+++ b/library/attach_mod/includes/functions_thumbs.php
@@ -94,6 +94,7 @@ function get_supported_image_types($type)
function create_thumbnail($source, $new_file, $mimetype)
{
global $attach_config, $imagick;
+ $image = null;
$source = amod_realpath($source);
$min_filesize = (int)$attach_config['img_min_thumb_filesize'];
diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php
index 9641ad234..db1d4a0f6 100644
--- a/library/includes/bbcode.php
+++ b/library/includes/bbcode.php
@@ -290,7 +290,7 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
if ($fast_and_dirty) {
// any old thing in square brackets
$find[] = '#\[.*/?\]#siU';
- $replace = '';
+ $replace = [];
$message = preg_replace($find, $replace, $message);
} // the preferable way to remove bbcode
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 328e8ef9a..6172ae7d3 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -419,6 +419,7 @@ function delta_time($timestamp_1, $timestamp_2 = TIMENOW, $granularity = 'auto')
function get_select($select, $selected = null, $return_as = 'html', $first_opt = '»» Выбрать ')
{
+ $select_name = null;
$select_ary = array();
switch ($select) {
@@ -921,6 +922,7 @@ function bb_update_config($params, $table = BB_CONFIG)
function get_db_stat($mode)
{
+ $sql = null;
switch ($mode) {
case 'usercount':
$sql = "SELECT COUNT(user_id) AS total FROM " . BB_USERS;
@@ -1480,7 +1482,7 @@ function get_forum_display_sort_option($selected_row = 0, $action = 'list', $lis
// get the good list
$list_name = 'forum_display_' . $list;
- $listrow = $$list_name;
+ $listrow = ${$list_name};
// init the result
$res = '';
diff --git a/src/Legacy/Admin/Common.php b/src/Legacy/Admin/Common.php
index ac1197cb8..5ea2fb202 100644
--- a/src/Legacy/Admin/Common.php
+++ b/src/Legacy/Admin/Common.php
@@ -219,13 +219,14 @@ class Common
{
global $lang, $log_action;
+ $topic_csv = [];
$prune = ($mode_or_topic_id === 'prune');
if (!$prune and !$topic_csv = get_id_csv($mode_or_topic_id)) {
return false;
}
- $log_topics = $sync_forums = array();
+ $log_topics = $sync_forums = [];
if ($prune) {
$sync_forums[$forum_id] = true;
@@ -300,7 +301,7 @@ class Common
");
// Get array for atom update
- $atom_csv = array();
+ $atom_csv = [];
foreach (DB()->fetch_rowset('SELECT user_id FROM ' . $tmp_user_posts) as $at) {
$atom_csv[] = $at['user_id'];
}
@@ -394,11 +395,11 @@ class Common
$row['topic_title'] = '' . $lang['TOPIC_MOVED'] . ' ' . $row['topic_title'];
}
- $log_action->mod('mod_topic_delete', array(
+ $log_action->mod('mod_topic_delete', [
'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'],
'topic_title' => $row['topic_title'],
- ));
+ ]);
}
}
@@ -448,8 +449,8 @@ class Common
$sql = "SELECT * FROM " . BB_TOPICS . " WHERE topic_id IN($topic_csv) AND topic_status != " . TOPIC_MOVED . " $where_sql";
- $topics = array();
- $sync_forums = array($to_forum_id => true);
+ $topics = [];
+ $sync_forums = [$to_forum_id => true];
foreach (DB()->fetch_rowset($sql) as $row) {
if ($row['forum_id'] != $to_forum_id) {
@@ -464,10 +465,10 @@ class Common
// Insert topic in the old forum that indicates that the topic has moved
if ($leave_shadow) {
- $shadows = array();
+ $shadows = [];
foreach ($topics as $topic_id => $row) {
- $shadows[] = array(
+ $shadows[] = [
'forum_id' => $row['forum_id'],
'topic_title' => $row['topic_title'],
'topic_poster' => $row['topic_poster'],
@@ -481,7 +482,7 @@ class Common
'topic_last_post_id' => $row['topic_last_post_id'],
'topic_moved_id' => $topic_id,
'topic_last_post_time' => $row['topic_last_post_time'],
- );
+ ];
}
if ($sql_args = DB()->build_array('MULTI_INSERT', $shadows)) {
DB()->query("INSERT INTO " . BB_TOPICS . $sql_args);
@@ -505,12 +506,12 @@ class Common
// Log action
foreach ($topics as $topic_id => $row) {
- $log_action->mod('mod_topic_move', array(
+ $log_action->mod('mod_topic_move', [
'forum_id' => $row['forum_id'],
'forum_id_new' => $to_forum_id,
'topic_id' => $topic_id,
'topic_title' => $row['topic_title'],
- ));
+ ]);
}
return true;
@@ -556,7 +557,7 @@ class Common
}
// Collect data for logs, sync..
- $log_topics = $sync_forums = $sync_topics = $sync_users = array();
+ $log_topics = $sync_forums = $sync_topics = $sync_users = [];
if ($del_user_posts) {
$sync_topics = DB()->fetch_rowset("SELECT DISTINCT topic_id FROM " . BB_POSTS . " WHERE poster_id IN($user_csv)", 'topic_id');
@@ -599,7 +600,7 @@ class Common
if ($del_user_posts) {
$where_sql = "poster_id IN($user_csv)";
- $exclude_posts_ary = array();
+ $exclude_posts_ary = [];
foreach (DB()->fetch_rowset("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_poster IN($user_csv)") as $row) {
$exclude_posts_ary[] = $row['topic_first_post_id'];
}
@@ -658,16 +659,10 @@ class Common
// Log action
if ($del_user_posts) {
- $log_action->admin('mod_post_delete', array(
- 'log_msg' => 'user: ' . self::get_usernames_for_log($user_id) . "
posts: $deleted_posts_count",
- ));
+ $log_action->admin('mod_post_delete', ['log_msg' => 'user: ' . self::get_usernames_for_log($user_id) . "
posts: $deleted_posts_count"]);
} elseif (!\defined('IN_CRON')) {
foreach ($log_topics as $row) {
- $log_action->mod('mod_post_delete', array(
- 'forum_id' => $row['forum_id'],
- 'topic_id' => $row['topic_id'],
- 'topic_title' => $row['topic_title'],
- ));
+ $log_action->mod('mod_post_delete', ['forum_id' => $row['forum_id'], 'topic_id' => $row['topic_id'], 'topic_title' => $row['topic_title']]);
}
}
@@ -710,9 +705,7 @@ class Common
$user_csv = get_id_csv($user_id);
// LOG
- $log_action->admin('adm_user_delete', array(
- 'log_msg' => self::get_usernames_for_log($user_id),
- ));
+ $log_action->admin('adm_user_delete', ['log_msg' => self::get_usernames_for_log($user_id)]);
// Avatar
$result = DB()->query("SELECT user_id, avatar_ext_id FROM " . BB_USERS . " WHERE avatar_ext_id > 0 AND user_id IN($user_csv)");
@@ -795,7 +788,7 @@ class Common
*/
private static function get_usernames_for_log($user_id)
{
- $users_log_msg = array();
+ $users_log_msg = [];
if ($user_csv = get_id_csv($user_id)) {
$sql = "SELECT user_id, username FROM " . BB_USERS . " WHERE user_id IN($user_csv)";
diff --git a/src/Legacy/Admin/Torrent.php b/src/Legacy/Admin/Torrent.php
index c6f8e6339..3e82fd51c 100644
--- a/src/Legacy/Admin/Torrent.php
+++ b/src/Legacy/Admin/Torrent.php
@@ -36,7 +36,7 @@ class Torrent
if (isset($_POST[$field_name])) {
// Get new status
- $in_sql = array();
+ $in_sql = [];
foreach ($_POST[$field_name] as $i => $val) {
$in_sql[] = (int)$val;
@@ -66,7 +66,7 @@ class Torrent
global $template;
foreach ($default_cfg as $config_name => $config_value) {
- $template->assign_vars(array(strtoupper($config_name) => htmlspecialchars($cfg[$config_name])));
+ $template->assign_vars([strtoupper($config_name) => htmlspecialchars($cfg[$config_name])]);
}
}
@@ -82,15 +82,15 @@ class Torrent
foreach ($default_cfg as $config_name => $config_value) {
// YES/NO 'checked="checked"'
- $template->assign_vars(array(
+ $template->assign_vars([
strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? HTML_CHECKED : '',
strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? HTML_CHECKED : '',
- ));
+ ]);
// YES/NO lang vars
- $template->assign_vars(array(
+ $template->assign_vars([
'L_' . strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? "$lang[YES]" : $lang['YES'],
'L_' . strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? "$lang[NO]" : $lang['NO'],
- ));
+ ]);
}
}
@@ -104,11 +104,11 @@ class Torrent
global $template, $lang;
foreach ($default_cfg as $config_name => $config_value) {
- $template->assign_vars(array(
+ $template->assign_vars([
'L_' . strtoupper($config_name) => $lang[$config_name] ?? '',
'L_' . strtoupper($config_name) . '_EXPL' => $lang[$config_name . '_expl'] ?? '',
'L_' . strtoupper($config_name) . '_HEAD' => $lang[$config_name . '_head'] ?? '',
- ));
+ ]);
}
}
@@ -134,7 +134,7 @@ class Torrent
return;
}
- bb_update_config(array($config_name => $config_value), $table_name);
+ bb_update_config([$config_name => $config_value], $table_name);
}
}
}
diff --git a/src/Legacy/Atom.php b/src/Legacy/Atom.php
index 2e6357769..22b13fee2 100644
--- a/src/Legacy/Atom.php
+++ b/src/Legacy/Atom.php
@@ -26,6 +26,7 @@ class Atom
public static function update_forum_feed($forum_id, $forum_data)
{
global $bb_cfg, $lang;
+ $sql = null;
$file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom';
$select_tor_sql = $join_tor_sql = '';
if ($forum_id == 0) {
@@ -70,7 +71,7 @@ class Atom
";
}
$topics_tmp = DB()->fetch_rowset($sql);
- $topics = array();
+ $topics = [];
foreach ($topics_tmp as $topic) {
if (isset($topic['topic_status'])) {
if ($topic['topic_status'] == TOPIC_MOVED) {
@@ -124,7 +125,7 @@ class Atom
LIMIT 50
";
$topics_tmp = DB()->fetch_rowset($sql);
- $topics = array();
+ $topics = [];
foreach ($topics_tmp as $topic) {
if (isset($topic['topic_status'])) {
if ($topic['topic_status'] == TOPIC_MOVED) {
@@ -163,6 +164,8 @@ class Atom
private static function create_atom($file_path, $mode, $id, $title, $topics)
{
global $lang;
+ $date = null;
+ $time = null;
$dir = \dirname($file_path);
if (!file_exists($dir)) {
if (!bb_mkdir($dir)) {
@@ -192,8 +195,8 @@ class Atom
$tor_size = str_replace(' ', ' ', ' [' . humn_size($topic['tor_size']) . ']');
}
$topic_title = $topic['topic_title'];
- $orig_word = array();
- $replacement_word = array();
+ $orig_word = [];
+ $replacement_word = [];
obtain_word_list($orig_word, $replacement_word);
if (\count($orig_word)) {
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
diff --git a/src/Legacy/Attach.php b/src/Legacy/Attach.php
index 4a9556d32..c4e93fbf4 100644
--- a/src/Legacy/Attach.php
+++ b/src/Legacy/Attach.php
@@ -247,7 +247,7 @@ class Attach
}
}
- $this->num_attachments = \count($this->attachment_list);
+ $this->num_attachments = is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0;
if ($submit) {
if ($mode === 'newtopic' || $mode === 'reply' || $mode === 'editpost') {
@@ -315,7 +315,7 @@ class Attach
// restore values :)
if (isset($_POST['attachment_list'])) {
- for ($i = 0, $iMax = \count($actual_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($actual_list) || $actual_list instanceof \Countable ? \count($actual_list) : 0; $i < $iMax; $i++) {
$restore = false;
$del_thumb = false;
@@ -383,7 +383,7 @@ class Attach
$this->attachment_comment_list = [];
- for ($i = 0, $iMax = \count($this->attachment_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0; $i < $iMax; $i++) {
$this->attachment_comment_list[$i] = $actual_comment_list[$i];
}
}
@@ -405,7 +405,7 @@ class Attach
$attachment_id = 0;
$actual_element = 0;
- for ($i = 0, $iMax = \count($actual_id_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($actual_id_list) || $actual_id_list instanceof \Countable ? \count($actual_id_list) : 0; $i < $iMax; $i++) {
if (isset($_POST['update_attachment'][$actual_id_list[$i]])) {
$attachment_id = (int)$actual_id_list[$i];
$actual_element = $i;
@@ -532,7 +532,7 @@ class Attach
}
if ($mode === 'attach_list') {
- for ($i = 0, $iMax = \count($this->attachment_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0; $i < $iMax; $i++) {
if ($this->attachment_id_list[$i]) {
//bt
if ($this->attachment_extension_list[$i] === TORRENT_EXT && !\defined('TORRENT_ATTACH_ID')) {
@@ -659,7 +659,7 @@ class Attach
if ($this->attachment_list) {
$hidden = '';
- for ($i = 0, $iMax = \count($this->attachment_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0; $i < $iMax; $i++) {
$hidden .= '';
$hidden .= '';
$hidden .= '';
@@ -691,7 +691,7 @@ class Attach
'TPL_POSTED_ATTACHMENTS' => true,
]);
- for ($i = 0, $iMax = \count($this->attachment_list); $i < $iMax; $i++) {
+ for ($i = 0, $iMax = is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0; $i < $iMax; $i++) {
if (@$this->attachment_id_list[$i] == 0) {
$download_link = $upload_dir . '/' . basename($this->attachment_list[$i]);
} else {
diff --git a/src/Legacy/AttachPosting.php b/src/Legacy/AttachPosting.php
index d2b360b09..762609ae3 100644
--- a/src/Legacy/AttachPosting.php
+++ b/src/Legacy/AttachPosting.php
@@ -38,7 +38,7 @@ class AttachPosting extends Attach
$this->do_insert_attachment('attach_list', 'post', $post_id);
$this->do_insert_attachment('last_attachment', 'post', $post_id);
- if ((\count($this->attachment_list) > 0 || $this->post_attach) && !isset($_POST['update_attachment'])) {
+ if (((is_array($this->attachment_list) || $this->attachment_list instanceof \Countable ? \count($this->attachment_list) : 0) > 0 || $this->post_attach) && !isset($_POST['update_attachment'])) {
$sql = 'UPDATE ' . BB_POSTS . ' SET post_attachment = 1 WHERE post_id = ' . (int)$post_id;
if (!DB()->sql_query($sql)) {
diff --git a/src/Legacy/Cache/Common.php b/src/Legacy/Cache/Common.php
index f769396a4..b34124c68 100644
--- a/src/Legacy/Cache/Common.php
+++ b/src/Legacy/Cache/Common.php
@@ -25,7 +25,7 @@ class Common
if ($get_miss_key_callback) {
return $get_miss_key_callback($name);
}
- return \is_array($name) ? array() : false;
+ return \is_array($name) ? [] : false;
}
/**
@@ -50,7 +50,7 @@ class Common
public $sql_timetotal = 0;
public $cur_query_time = 0;
- public $dbg = array();
+ public $dbg = [];
public $dbg_id = 0;
public $dbg_enabled = false;
public $cur_query;
diff --git a/src/Legacy/Cache/File.php b/src/Legacy/Cache/File.php
index 5030e8519..08458fe61 100644
--- a/src/Legacy/Cache/File.php
+++ b/src/Legacy/Cache/File.php
@@ -29,6 +29,7 @@ class File extends Common
public function get($name, $get_miss_key_callback = '', $ttl = 0)
{
+ $filecache = [];
$filename = $this->dir . clean_filename($this->prefix . $name) . '.php';
$this->cur_query = "cache->get('$name')";
@@ -55,10 +56,7 @@ class File extends Common
$filename = $this->dir . clean_filename($this->prefix . $name) . '.php';
$expire = TIMENOW + $ttl;
- $cache_data = array(
- 'expire' => $expire,
- 'value' => $value,
- );
+ $cache_data = ['expire' => $expire, 'value' => $value];
$filecache = "dir)) {
diff --git a/src/Legacy/Cache/Sqlite.php b/src/Legacy/Cache/Sqlite.php
index f58df8bc5..b099acc14 100644
--- a/src/Legacy/Cache/Sqlite.php
+++ b/src/Legacy/Cache/Sqlite.php
@@ -20,7 +20,7 @@ class Sqlite extends Common
public $used = true;
public $db;
public $prefix;
- public $cfg = array(
+ public $cfg = [
'db_file_path' => '/path/to/cache.db.sqlite',
'table_name' => 'cache',
'table_schema' => 'CREATE TABLE cache (
@@ -32,7 +32,7 @@ class Sqlite extends Common
'pconnect' => true,
'con_required' => true,
'log_name' => 'CACHE',
- );
+ ];
public function __construct($cfg, $prefix = null)
{
@@ -44,10 +44,10 @@ class Sqlite extends Common
public function get($name, $get_miss_key_callback = '', $ttl = 604800)
{
if (empty($name)) {
- return \is_array($name) ? array() : false;
+ return \is_array($name) ? [] : false;
}
$this->db->shard($name);
- $cached_items = array();
+ $cached_items = [];
$this->prefix_len = \strlen($this->prefix);
$this->prefix_sql = SQLite3::escapeString($this->prefix);
diff --git a/src/Legacy/Cache/SqliteCommon.php b/src/Legacy/Cache/SqliteCommon.php
index 3ef4637bf..4e4e8140e 100644
--- a/src/Legacy/Cache/SqliteCommon.php
+++ b/src/Legacy/Cache/SqliteCommon.php
@@ -17,16 +17,16 @@ use SQLite3;
*/
class SqliteCommon extends Common
{
- public $cfg = array(
+ public $cfg = [
'db_file_path' => 'sqlite.db',
'table_name' => 'table_name',
'table_schema' => 'CREATE TABLE table_name (...)',
'pconnect' => true,
'con_required' => true,
'log_name' => 'SQLite',
- 'shard_type' => 'none', # none, string, int (тип перевичного ключа для шардинга)
- 'shard_val' => 0, # для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
- );
+ 'shard_type' => 'none', # none, string, int (тип перевичного ключа для шардинга)
+ 'shard_val' => 0, # для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
+ ];
public $engine = 'SQLite';
public $dbh;
public $connected = false;
@@ -134,7 +134,7 @@ class SqliteCommon extends Common
public function fetch_rowset($query)
{
$result = $this->query($query);
- $rowset = array();
+ $rowset = [];
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$rowset[] = $row;
}
diff --git a/src/Legacy/Datastore/File.php b/src/Legacy/Datastore/File.php
index 41814a699..92d2177d1 100644
--- a/src/Legacy/Datastore/File.php
+++ b/src/Legacy/Datastore/File.php
@@ -67,6 +67,7 @@ class File extends Common
public function _fetch_from_store()
{
+ $item = null;
if (!$items = $this->queued_items) {
$src = $this->_debug_find_caller('enqueue');
trigger_error("Datastore: item '$item' already enqueued [$src]", E_USER_ERROR);
diff --git a/src/Legacy/Datastore/Memcache.php b/src/Legacy/Datastore/Memcache.php
index 5a392d931..ad19c8c02 100644
--- a/src/Legacy/Datastore/Memcache.php
+++ b/src/Legacy/Datastore/Memcache.php
@@ -86,6 +86,7 @@ class Memcache extends Common
public function _fetch_from_store()
{
+ $item = null;
if (!$items = $this->queued_items) {
$src = $this->_debug_find_caller('enqueue');
trigger_error("Datastore: item '$item' already enqueued [$src]", E_USER_ERROR);
diff --git a/src/Legacy/Datastore/Redis.php b/src/Legacy/Datastore/Redis.php
index 69c2083f6..230cd1f43 100644
--- a/src/Legacy/Datastore/Redis.php
+++ b/src/Legacy/Datastore/Redis.php
@@ -84,6 +84,7 @@ class Redis extends Common
public function _fetch_from_store()
{
+ $item = null;
if (!$items = $this->queued_items) {
$src = $this->_debug_find_caller('enqueue');
trigger_error("Datastore: item '$item' already enqueued [$src]", E_USER_ERROR);
diff --git a/src/Legacy/Datastore/Sqlite.php b/src/Legacy/Datastore/Sqlite.php
index 9eabcc5c6..177b71cef 100644
--- a/src/Legacy/Datastore/Sqlite.php
+++ b/src/Legacy/Datastore/Sqlite.php
@@ -20,7 +20,7 @@ class Sqlite extends Common
public $engine = 'SQLite';
public $db;
public $prefix;
- public $cfg = array(
+ public $cfg = [
'db_file_path' => '/path/to/datastore.db.sqlite',
'table_name' => 'datastore',
'table_schema' => 'CREATE TABLE datastore (
@@ -31,7 +31,7 @@ class Sqlite extends Common
'pconnect' => true,
'con_required' => true,
'log_name' => 'DATASTORE',
- );
+ ];
public function __construct($cfg, $prefix = null)
{
diff --git a/src/Legacy/Datastore/SqliteCommon.php b/src/Legacy/Datastore/SqliteCommon.php
index 84f119ab1..fd4433540 100644
--- a/src/Legacy/Datastore/SqliteCommon.php
+++ b/src/Legacy/Datastore/SqliteCommon.php
@@ -17,16 +17,16 @@ use SQLite3;
*/
class SqliteCommon extends Common
{
- public $cfg = array(
+ public $cfg = [
'db_file_path' => 'sqlite.db',
'table_name' => 'table_name',
'table_schema' => 'CREATE TABLE table_name (...)',
'pconnect' => true,
'con_required' => true,
'log_name' => 'SQLite',
- 'shard_type' => 'none', # none, string, int (тип перевичного ключа для шардинга)
- 'shard_val' => 0, # для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
- );
+ 'shard_type' => 'none', # none, string, int (тип перевичного ключа для шардинга)
+ 'shard_val' => 0, # для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
+ ];
public $engine = 'SQLite';
public $dbh;
public $connected = false;
@@ -134,7 +134,7 @@ class SqliteCommon extends Common
public function fetch_rowset($query)
{
$result = $this->query($query);
- $rowset = array();
+ $rowset = [];
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$rowset[] = $row;
}
diff --git a/src/Legacy/DateDelta.php b/src/Legacy/DateDelta.php
index 1eaa242c3..848e41ac4 100644
--- a/src/Legacy/DateDelta.php
+++ b/src/Legacy/DateDelta.php
@@ -97,6 +97,7 @@ class DateDelta
*/
public function getDelta($first, $last)
{
+ $delta = [];
if ($last < $first) {
return false;
}
diff --git a/src/Legacy/Dev.php b/src/Legacy/Dev.php
index cce7558bb..8addc53dd 100644
--- a/src/Legacy/Dev.php
+++ b/src/Legacy/Dev.php
@@ -60,7 +60,7 @@ class Dev
$log = '';
foreach ($db_obj->dbg as $i => $dbg) {
- $id = "sql_{$i}_" . mt_rand();
+ $id = "sql_{$i}_" . random_int(0, mt_getrandmax());
$sql = short_query($dbg['sql'], true);
$time = sprintf('%.4f', $dbg['time']);
$perc = @sprintf('[%2d]', $dbg['time'] * 100 / $db_obj->sql_timetotal);
diff --git a/src/Legacy/Group.php b/src/Legacy/Group.php
index b7276ba6b..471002ae0 100644
--- a/src/Legacy/Group.php
+++ b/src/Legacy/Group.php
@@ -109,12 +109,12 @@ class Group
*/
public static function add_user_into_group($group_id, $user_id, $user_pending = 0, $user_time = TIMENOW)
{
- $args = DB()->build_array('INSERT', array(
+ $args = DB()->build_array('INSERT', [
'group_id' => (int)$group_id,
'user_id' => (int)$user_id,
'user_pending' => (int)$user_pending,
'user_time' => (int)$user_time,
- ));
+ ]);
DB()->query("REPLACE INTO " . BB_USER_GROUP . $args);
if (!$user_pending) {
@@ -223,14 +223,14 @@ class Group
return;
}
- $values = array();
+ $values = [];
foreach ($auth_ary as $forum_id => $permission) {
- $values[] = array(
+ $values[] = [
'group_id' => (int)$group_id,
'forum_id' => (int)$forum_id,
'forum_perm' => (int)$permission,
- );
+ ];
}
$values = DB()->build_array('MULTI_INSERT', $values);
diff --git a/src/Legacy/Post.php b/src/Legacy/Post.php
index 4d2444de8..ca6db5ef4 100644
--- a/src/Legacy/Post.php
+++ b/src/Legacy/Post.php
@@ -194,10 +194,7 @@ class Post
add_search_words($post_id, stripslashes($s_post_message), stripslashes($s_post_subject));
}
- update_post_html(array(
- 'post_id' => $post_id,
- 'post_text' => $post_message,
- ));
+ update_post_html(['post_id' => $post_id, 'post_text' => $post_message]);
//Обновление кеша новостей на главной
if ($bb_cfg['show_latest_news']) {
@@ -345,7 +342,7 @@ class Post
if ($mode != 'delete') {
if ($mode == 'reply') {
- $update_watched_sql = $user_id_sql = array();
+ $update_watched_sql = $user_id_sql = [];
$sql = DB()->fetch_rowset("SELECT ban_userid FROM " . BB_BANLIST . " WHERE ban_userid != 0");
@@ -365,7 +362,7 @@ class Post
");
if ($watch_list) {
- $orig_word = $replacement_word = array();
+ $orig_word = $replacement_word = [];
obtain_word_list($orig_word, $replacement_word);
if (\count($orig_word)) {
@@ -384,13 +381,13 @@ class Post
$emailer->set_subject(sprintf($lang['EMAILER_SUBJECT']['TOPIC_NOTIFY'], $topic_title));
$emailer->set_template('topic_notify', $row['user_lang']);
- $emailer->assign_vars(array(
+ $emailer->assign_vars([
'TOPIC_TITLE' => html_entity_decode($topic_title),
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $row['username'],
'U_TOPIC' => $u_topic,
'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
- ));
+ ]);
$emailer->send();
@@ -455,7 +452,7 @@ class Post
FROM " . BB_FORUMS . "
WHERE forum_id IN($forum_id, $old_forum_id)";
- $forum_names = array();
+ $forum_names = [];
foreach (DB()->fetch_rowset($sql) as $row) {
$forum_names[$row['forum_id']] = htmlCHR($row['forum_name']);
}
@@ -531,17 +528,17 @@ class Post
// Topic posts block
foreach ($review_posts as $i => $post) {
- $template->assign_block_vars('review', array(
+ $template->assign_block_vars('review', [
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($post),
'POSTER_NAME_JS' => addslashes($post['username']),
'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
'MESSAGE' => get_parsed_post($post),
- ));
+ ]);
}
- $template->assign_vars(array(
+ $template->assign_vars([
'TPL_TOPIC_REVIEW' => (bool)$review_posts,
- ));
+ ]);
}
}
diff --git a/src/Legacy/Sessions.php b/src/Legacy/Sessions.php
index 54c455f16..9660bf27e 100644
--- a/src/Legacy/Sessions.php
+++ b/src/Legacy/Sessions.php
@@ -158,7 +158,7 @@ class Sessions
{
global $user;
- $user->session_start(array('req_login' => $req_login));
+ $user->session_start(['req_login' => $req_login]);
return $user->data;
}
diff --git a/src/Legacy/SqlDb.php b/src/Legacy/SqlDb.php
index 3275105ef..066018afd 100644
--- a/src/Legacy/SqlDb.php
+++ b/src/Legacy/SqlDb.php
@@ -206,6 +206,7 @@ class SqlDb
*/
public function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
+ $result = null;
if (!$query_id) {
$query_id = $this->query_result;
}
@@ -734,7 +735,7 @@ class SqlDb
if ($this->link and $ext = mysqli_info($this->link)) {
$info[] = (string)$ext;
- } elseif (!$num && ($aff = $this->affected_rows($this->result) and $aff != -1)) {
+ } elseif (!$num && ($aff = $this->affected_rows() and $aff != -1)) {
$info[] = "$aff rows";
}
diff --git a/src/Legacy/Template.php b/src/Legacy/Template.php
index 5fff79cad..cc6f7d876 100644
--- a/src/Legacy/Template.php
+++ b/src/Legacy/Template.php
@@ -313,7 +313,7 @@ class Template
$str = &$this->_tpldata;
for ($i = 0; $i < $blockcount; $i++) {
$str = &$str[$blocks[$i] . '.'];
- $str = &$str[\count($str) - 1];
+ $str = &$str[(is_array($str) || $str instanceof \Countable ? \count($str) : 0) - 1];
}
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
@@ -446,6 +446,7 @@ class Template
public function compile_code($filename, $code)
{
+ $pos3 = null;
// $filename - file to load code from. used if $code is empty
// $code - tpl code
@@ -455,8 +456,8 @@ class Template
}
// Replace tags
- $search = array('', '');
- $replace = array('<' . '?php ', ' ?' . '>');
+ $search = ['', ''];
+ $replace = ['<' . '?php ', ' ?' . '>'];
$code = str_replace($search, $replace, $code);
// Break it up into lines and put " -->" back.
@@ -467,19 +468,19 @@ class Template
}
$block_nesting_level = 0;
- $block_names = array();
+ $block_names = [];
$block_names[0] = '.';
- $block_items = array();
+ $block_items = [];
$count_if = 0;
// prepare array for compiled code
- $compiled = array();
+ $compiled = [];
// array of switches
- $sw = array();
+ $sw = [];
// replace all short php tags
- $new_code = array();
+ $new_code = [];
$line_count = \count($code_lines);
for ($i = 0; $i < $line_count; $i++) {
$line = $code_lines[$i];
@@ -742,11 +743,11 @@ class Template
}
// change template varrefs into PHP varrefs
// This one will handle varrefs WITH namespaces
- $varrefs = array();
+ $varrefs = [];
preg_match_all('#\{(([a-z0-9\-_]+?\.)+)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
- $varcount = \count($varrefs[1]);
- $search = array();
- $replace = array();
+ $varcount = is_array($varrefs[1]) || $varrefs[1] instanceof \Countable ? \count($varrefs[1]) : 0;
+ $search = [];
+ $replace = [];
for ($i = 0; $i < $varcount; $i++) {
$namespace = $varrefs[1][$i];
$varname = $varrefs[3][$i];
@@ -782,8 +783,8 @@ class Template
[^\s(),]+)/x', $tag_args, $match);
$tokens = $match[0];
- $tokens_cnt = \count($tokens);
- $is_arg_stack = array();
+ $tokens_cnt = is_array($tokens) || $tokens instanceof \Countable ? \count($tokens) : 0;
+ $is_arg_stack = [];
for ($i = 0; $i < $tokens_cnt; $i++) {
$token = &$tokens[$i];
@@ -842,7 +843,7 @@ class Template
$new_tokens = $this->_parse_is_expr($is_arg, \array_slice($tokens, $i + 1));
- array_splice($tokens, $is_arg_start, \count($tokens), $new_tokens);
+ array_splice($tokens, $is_arg_start, is_array($tokens) || $tokens instanceof \Countable ? \count($tokens) : 0, $new_tokens);
$i = $is_arg_start;
break;
@@ -892,6 +893,7 @@ class Template
*/
public function _parse_is_expr($is_arg, $tokens)
{
+ $expr = null;
$expr_end = 0;
$negate_expr = false;
diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php
index cf61b345a..f6e47c77b 100644
--- a/src/Legacy/Torrent.php
+++ b/src/Legacy/Torrent.php
@@ -144,7 +144,7 @@ class Torrent
if ($row = DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE attach_id = $attach_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
- self::ocelot_update_tracker('delete_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id));
+ self::ocelot_update_tracker('delete_torrent', ['info_hash' => rawurlencode($info_hash), 'id' => $topic_id]);
}
// Delete torrent
@@ -257,7 +257,7 @@ class Torrent
if ($row = DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE topic_id = $topic_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
- self::ocelot_update_tracker('update_torrent', array('info_hash' => rawurlencode($info_hash), 'freetorrent' => $tor_status_gold));
+ self::ocelot_update_tracker('update_torrent', ['info_hash' => rawurlencode($info_hash), 'freetorrent' => $tor_status_gold]);
}
}
@@ -275,6 +275,7 @@ class Torrent
{
global $bb_cfg, $lang, $reg_mode;
+ $announce_urls = [];
$attach_id = (int)$attach_id;
$reg_mode = $mode;
@@ -338,7 +339,7 @@ class Torrent
}
}
- $info = (@$tor['info']) ? $tor['info'] : array();
+ $info = (@$tor['info']) ? $tor['info'] : [];
if (!isset($info['name'], $info['piece length'], $info['pieces']) || \strlen($info['pieces']) % 20 != 0) {
return self::torrent_error_exit($lang['TORFILE_INVALID']);
@@ -350,7 +351,7 @@ class Torrent
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
- self::ocelot_update_tracker('add_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0));
+ self::ocelot_update_tracker('add_torrent', ['info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0]);
}
if ($row = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE info_hash = '$info_hash_sql' LIMIT 1")) {
@@ -468,7 +469,7 @@ class Torrent
$passkey_val = $bt_userdata['auth_key'];
if ($bb_cfg['ocelot']['enabled']) {
- self::ocelot_update_tracker('add_user', array('id' => $user_id, 'passkey' => $passkey_val));
+ self::ocelot_update_tracker('add_user', ['id' => $user_id, 'passkey' => $passkey_val]);
}
}
@@ -510,19 +511,16 @@ class Torrent
if ($bb_cfg['bt_del_addit_ann_urls'] || $bb_cfg['bt_disable_dht']) {
unset($tor['announce-list']);
} elseif (isset($tor['announce-list'])) {
- $tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
+ $tor['announce-list'] = array_merge($tor['announce-list'], [[$announce]]);
}
// Add retracker
if (isset($bb_cfg['tracker']['retracker']) && $bb_cfg['tracker']['retracker']) {
if (bf($userdata['user_opt'], 'user_opt', 'user_retracker') || IS_GUEST) {
if (!isset($tor['announce-list'])) {
- $tor['announce-list'] = array(
- array($announce),
- array($bb_cfg['tracker']['retracker_host'])
- );
+ $tor['announce-list'] = [[$announce], [$bb_cfg['tracker']['retracker_host']]];
} else {
- $tor['announce-list'] = array_merge($tor['announce-list'], array(array($bb_cfg['tracker']['retracker_host'])));
+ $tor['announce-list'] = array_merge($tor['announce-list'], [[$bb_cfg['tracker']['retracker_host']]]);
}
}
}
@@ -604,7 +602,7 @@ class Torrent
if (DB()->affected_rows() == 1) {
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
- self::ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val));
+ self::ocelot_update_tracker('change_passkey', ['oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val]);
}
return $passkey_val;
}
diff --git a/src/Legacy/TorrentFileList.php b/src/Legacy/TorrentFileList.php
index 2a5ca5614..20a3581f1 100644
--- a/src/Legacy/TorrentFileList.php
+++ b/src/Legacy/TorrentFileList.php
@@ -86,7 +86,7 @@ class TorrentFileList
$subdir = $f['path'][$i];
if (!isset($cur_files_ary[$subdir])) {
- $cur_files_ary[$subdir] = array();
+ $cur_files_ary[$subdir] = [];
}
$cur_files_ary =& $cur_files_ary[$subdir];
diff --git a/src/Legacy/Validate.php b/src/Legacy/Validate.php
index 083b76608..bb0430191 100644
--- a/src/Legacy/Validate.php
+++ b/src/Legacy/Validate.php
@@ -69,7 +69,7 @@ class Validate
}
}
// Запрещено
- $banned_names = array();
+ $banned_names = [];
foreach (DB()->fetch_rowset("SELECT disallow_username FROM " . BB_DISALLOW . " ORDER BY NULL") as $row) {
$banned_names[] = str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#u'));
@@ -119,7 +119,7 @@ class Validate
}
if ($check_ban_and_taken) {
- $banned_emails = array();
+ $banned_emails = [];
foreach (DB()->fetch_rowset("SELECT ban_email FROM " . BB_BANLIST . " ORDER BY NULL") as $row) {
$banned_emails[] = str_replace('\*', '.*?', preg_quote($row['ban_email'], '#'));