1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/14972] replace all occurrences of sizeof() with the count()

PHPBB3-14972
This commit is contained in:
rxu
2017-06-28 00:58:03 +07:00
committed by Marc Alexander
parent ff18802656
commit f8fbe37936
165 changed files with 983 additions and 983 deletions

View File

@@ -87,7 +87,7 @@ class resync
*/
public function resync($type, $ids)
{
if (empty($type) || !is_array($ids) || !sizeof($ids) || !in_array($type, array('post', 'topic', 'message')))
if (empty($type) || !is_array($ids) || !count($ids) || !in_array($type, array('post', 'topic', 'message')))
{
return;
}
@@ -112,7 +112,7 @@ class resync
// Now only unset those ids remaining
$ids = array_diff($ids, $remaining_ids);
if (sizeof($ids))
if (count($ids))
{
$sql = 'UPDATE ' . $this->resync_table . '
SET ' . $type . '_attachment = 0

View File

@@ -162,7 +162,7 @@ class upload
// Make sure the image category only holds valid images...
$this->check_image($is_image);
if (sizeof($this->file->error))
if (count($this->file->error))
{
$this->file->remove();
$this->file_data['error'] = array_merge($this->file_data['error'], $this->file->error);

View File

@@ -72,8 +72,8 @@ class auth
// Verify bitstring length with options provided...
$renew = false;
$global_length = sizeof($this->acl_options['global']);
$local_length = sizeof($this->acl_options['local']);
$global_length = count($this->acl_options['global']);
$local_length = count($this->acl_options['local']);
// Specify comparing length (bitstring is padded to 31 bits)
$global_length = ($global_length % 31) ? ($global_length - ($global_length % 31) + 31) : $global_length;
@@ -236,7 +236,7 @@ class auth
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE;
if (sizeof($this->acl))
if (count($this->acl))
{
$sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($this->acl), true);
}
@@ -278,7 +278,7 @@ class auth
}
// If we get forum_ids not having this permission, we need to fill the remaining parts
if ($negate && sizeof($this->acl_forum_ids))
if ($negate && count($this->acl_forum_ids))
{
foreach ($this->acl_forum_ids as $f)
{
@@ -455,7 +455,7 @@ class auth
{
$hold_str = '';
if (sizeof($hold_ary))
if (count($hold_ary))
{
ksort($hold_ary);

View File

@@ -99,7 +99,7 @@ class ldap extends \phpbb\auth\provider\base
@ldap_close($ldap);
if (!is_array($result) || sizeof($result) < 2)
if (!is_array($result) || count($result) < 2)
{
return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']);
}
@@ -192,7 +192,7 @@ class ldap extends \phpbb\auth\provider\base
$ldap_result = @ldap_get_entries($ldap, $search);
if (is_array($ldap_result) && sizeof($ldap_result) > 1)
if (is_array($ldap_result) && count($ldap_result) > 1)
{
if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password)))
{

View File

@@ -635,7 +635,7 @@ class oauth extends \phpbb\auth\provider\base
$oauth_user_ids = array();
if ($rows !== false && sizeof($rows))
if ($rows !== false && count($rows))
{
foreach ($rows as $row)
{

View File

@@ -64,7 +64,7 @@ class local extends \phpbb\avatar\driver\driver
$table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
$row_count = $col_count = $avatar_pos = 0;
$avatar_count = sizeof($avatar_list[$category]);
$avatar_count = count($avatar_list[$category]);
reset($avatar_list[$category]);

View File

@@ -167,7 +167,7 @@ class upload extends \phpbb\avatar\driver\driver
$file->clean_filename('avatar', $prefix, $row['id']);
// If there was an error during upload, then abort operation
if (sizeof($file->error))
if (count($file->error))
{
$file->remove();
$error = $file->error;
@@ -221,7 +221,7 @@ class upload extends \phpbb\avatar\driver\driver
unset($filedata);
if (!sizeof($error))
if (!count($error))
{
// Move file and overwrite any existing image
$file->move_file($destination, true);
@@ -229,7 +229,7 @@ class upload extends \phpbb\avatar\driver\driver
// If there was an error during move, then clean up leftovers
$error = array_merge($error, $file->error);
if (sizeof($error))
if (count($error))
{
$file->remove();
return false;
@@ -291,7 +291,7 @@ class upload extends \phpbb\avatar\driver\driver
);
extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars)));
if (!sizeof($error) && $this->filesystem->exists($filename))
if (!count($error) && $this->filesystem->exists($filename))
{
try
{

View File

@@ -123,7 +123,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface
*/
function sql_fetchrow($query_id)
{
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id]))
{
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
}
@@ -136,7 +136,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface
*/
function sql_fetchfield($query_id, $field)
{
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id]))
{
return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false;
}
@@ -149,7 +149,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface
*/
function sql_rowseek($rownum, $query_id)
{
if ($rownum >= sizeof($this->sql_rowset[$query_id]))
if ($rownum >= count($this->sql_rowset[$query_id]))
{
return false;
}

View File

@@ -135,7 +135,7 @@ class file extends \phpbb\cache\driver\base
if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
{
if (!sizeof($this->vars))
if (!count($this->vars))
{
$this->load();
}
@@ -290,7 +290,7 @@ class file extends \phpbb\cache\driver\base
}
else
{
if (!sizeof($this->vars))
if (!count($this->vars))
{
$this->load();
}

View File

@@ -188,7 +188,7 @@ abstract class memory extends \phpbb\cache\driver\base
}
else
{
if (!sizeof($this->vars))
if (!count($this->vars))
{
$this->load();
}

View File

@@ -227,7 +227,7 @@ class service
// Store allowed extensions forum wise
if ($row['allow_group'])
{
$extensions['_allowed_post'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
$extensions['_allowed_post'][$extension] = (!count($allowed_forums)) ? 0 : $allowed_forums;
}
if ($row['allow_in_pm'])

View File

@@ -220,7 +220,7 @@ class char_cube3d
*/
function scale($vector, $length)
{
if (sizeof($vector) == 2)
if (count($vector) == 2)
{
return array($vector[0] * $length, $vector[1] * $length);
}

View File

@@ -256,7 +256,7 @@ class colour_manager
if (is_array($resource))
{
$results = array();
for ($i = 0, $size = sizeof($resource); $i < $size; ++$i)
for ($i = 0, $size = count($resource); $i < $size; ++$i)
{
$results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original));
}

View File

@@ -100,7 +100,7 @@ class gd
$noise_bitmaps = $this->captcha_noise_bg_bitmaps();
for ($i = 0; $i < $code_len; ++$i)
{
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data'])));
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data'])));
$noise[$i]->range();
//$box = $noise[$i]->dimensions($sizes[$i]);
@@ -1658,32 +1658,32 @@ class gd
'height' => 15,
'data' => array(
'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)],
'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)],
'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)],
'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)],
'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)],
'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)],
'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)],
'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)],
'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)],
'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)],
'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)],
'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)],
'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)],
'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)],
'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)],
'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)],
'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)],
'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)],
'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)],
'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)],
'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)],
'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)],
'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)],
'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)],
'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)],
'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)],
'A' => $chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)],
'B' => $chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)],
'C' => $chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)],
'D' => $chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)],
'E' => $chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)],
'F' => $chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)],
'G' => $chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)],
'H' => $chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)],
'I' => $chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)],
'J' => $chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)],
'K' => $chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)],
'L' => $chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)],
'M' => $chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)],
'N' => $chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)],
'O' => $chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)],
'P' => $chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)],
'Q' => $chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)],
'R' => $chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)],
'S' => $chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)],
'T' => $chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)],
'U' => $chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)],
'V' => $chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)],
'W' => $chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)],
'X' => $chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)],
'Y' => $chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)],
'Z' => $chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)],
'1' => array(
array(0,0,0,1,1,0,0,0,0),

View File

@@ -169,7 +169,7 @@ abstract class captcha_abstract
}
while ($row = $db->sql_fetchrow($result));
if (sizeof($sql_in))
if (count($sql_in))
{
$sql = 'DELETE FROM ' . CONFIRM_TABLE . '
WHERE ' . $db->sql_in_set('session_id', $sql_in);

View File

@@ -84,7 +84,7 @@ class qa
$db->sql_freeresult($result);
// fallback to the board default lang
if (!sizeof($this->question_ids))
if (!count($this->question_ids))
{
$this->question_lang = $config['default_lang'];
@@ -101,7 +101,7 @@ class qa
}
// final fallback to any language
if (!sizeof($this->question_ids))
if (!count($this->question_ids))
{
$this->question_lang = '';
@@ -311,7 +311,7 @@ class qa
}
while ($row = $db->sql_fetchrow($result));
if (sizeof($sql_in))
if (count($sql_in))
{
$sql = 'DELETE FROM ' . $this->table_qa_confirm . '
WHERE ' . $db->sql_in_set('confirm_id', $sql_in);
@@ -395,7 +395,7 @@ class qa
$error = '';
if (!sizeof($this->question_ids))
if (!count($this->question_ids))
{
/** @var \phpbb\log\log_interface $phpbb_log */
$phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING')));
@@ -439,7 +439,7 @@ class qa
{
global $db, $user;
if (!sizeof($this->question_ids))
if (!count($this->question_ids))
{
return;
}
@@ -465,7 +465,7 @@ class qa
{
global $db, $user;
if (!sizeof($this->question_ids))
if (!count($this->question_ids))
{
return;
}
@@ -536,7 +536,7 @@ class qa
{
global $db, $user;
if (!strlen($this->confirm_id) || !sizeof($this->question_ids))
if (!strlen($this->confirm_id) || !count($this->question_ids))
{
return false;
}
@@ -979,7 +979,7 @@ class qa
if (!isset($langs[$question_data['lang_iso']]) ||
!strlen($question_data['question_text']) ||
!sizeof($question_data['answers']) ||
!count($question_data['answers']) ||
!is_array($question_data['answers']))
{
return false;

View File

@@ -107,7 +107,7 @@ class delete extends \phpbb\console\command\command
{
$thumbnail_deleted[] = $row['attach_id'];
if (sizeof($thumbnail_deleted) === 250)
if (count($thumbnail_deleted) === 250)
{
$this->commit_changes($thumbnail_deleted);
$thumbnail_deleted = array();

View File

@@ -334,7 +334,7 @@ class content_visibility
AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
// If user has moderator permissions, add everything in the moderated forums
if (sizeof($approve_forums))
if (count($approve_forums))
{
$where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
}
@@ -584,7 +584,7 @@ class content_visibility
$sql_ary[$recipient_field] = " + $count_increase";
}
if (sizeof($sql_ary))
if (count($sql_ary))
{
$forum_sql = array();

View File

@@ -267,7 +267,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
unset($row['line2'], $row['line3']);
}
}
return (sizeof($row)) ? $row : false;
return (count($row)) ? $row : false;
}
/**

View File

@@ -136,7 +136,7 @@ class oracle extends \phpbb\db\driver\driver
*/
function _rewrite_col_compare($args)
{
if (sizeof($args) == 4)
if (count($args) == 4)
{
if ($args[2] == '=')
{
@@ -290,7 +290,7 @@ class oracle extends \phpbb\db\driver\driver
and/or need the db restore script, uncomment this.
if (sizeof($cols) !== sizeof($vals))
if (count($cols) !== count($vals))
{
// Try to replace some common data we know is from our restore script or from other sources
$regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]);
@@ -332,7 +332,7 @@ class oracle extends \phpbb\db\driver\driver
if ($string)
{
// New value if cols != value
$vals[(sizeof($cols) !== sizeof($vals)) ? $i : $i - 1] .= $string;
$vals[(count($cols) !== count($vals)) ? $i : $i - 1] .= $string;
}
$vals = array(0 => $vals);

View File

@@ -132,14 +132,14 @@ class mssql_extractor extends base_extractor
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
if (!sizeof($rows))
if (!count($rows))
{
$sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n";
$sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n";
}
$rows[] = "\t\t[{$row['COLUMN_NAME']}]";
}
if (sizeof($rows))
if (count($rows))
{
$sql_data .= implode(",\n", $rows);
$sql_data .= "\n\t) ON [PRIMARY] \nGO\n";

View File

@@ -82,7 +82,7 @@ class oracle_extractor extends base_extractor
}
$this->db->sql_freeresult($result);
if (sizeof($primary_key))
if (count($primary_key))
{
$rows[] = " CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')';
}
@@ -103,7 +103,7 @@ class oracle_extractor extends base_extractor
}
$this->db->sql_freeresult($result);
if (sizeof($unique))
if (count($unique))
{
$rows[] = " CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')';
}

View File

@@ -133,7 +133,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
}
// Remove old entries from styles table
if (!sizeof($valid_styles))
if (!count($valid_styles))
{
// No valid styles: remove everything and add prosilver
$this->sql_query('DELETE FROM ' . STYLES_TABLE);

View File

@@ -93,13 +93,13 @@ class teampage extends \phpbb\db\migration\migration
$teampage_entries[] = array(
'group_id' => (int) $row['group_id'],
'teampage_name' => '',
'teampage_position' => sizeof($teampage_entries) + 1,
'teampage_position' => count($teampage_entries) + 1,
'teampage_parent' => 0,
);
}
$this->db->sql_freeresult($result);
if (sizeof($teampage_entries))
if (count($teampage_entries))
{
$this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries);
}

View File

@@ -134,7 +134,7 @@ class config implements \phpbb\db\migration\tool\tool_interface
case 'remove':
$call = 'add';
if (sizeof($arguments) == 1)
if (count($arguments) == 1)
{
$arguments[] = '';
}

View File

@@ -110,7 +110,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface
case 'remove':
$call = 'add';
if (sizeof($arguments) == 1)
if (count($arguments) == 1)
{
$arguments[] = '';
}

View File

@@ -515,7 +515,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
$parent_id = $parent_id ?: 0;
// If automatic adding is in action, convert array back to string to simplify things
if (is_array($data) && sizeof($data) == 1)
if (is_array($data) && count($data) == 1)
{
$data = $data['module_langname'];
}
@@ -528,7 +528,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
// Search for the parent module_langname
$ids = array_keys($this->module_categories, $parent_id);
switch (sizeof($ids))
switch (count($ids))
{
// No parent with the given module_langname exist
case 0:

View File

@@ -442,7 +442,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface
}
);
if (sizeof($auth_option))
if (count($auth_option))
{
return $this->permission_set($role_name, $auth_option, 'role', $has_permission);
}

View File

@@ -632,7 +632,7 @@ class migrator
*/
protected function process_data_step($steps, $state, $revert = false)
{
if (sizeof($steps) === 0)
if (count($steps) === 0)
{
return true;
}
@@ -659,7 +659,7 @@ class migrator
// Result will be null or true if everything completed correctly
// Stop after each update step, to let the updater control the script runtime
$result = $this->run_step($steps[$step], $last_result, $revert);
if (($result !== null && $result !== true) || $step + 1 < sizeof($steps))
if (($result !== null && $result !== true) || $step + 1 < count($steps))
{
return array(
'result' => $result,

View File

@@ -92,7 +92,7 @@ class sql_insert_buffer
// Flush buffer if it is full or when DB does not support multi inserts.
// In the later case, the buffer will always only contain one row.
if (!$this->db->get_multi_insert() || sizeof($this->buffer) >= $this->max_buffered_rows)
if (!$this->db->get_multi_insert() || count($this->buffer) >= $this->max_buffered_rows)
{
return $this->flush();
}
@@ -104,7 +104,7 @@ class sql_insert_buffer
* Inserts a row set, i.e. an array of rows, by calling insert().
*
* Please note that it is in most cases better to use insert() instead of
* first building a huge rowset. Or at least sizeof($rows) should be kept
* first building a huge rowset. Or at least count($rows) should be kept
* small.
*
* @param array $rows

View File

@@ -440,7 +440,7 @@ class mssql extends tools
{
$result = $this->sql_index_drop($table_name, $index_name);
$statements = array_merge($statements, $result);
if (sizeof($index_data) > 1)
if (count($index_data) > 1)
{
// Remove this column from the index and recreate it
$recreate_indexes[$index_name] = array_diff($index_data, array($column_name));

View File

@@ -87,7 +87,7 @@ class md_exporter
$this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name));
}
return sizeof($this->events);
return count($this->events);
}
/**
@@ -113,7 +113,7 @@ class md_exporter
}
}
return sizeof($this->events);
return count($this->events);
}
/**
@@ -219,7 +219,7 @@ class md_exporter
);
}
return sizeof($this->events);
return count($this->events);
}
/**

View File

@@ -117,7 +117,7 @@ class php_exporter
}
ksort($this->events);
return sizeof($this->events);
return count($this->events);
}
/**
@@ -199,7 +199,7 @@ class php_exporter
if (strpos($content, 'dispatcher->trigger_event(') || strpos($content, 'dispatcher->dispatch('))
{
$this->set_content(explode("\n", $content));
for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++)
for ($i = 0, $num_lines = count($this->file_lines); $i < $num_lines; $i++)
{
$event_line = false;
$found_trigger_event = strpos($this->file_lines[$i], 'dispatcher->trigger_event(');
@@ -397,7 +397,7 @@ class php_exporter
if (isset($match[2]))
{
$vars_array = explode("', '", $match[2]);
if ($throw_multiline && sizeof($vars_array) > 6)
if ($throw_multiline && count($vars_array) > 6)
{
throw new \LogicException('Should use multiple lines for $vars definition '
. "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2);
@@ -460,7 +460,7 @@ class php_exporter
if (strpos($var_line, '* @var ') === 0)
{
$doc_line = explode(' ', $var_line, 5);
if (sizeof($doc_line) !== 5)
if (count($doc_line) !== 5)
{
throw new \LogicException("Found invalid line '{$this->file_lines[$this->current_event_line - $current_doc_line]}' "
. "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1);
@@ -707,9 +707,9 @@ class php_exporter
{
$vars_array = array_unique($vars_array);
$vars_docblock = array_unique($vars_docblock);
$sizeof_vars_array = sizeof($vars_array);
$sizeof_vars_array = count($vars_array);
if ($sizeof_vars_array !== sizeof($vars_docblock) || $sizeof_vars_array !== sizeof(array_intersect($vars_array, $vars_docblock)))
if ($sizeof_vars_array !== count($vars_docblock) || $sizeof_vars_array !== count(array_intersect($vars_array, $vars_docblock)))
{
throw new \LogicException("\$vars array does not match the list of '@var' tags for event "
. "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'");

View File

@@ -121,7 +121,7 @@ class filespec
*/
public function set_upload_ary($upload_ary)
{
if (!isset($upload_ary) || !sizeof($upload_ary))
if (!isset($upload_ary) || !count($upload_ary))
{
return $this;
}
@@ -403,7 +403,7 @@ class filespec
*/
public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)
{
if (sizeof($this->error))
if (count($this->error))
{
return false;
}
@@ -478,7 +478,7 @@ class filespec
// Remove temporary filename
@unlink($this->filename);
if (sizeof($this->error))
if (count($this->error))
{
return false;
}

View File

@@ -119,7 +119,7 @@ class form extends base
// PHP Upload file size check
$file = $this->check_upload_size($file);
if (sizeof($file->error))
if (count($file->error))
{
return $file;
}

View File

@@ -86,7 +86,7 @@ class local extends base
// PHP Upload file size check
$file = $this->check_upload_size($file);
if (sizeof($file->error))
if (count($file->error))
{
return $file;
}

View File

@@ -171,7 +171,7 @@ class filesystem implements filesystem_interface
continue;
}
if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..')
if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..')
{
array_pop($filtered);
}
@@ -671,7 +671,7 @@ class filesystem implements filesystem_interface
else if (function_exists('debug_backtrace'))
{
$call_stack = debug_backtrace(0);
$this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[sizeof($call_stack) - 1]['file']));
$this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file']));
}
else
{
@@ -683,7 +683,7 @@ class filesystem implements filesystem_interface
//$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__);
//$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\'));
//$namespace_part_count = sizeof($namespace_parts);
//$namespace_part_count = count($namespace_parts);
// Check if we still loading from root
//if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts)
@@ -807,7 +807,7 @@ class filesystem implements filesystem_interface
array_pop($resolved);
$resolved_path = false;
}
else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[sizeof($resolved) - 1], array('.', '..')))
else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..')))
{
array_pop($resolved);
$resolved_path = false;

View File

@@ -372,7 +372,7 @@ class database
$tables = array_map('strtolower', $tables);
$table_intersect = array_intersect($tables, $table_ary);
if (sizeof($table_intersect))
if (count($table_intersect))
{
$errors[] = array(
'title' => 'INST_ERR_PREFIX',

View File

@@ -204,7 +204,7 @@ class ajax_iohandler extends iohandler_base
if (in_array($input_options['type'], array('select', 'radio'), true))
{
for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++)
for ($i = 0, $total = count($input_options['options']); $i < $total; $i++)
{
if (isset($input_options['options'][$i]['label']))
{
@@ -381,7 +381,7 @@ class ajax_iohandler extends iohandler_base
*/
public function set_active_stage_menu($menu_path)
{
$this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1];
$this->nav_data['active'] = $menu_path[count($menu_path) - 1];
$this->send_response();
}
@@ -390,7 +390,7 @@ class ajax_iohandler extends iohandler_base
*/
public function set_finished_stage_menu($menu_path)
{
$this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1];
$this->nav_data['finished'][] = $menu_path[count($menu_path) - 1];
$this->send_response();
}

View File

@@ -239,7 +239,7 @@ class add_bots extends \phpbb\install\task_base
$this->install_config->set('add_bot_index', $i);
if ($i < sizeof($this->bot_list))
if ($i < count($this->bot_list))
{
throw new resource_limit_reached_exception();
}

View File

@@ -169,7 +169,7 @@ class add_modules extends \phpbb\install\task_base
$this->db->sql_return_on_error(true);
$module_classes = array('acp', 'mcp', 'ucp');
$total = sizeof($module_classes);
$total = count($module_classes);
$i = $this->config->get('module_class_index', 0);
$module_classes = array_slice($module_classes, $i);

View File

@@ -327,7 +327,7 @@ class add_config_settings extends \phpbb\install\task_base
}
$i = $this->install_config->get('add_config_settings_index', 0);
$total = sizeof($sql_ary);
$total = count($sql_ary);
$sql_ary = array_slice($sql_ary, $i);
foreach ($sql_ary as $sql)

View File

@@ -99,7 +99,7 @@ class add_default_data extends \phpbb\install\task_base
$sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']);
$i = $this->config->get('add_default_data_index', 0);
$total = sizeof($sql_query);
$total = count($sql_query);
$sql_query = array_slice($sql_query, $i);
foreach ($sql_query as $sql)

View File

@@ -101,7 +101,7 @@ class add_tables extends \phpbb\install\task_base
$db_table_schema = @file_get_contents($this->schema_file_path);
$db_table_schema = json_decode($db_table_schema, true);
$total = sizeof($db_table_schema);
$total = count($db_table_schema);
$i = $this->config->get('add_table_index', 0);
$db_table_schema = array_slice($db_table_schema, $i);

View File

@@ -157,7 +157,7 @@ class install_extensions extends \phpbb\install\task_base
$this->install_config->set('install_extensions_index', $i);
if ($i < sizeof($all_available_extensions))
if ($i < count($all_available_extensions))
{
throw new resource_limit_reached_exception();
}

View File

@@ -206,7 +206,7 @@ class update_extensions extends task_base
$this->install_config->set('update_extensions_index', $i);
if ($i < sizeof($all_available_extensions))
if ($i < count($all_available_extensions))
{
throw new resource_limit_reached_exception();
}

View File

@@ -145,7 +145,7 @@ class diff_files extends task_base
{
$file_contents[] = file_get_contents($file_to_diff);
if ($file_contents[sizeof($file_contents) - 1] === false)
if ($file_contents[count($file_contents) - 1] === false)
{
$this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff));
unset($file_contents);

View File

@@ -312,7 +312,7 @@ class language
// Replace key with language entry and simply pass along...
return vsprintf($lang, $args);
}
else if (sizeof($lang) == 0)
else if (count($lang) == 0)
{
// If the language entry is an empty array, we just return the language key
return $key;
@@ -322,7 +322,7 @@ class language
$key_found = false;
// We now get the first number passed and will select the key based upon this number
for ($i = 0, $num_args = sizeof($args); $i < $num_args; $i++)
for ($i = 0, $num_args = count($args); $i < $num_args; $i++)
{
if (is_int($args[$i]) || is_float($args[$i]))
{

View File

@@ -127,7 +127,7 @@ class language_file_loader
// the first directory from the path (that should be the language directory)
$path_diff_parts = explode('/', $path_diff);
if (sizeof($path_diff_parts) > 1)
if (count($path_diff_parts) > 1)
{
array_shift($path_diff_parts);
$component = implode('/', $path_diff_parts) . '/';

View File

@@ -391,7 +391,7 @@ class log implements \phpbb\log\log_interface
{
$sql_where .= ' AND ';
if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1]))
if (is_array($field_value) && count($field_value) == 2 && !is_array($field_value[1]))
{
$sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1];
}
@@ -689,9 +689,9 @@ class log implements \phpbb\log\log_interface
}
}
if (($num_args - sizeof($log_data_ary)) > 0)
if (($num_args - count($log_data_ary)) > 0)
{
$log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), ''));
$log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - count($log_data_ary), ''));
}
$lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary);
@@ -740,7 +740,7 @@ class log implements \phpbb\log\log_interface
$vars = array('log', 'topic_id_list', 'reportee_id_list');
extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars)));
if (sizeof($topic_id_list))
if (count($topic_id_list))
{
$topic_auth = $this->get_topic_auth($topic_id_list);
@@ -752,7 +752,7 @@ class log implements \phpbb\log\log_interface
}
}
if (sizeof($reportee_id_list))
if (count($reportee_id_list))
{
$reportee_data_list = $this->get_reportee_data($reportee_id_list);
@@ -838,7 +838,7 @@ class log implements \phpbb\log\log_interface
$keywords_pattern = array();
// Build pattern and keywords...
for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++)
for ($i = 0, $num_keywords = count($keywords); $i < $num_keywords; $i++)
{
$keywords_pattern[] = preg_quote($keywords[$i], '#');
$keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char());

View File

@@ -139,7 +139,7 @@ abstract class form
$this->errors[] = 'FORM_INVALID';
}
if (!sizeof($this->errors))
if (!count($this->errors))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_emailtime = ' . time() . '
@@ -169,7 +169,7 @@ abstract class form
add_form_key('memberlist_email');
$template->assign_vars(array(
'ERROR_MESSAGE' => (sizeof($this->errors)) ? implode('<br />', $this->errors) : '',
'ERROR_MESSAGE' => (count($this->errors)) ? implode('<br />', $this->errors) : '',
));
}
}

View File

@@ -209,7 +209,7 @@ class message
*/
public function cc_sender()
{
if (!sizeof($this->recipients))
if (!count($this->recipients))
{
trigger_error('No email recipients specified');
}
@@ -238,7 +238,7 @@ class message
*/
public function send(\messenger $messenger, $contact)
{
if (!sizeof($this->recipients))
if (!count($this->recipients))
{
return;
}
@@ -271,7 +271,7 @@ class message
'MESSAGE' => htmlspecialchars_decode($this->body))
);
if (sizeof($this->template_vars))
if (count($this->template_vars))
{
$messenger->assign_vars($this->template_vars);
}

View File

@@ -311,7 +311,7 @@ class module_manager
// we're turning a category into a module
$branch = $this->get_module_branch($module_data['module_id'], $module_data['module_class'], 'children', false);
if (sizeof($branch))
if (count($branch))
{
throw new module_not_found_exception('NO_CATEGORY_TO_MODULE');
}
@@ -353,10 +353,10 @@ class module_manager
}
$from_data = $moved_modules[0];
$diff = sizeof($moved_modules) * 2;
$diff = count($moved_modules) * 2;
$moved_ids = array();
for ($i = 0, $size = sizeof($moved_modules); $i < $size; ++$i)
for ($i = 0, $size = count($moved_modules); $i < $size; ++$i)
{
$moved_ids[] = $moved_modules[$i]['module_id'];
}
@@ -443,7 +443,7 @@ class module_manager
$branch = $this->get_module_branch($module_id, $module_class, 'children', false);
if (sizeof($branch))
if (count($branch))
{
throw new module_exception('CANNOT_REMOVE_MODULE');
}
@@ -506,7 +506,7 @@ class module_manager
}
$this->db->sql_freeresult($result);
if (!sizeof($target))
if (!count($target))
{
// The module is already on top or bottom
throw new module_not_found_exception();

View File

@@ -339,7 +339,7 @@ class manager
}
}
if (!sizeof($notify_users))
if (!count($notify_users))
{
return;
}

View File

@@ -99,7 +99,7 @@ class pm extends \phpbb\notification\type\base
'ignore_users' => array(),
), $options);
if (!sizeof($pm['recipients']))
if (!count($pm['recipients']))
{
return array();
}

View File

@@ -202,9 +202,9 @@ class post extends \phpbb\notification\type\base
'username' => $this->get_data('post_username'),
)), $responders);
$responders_cnt = sizeof($responders);
$responders_cnt = count($responders);
$responders = $this->trim_user_ary($responders);
$trimmed_responders_cnt = $responders_cnt - sizeof($responders);
$trimmed_responders_cnt = $responders_cnt - count($responders);
foreach ($responders as $responder)
{
@@ -337,7 +337,7 @@ class post extends \phpbb\notification\type\base
*/
public function trim_user_ary($users)
{
if (sizeof($users) > 4)
if (count($users) > 4)
{
array_splice($users, 3);
}
@@ -357,7 +357,7 @@ class post extends \phpbb\notification\type\base
*/
public function pre_create_insert_array($post, $notify_users)
{
if (!sizeof($notify_users) || !$this->inherit_read_status)
if (!count($notify_users) || !$this->inherit_read_status)
{
return array();
}
@@ -426,7 +426,7 @@ class post extends \phpbb\notification\type\base
// Do not add more than 25 responders,
// we trim the username list to "a, b, c and x others" anyway
// so there is no use to add all of them anyway.
if (sizeof($responders) > 25)
if (count($responders) > 25)
{
return array();
}

View File

@@ -261,7 +261,7 @@ class topic extends \phpbb\notification\type\base
*/
public function pre_create_insert_array($post, $notify_users)
{
if (!sizeof($notify_users) || !$this->inherit_read_status)
if (!count($notify_users) || !$this->inherit_read_status)
{
return array();
}

View File

@@ -230,7 +230,7 @@ class manager
*/
public function update_profile_field_data($user_id, $cp_data)
{
if (!sizeof($cp_data))
if (!count($cp_data))
{
return;
}
@@ -258,7 +258,7 @@ class manager
*/
public function generate_profile_fields_template_headlines($restrict_option = '')
{
if (!sizeof($this->profile_cache))
if (!count($this->profile_cache))
{
$this->build_cache();
}
@@ -318,12 +318,12 @@ class manager
$user_ids = array($user_ids);
}
if (!sizeof($this->profile_cache))
if (!count($this->profile_cache))
{
$this->build_cache();
}
if (!sizeof($user_ids))
if (!count($user_ids))
{
return array();
}
@@ -486,7 +486,7 @@ class manager
$sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value
FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f
WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . '
' . ((sizeof($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
' . ((count($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
AND l.field_id = f.field_id';
$result = $this->db->sql_query($sql);

View File

@@ -398,7 +398,7 @@ class type_bool extends type_base
public function display_options(&$template_vars, &$field_data)
{
// Initialize these array elements if we are creating a new field
if (!sizeof($field_data['lang_options']))
if (!count($field_data['lang_options']))
{
// No options have been defined for a boolean field.
$field_data['lang_options'][0] = '';

View File

@@ -282,7 +282,7 @@ class type_dropdown extends type_base
*/
public function validate_options_on_submit($error, $field_data)
{
if (!sizeof($field_data['lang_options']))
if (!count($field_data['lang_options']))
{
$error[] = $this->user->lang['NO_FIELD_ENTRIES'];
}
@@ -298,7 +298,7 @@ class type_dropdown extends type_base
if ($step == 2 && $key == 'field_maxlen')
{
// Get the number of options if this key is 'field_maxlen'
return sizeof(explode("\n", $this->request->variable('lang_options', '', true)));
return count(explode("\n", $this->request->variable('lang_options', '', true)));
}
return parent::get_excluded_options($key, $action, $current_value, $field_data, $step);
@@ -310,7 +310,7 @@ class type_dropdown extends type_base
public function display_options(&$template_vars, &$field_data)
{
// Initialize these array elements if we are creating a new field
if (!sizeof($field_data['lang_options']))
if (!count($field_data['lang_options']))
{
// No options have been defined for the dropdown menu
$field_data['lang_options'] = array();

View File

@@ -141,7 +141,7 @@ class report
// Handle request
try
{
if (!empty($submit) && sizeof($error) === 0)
if (!empty($submit) && count($error) === 0)
{
$this->report_handler->add_report(
(int) $id,
@@ -273,7 +273,7 @@ class report
}
$this->template->assign_vars(array(
'ERROR' => (sizeof($error) > 0) ? implode('<br />', $error) : '',
'ERROR' => (count($error) > 0) ? implode('<br />', $error) : '',
'S_REPORT_POST' => ($mode === 'pm') ? false : true,
'REPORT_TEXT' => $report_text,
'S_HIDDEN_FIELDS' => (!empty($s_hidden_fields)) ? $s_hidden_fields : null,
@@ -302,7 +302,7 @@ class report
$error[] = $visual_confirmation_response;
}
if (sizeof($error) === 0)
if (count($error) === 0)
{
$captcha->reset();
}

View File

@@ -133,7 +133,7 @@ class base
{
global $cache, $config, $db, $user;
$length = min(sizeof($id_ary), $config['search_block_size']);
$length = min(count($id_ary), $config['search_block_size']);
// nothing to cache so exit
if (!$length)
@@ -148,7 +148,7 @@ class base
if (!($store = $cache->get('_search_results_' . $search_key)))
{
// add the current keywords to the recent searches in the cache which are listed on the search page
if (!empty($keywords) || sizeof($author_ary))
if (!empty($keywords) || count($author_ary))
{
$sql = 'SELECT search_time
FROM ' . SEARCH_RESULTS_TABLE . '
@@ -201,7 +201,7 @@ class base
$store += $store_ids;
// if the cache is too big
if (sizeof($store) - 2 > 20 * $config['search_block_size'])
if (count($store) - 2 > 20 * $config['search_block_size'])
{
// remove everything in front of two blocks in front of the current start index
for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++)
@@ -243,7 +243,7 @@ class base
global $db, $cache, $config;
// clear all searches that searched for the specified words
if (sizeof($words))
if (count($words))
{
$sql_where = '';
foreach ($words as $word)
@@ -264,7 +264,7 @@ class base
}
// clear all searches that searched for the specified authors
if (is_array($authors) && sizeof($authors))
if (is_array($authors) && count($authors))
{
$sql_where = '';
foreach ($authors as $author)

View File

@@ -232,9 +232,9 @@ class fulltext_mysql extends \phpbb\search\base
$this->split_words = $matches[1];
// We limit the number of allowed keywords to minimize load on the database
if ($this->config['max_num_search_keywords'] && sizeof($this->split_words) > $this->config['max_num_search_keywords'])
if ($this->config['max_num_search_keywords'] && count($this->split_words) > $this->config['max_num_search_keywords'])
{
trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], sizeof($this->split_words)));
trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], count($this->split_words)));
}
// to allow phrase search, we need to concatenate quoted words
@@ -361,7 +361,7 @@ class fulltext_mysql extends \phpbb\search\base
// remove too short or too long words
$text = array_values($text);
for ($i = 0, $n = sizeof($text); $i < $n; $i++)
for ($i = 0, $n = count($text); $i < $n; $i++)
{
$text[$i] = trim($text[$i]);
if (utf8_strlen($text[$i]) < $this->config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len'])
@@ -563,12 +563,12 @@ class fulltext_mysql extends \phpbb\search\base
$sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
if (sizeof($author_ary) && $author_name)
if (count($author_ary) && $author_name)
{
// first one matches post of registered users, second one guests and deleted users
$sql_author = ' AND (' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
}
else if (sizeof($author_ary))
else if (count($author_ary))
{
$sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary);
}
@@ -580,7 +580,7 @@ class fulltext_mysql extends \phpbb\search\base
$sql_where_options = $sql_sort_join;
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
@@ -660,7 +660,7 @@ class fulltext_mysql extends \phpbb\search\base
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
if (!count($author_ary))
{
return 0;
}
@@ -737,7 +737,7 @@ class fulltext_mysql extends \phpbb\search\base
{
$sql_author = $this->db->sql_in_set('p.poster_id', $author_ary);
}
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
@@ -890,7 +890,7 @@ class fulltext_mysql extends \phpbb\search\base
$id_ary = array_unique($id_ary);
}
if (sizeof($id_ary))
if (count($id_ary))
{
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
$id_ary = array_slice($id_ary, 0, $per_page);
@@ -997,7 +997,7 @@ class fulltext_mysql extends \phpbb\search\base
$alter_list[] = $alter_entry;
}
if (sizeof($alter_list))
if (count($alter_list))
{
foreach ($alter_list as $alter)
{
@@ -1050,7 +1050,7 @@ class fulltext_mysql extends \phpbb\search\base
$alter[] = 'DROP INDEX post_text';
}
if (sizeof($alter))
if (count($alter))
{
$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
}

View File

@@ -285,7 +285,7 @@ class fulltext_native extends \phpbb\search\base
);
$keywords = preg_replace($match, $replace, $keywords);
$num_keywords = sizeof(explode(' ', $keywords));
$num_keywords = count(explode(' ', $keywords));
// We limit the number of allowed keywords to minimize load on the database
if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords'])
@@ -301,7 +301,7 @@ class fulltext_native extends \phpbb\search\base
$words = array();
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words);
if (sizeof($words[1]))
if (count($words[1]))
{
$keywords = '(' . implode('|', $words[1]) . ')';
}
@@ -316,7 +316,7 @@ class fulltext_native extends \phpbb\search\base
$common_ids = $words = array();
if (sizeof($exact_words))
if (count($exact_words))
{
$sql = 'SELECT word_id, word_text, word_common
FROM ' . SEARCH_WORDLIST_TABLE . '
@@ -426,10 +426,10 @@ class fulltext_native extends \phpbb\search\base
}
}
}
if (sizeof($id_words))
if (count($id_words))
{
sort($id_words);
if (sizeof($id_words) > 1)
if (count($id_words) > 1)
{
$this->{$mode . '_ids'}[] = $id_words;
}
@@ -440,7 +440,7 @@ class fulltext_native extends \phpbb\search\base
}
}
// throw an error if we shall not ignore unexistant words
else if (!$ignore_no_id && sizeof($non_common_words))
else if (!$ignore_no_id && count($non_common_words))
{
trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words)));
}
@@ -480,7 +480,7 @@ class fulltext_native extends \phpbb\search\base
}
// Return true if all words are not common words
if (sizeof($exact_words) - sizeof($this->common_words) > 0)
if (count($exact_words) - count($this->common_words) > 0)
{
return true;
}
@@ -716,7 +716,7 @@ class fulltext_native extends \phpbb\search\base
}
}
if (sizeof($this->must_not_contain_ids))
if (count($this->must_not_contain_ids))
{
$sql_array['LEFT_JOIN'][] = array(
'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num),
@@ -826,7 +826,7 @@ class fulltext_native extends \phpbb\search\base
$sql_where[] = 'p.topic_id = ' . $topic_id;
}
if (sizeof($author_ary))
if (count($author_ary))
{
if ($author_name)
{
@@ -840,7 +840,7 @@ class fulltext_native extends \phpbb\search\base
$sql_where[] = $sql_author;
}
if (sizeof($ex_fid_ary))
if (count($ex_fid_ary))
{
$sql_where[] = $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true);
}
@@ -1010,7 +1010,7 @@ class fulltext_native extends \phpbb\search\base
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
if (!count($author_ary))
{
return 0;
}
@@ -1082,7 +1082,7 @@ class fulltext_native extends \phpbb\search\base
{
$sql_author = $this->db->sql_in_set('p.poster_id', $author_ary);
}
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
@@ -1289,7 +1289,7 @@ class fulltext_native extends \phpbb\search\base
$this->db->sql_freeresult($result);
}
if (sizeof($id_ary))
if (count($id_ary))
{
$this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir);
$id_ary = array_slice($id_ary, 0, $per_page);
@@ -1443,7 +1443,7 @@ class fulltext_native extends \phpbb\search\base
// individual arrays of added and removed words for text and title. What
// we need to do now is add the new words (if they don't already exist)
// and then add (or remove) matches between the words and this post
if (sizeof($unique_add_words))
if (count($unique_add_words))
{
$sql = 'SELECT word_id, word_text
FROM ' . SEARCH_WORDLIST_TABLE . '
@@ -1459,7 +1459,7 @@ class fulltext_native extends \phpbb\search\base
$new_words = array_diff($unique_add_words, array_keys($word_ids));
$this->db->sql_transaction('begin');
if (sizeof($new_words))
if (count($new_words))
{
$sql_ary = array();
@@ -1483,7 +1483,7 @@ class fulltext_native extends \phpbb\search\base
{
$title_match = ($word_in == 'title') ? 1 : 0;
if (sizeof($word_ary))
if (count($word_ary))
{
$sql_in = array();
foreach ($word_ary as $word)
@@ -1512,7 +1512,7 @@ class fulltext_native extends \phpbb\search\base
{
$title_match = ($word_in == 'title') ? 1 : 0;
if (sizeof($word_ary))
if (count($word_ary))
{
$sql = 'INSERT INTO ' . SEARCH_WORDMATCH_TABLE . ' (post_id, word_id, title_match)
SELECT ' . (int) $post_id . ', word_id, ' . (int) $title_match . '
@@ -1543,7 +1543,7 @@ class fulltext_native extends \phpbb\search\base
*/
public function index_remove($post_ids, $author_ids, $forum_ids)
{
if (sizeof($post_ids))
if (count($post_ids))
{
$sql = 'SELECT w.word_id, w.word_text, m.title_match
FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w
@@ -1566,7 +1566,7 @@ class fulltext_native extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
if (sizeof($title_word_ids))
if (count($title_word_ids))
{
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
SET word_count = word_count - 1
@@ -1575,7 +1575,7 @@ class fulltext_native extends \phpbb\search\base
$this->db->sql_query($sql);
}
if (sizeof($message_word_ids))
if (count($message_word_ids))
{
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
SET word_count = word_count - 1
@@ -1630,7 +1630,7 @@ class fulltext_native extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
if (sizeof($sql_in))
if (count($sql_in))
{
// Flag the words
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
@@ -1650,7 +1650,7 @@ class fulltext_native extends \phpbb\search\base
unset($sql_in);
}
if (sizeof($destroy_cache_words))
if (count($destroy_cache_words))
{
// destroy cached search results containing any of the words that are now common or were removed
$this->destroy_cache(array_unique($destroy_cache_words));
@@ -1685,7 +1685,7 @@ class fulltext_native extends \phpbb\search\base
*/
public function index_created()
{
if (!sizeof($this->stats))
if (!count($this->stats))
{
$this->get_stats();
}
@@ -1698,7 +1698,7 @@ class fulltext_native extends \phpbb\search\base
*/
public function index_stats()
{
if (!sizeof($this->stats))
if (!count($this->stats))
{
$this->get_stats();
}

View File

@@ -294,7 +294,7 @@ class fulltext_postgres extends \phpbb\search\base
// remove too short or too long words
$text = array_values($text);
for ($i = 0, $n = sizeof($text); $i < $n; $i++)
for ($i = 0, $n = count($text); $i < $n; $i++)
{
$text[$i] = trim($text[$i]);
if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len'])
@@ -502,12 +502,12 @@ class fulltext_postgres extends \phpbb\search\base
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
if (sizeof($author_ary) && $author_name)
if (count($author_ary) && $author_name)
{
// first one matches post of registered users, second one guests and deleted users
$sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
}
else if (sizeof($author_ary))
else if (count($author_ary))
{
$sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary);
}
@@ -519,7 +519,7 @@ class fulltext_postgres extends \phpbb\search\base
$sql_where_options = $sql_sort_join;
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
@@ -609,7 +609,7 @@ class fulltext_postgres extends \phpbb\search\base
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
if (!count($author_ary))
{
return 0;
}
@@ -686,7 +686,7 @@ class fulltext_postgres extends \phpbb\search\base
{
$sql_author = $this->db->sql_in_set('p.poster_id', $author_ary);
}
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
@@ -861,7 +861,7 @@ class fulltext_postgres extends \phpbb\search\base
$id_ary = array_unique($id_ary);
}
if (sizeof($id_ary))
if (count($id_ary))
{
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
$id_ary = array_slice($id_ary, 0, $per_page);

View File

@@ -483,7 +483,7 @@ class fulltext_sphinx
global $user, $phpbb_log;
// No keywords? No posts.
if (!strlen($this->search_query) && !sizeof($author_ary))
if (!strlen($this->search_query) && !count($author_ary))
{
return false;
}
@@ -623,7 +623,7 @@ class fulltext_sphinx
break;
}
if (sizeof($author_ary))
if (count($author_ary))
{
$this->sphinx->SetFilter('poster_id', $author_ary);
}
@@ -633,14 +633,14 @@ class fulltext_sphinx
// but at least it will also cause the same for normal users.
$this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED));
if (sizeof($ex_fid_ary))
if (count($ex_fid_ary))
{
// All forums that a user is allowed to access
$fid_ary = array_unique(array_intersect(array_keys($this->auth->acl_getf('f_read', true)), array_keys($this->auth->acl_getf('f_search', true))));
// All forums that the user wants to and can search in
$search_forums = array_diff($fid_ary, $ex_fid_ary);
if (sizeof($search_forums))
if (count($search_forums))
{
$this->sphinx->SetFilter('forum_id', $search_forums);
}
@@ -790,7 +790,7 @@ class fulltext_sphinx
}
$this->db->sql_freeresult($result);
if (sizeof($post_updates))
if (count($post_updates))
{
$this->sphinx->UpdateAttributes($this->indexes, array('topic_last_post_time'), $post_updates);
}

View File

@@ -46,7 +46,7 @@ class config
*/
function get_section_by_name($name)
{
for ($i = 0, $size = sizeof($this->sections); $i < $size; $i++)
for ($i = 0, $size = count($this->sections); $i < $size; $i++)
{
// Make sure this is really a section object and not a comment
if (($this->sections[$i] instanceof \phpbb\search\sphinx\config_section) && $this->sections[$i]->get_name() == $name)
@@ -67,7 +67,7 @@ class config
function add_section($name)
{
$this->sections[] = new \phpbb\search\sphinx\config_section($name, '');
return $this->sections[sizeof($this->sections) - 1];
return $this->sections[count($this->sections) - 1];
}
/**

View File

@@ -87,7 +87,7 @@ class config_section
*/
function get_variable_by_name($name)
{
for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++)
for ($i = 0, $size = count($this->variables); $i < $size; $i++)
{
// Make sure this is a variable object and not a comment
if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name)
@@ -106,7 +106,7 @@ class config_section
*/
function delete_variables_by_name($name)
{
for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++)
for ($i = 0, $size = count($this->variables); $i < $size; $i++)
{
// Make sure this is a variable object and not a comment
if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name)
@@ -129,7 +129,7 @@ class config_section
function create_variable($name, $value)
{
$this->variables[] = new \phpbb\search\sphinx\config_variable($name, $value, '');
return $this->variables[sizeof($this->variables) - 1];
return $this->variables[count($this->variables) - 1];
}
/**

View File

@@ -146,7 +146,7 @@ class extension extends \Twig_Extension
// of items to grab (length)
// Start must always be the actual starting number for this calculation (not negative)
$start = ($start < 0) ? sizeof($item) + $start : $start;
$start = ($start < 0) ? count($item) + $start : $start;
$end = $end - $start;
}

View File

@@ -706,7 +706,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
{
$acquired_new_lock = $this->acquire_lock();
$diff = sizeof($subset_items) * 2;
$diff = count($subset_items) * 2;
$sql_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items);
$sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true);
@@ -746,7 +746,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
*/
protected function prepare_adding_subset(array $subset_items, array $new_parent)
{
$diff = sizeof($subset_items) * 2;
$diff = count($subset_items) * 2;
$sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true);
$set_left_id = $this->db->sql_case($this->column_left_id . ' > ' . (int) $new_parent[$this->column_right_id], $this->column_left_id . ' + ' . $diff, $this->column_left_id);

View File

@@ -75,7 +75,7 @@ class user_loader
// Do not load users we already have in $this->users
$user_ids = array_diff($user_ids, array_keys($this->users));
if (sizeof($user_ids))
if (count($user_ids))
{
$sql = 'SELECT *
FROM ' . $this->users_table . '