From 4a79c081b5baa3ec60c72f05a7dd6059eac7423b Mon Sep 17 00:00:00 2001 From: Yuriy Pikhtarev Date: Fri, 5 May 2017 00:57:55 +0300 Subject: [PATCH] Alias functions usage. --- admin/admin_attach_cp.php | 2 +- admin/admin_attachments.php | 6 +-- admin/admin_extensions.php | 22 +++++----- admin/admin_forum_prune.php | 2 +- admin/admin_log.php | 8 ++-- admin/admin_mass_email.php | 4 +- admin/index.php | 2 +- admin/stats/tracker.php | 6 +-- bt/includes/init_tr.php | 2 +- callseed.php | 2 +- common.php | 6 +-- dl_list.php | 2 +- group.php | 2 +- index.php | 6 +-- install/upgrade/r583-convert_avatars.php | 2 +- library/ajax/group_membership.php | 2 +- library/ajax/index_data.php | 6 +-- library/attach_mod/displaying.php | 8 ++-- .../attach_mod/includes/functions_admin.php | 6 +-- .../attach_mod/includes/functions_attach.php | 10 ++--- .../attach_mod/includes/functions_delete.php | 10 ++--- .../attach_mod/includes/functions_selects.php | 14 +++---- library/includes/bbcode.php | 14 +++---- library/includes/cache/sqlite.php | 2 +- library/includes/core/mysql.php | 38 +++++++++--------- library/includes/cron/cron_run.php | 4 +- .../includes/cron/jobs/attach_maintenance.php | 12 +++--- library/includes/cron/jobs/clean_dlstat.php | 2 +- library/includes/cron/jobs/tr_maintenance.php | 4 +- .../includes/cron/jobs/tr_make_snapshot.php | 8 ++-- .../includes/datastore/build_cat_forums.php | 4 +- library/includes/datastore/sqlite.php | 2 +- library/includes/functions.php | 8 ++-- library/includes/functions_admin.php | 4 +- library/includes/functions_admin_torrent.php | 2 +- library/includes/functions_group.php | 4 +- library/includes/functions_post.php | 4 +- library/includes/functions_validate.php | 4 +- library/includes/online_userlist.php | 12 +++--- library/includes/page_header.php | 2 +- library/includes/sessions.php | 4 +- library/includes/smtp.php | 40 +++++++++---------- library/includes/template.php | 18 ++++----- library/includes/ucp/email.php | 2 +- library/includes/ucp/register.php | 4 +- library/includes/ucp/viewprofile.php | 4 +- login.php | 2 +- modcp.php | 8 ++-- posting.php | 4 +- privmsg.php | 14 +++---- search.php | 16 ++++---- tracker.php | 16 ++++---- viewforum.php | 6 +-- 53 files changed, 199 insertions(+), 199 deletions(-) diff --git a/admin/admin_attach_cp.php b/admin/admin_attach_cp.php index 7a065c8af..4e22001a7 100644 --- a/admin/admin_attach_cp.php +++ b/admin/admin_attach_cp.php @@ -394,7 +394,7 @@ if ($view === 'attachments') { $attachments = search_attachments($order_by, $total_rows); } - if (sizeof($attachments) > 0) { + if (count($attachments) > 0) { for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) { $delete_box = ''; diff --git a/admin/admin_attachments.php b/admin/admin_attachments.php index a33aea7d7..b127304f5 100644 --- a/admin/admin_attachments.php +++ b/admin/admin_attachments.php @@ -290,7 +290,7 @@ if ($mode == 'cats') { $row = DB()->sql_fetchrowset($result); DB()->sql_freeresult($result); - for ($i = 0; $i < sizeof($row); $i++) { + for ($i = 0; $i < count($row); $i++) { if ($row[$i]['cat_id'] == IMAGE_CAT) { $s_assigned_group_images[] = $row[$i]['group_name']; } @@ -401,7 +401,7 @@ if ($submit && $mode == 'quota') { $allowed_list = array(); - for ($i = 0; $i < sizeof($quota_change_list); $i++) { + for ($i = 0; $i < count($quota_change_list); $i++) { $filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]); $sql = 'UPDATE ' . BB_QUOTA_LIMITS . " @@ -506,7 +506,7 @@ if ($mode == 'quota') { $rows = DB()->sql_fetchrowset($result); DB()->sql_freeresult($result); - for ($i = 0; $i < sizeof($rows); $i++) { + for ($i = 0; $i < count($rows); $i++) { $size_format = ($rows[$i]['quota_limit'] >= 1048576) ? 'mb' : (($rows[$i]['quota_limit'] >= 1024) ? 'kb' : 'b'); if ($rows[$i]['quota_limit'] >= 1048576) { diff --git a/admin/admin_extensions.php b/admin/admin_extensions.php index 9fc0910b0..a2f12e9cf 100644 --- a/admin/admin_extensions.php +++ b/admin/admin_extensions.php @@ -83,7 +83,7 @@ if ($submit && $mode == 'extensions') { // Generate correct Change List $extensions = array(); - for ($i = 0; $i < sizeof($extension_change_list); $i++) { + for ($i = 0; $i < count($extension_change_list); $i++) { $extensions['_' . $extension_change_list[$i]]['comment'] = $extension_explain_list[$i]; $extensions['_' . $extension_change_list[$i]]['group_id'] = intval($group_select_list[$i]); } @@ -98,7 +98,7 @@ if ($submit && $mode == 'extensions') { DB()->sql_freeresult($result); if ($num_rows > 0) { - for ($i = 0; $i < sizeof($extension_row); $i++) { + for ($i = 0; $i < count($extension_row); $i++) { if ($extension_row[$i]['comment'] != $extensions['_' . $extension_row[$i]['ext_id']]['comment'] || intval($extension_row[$i]['group_id']) != intval($extensions['_' . $extension_row[$i]['ext_id']]['group_id'])) { $sql_ary = array( 'comment' => (string)$extensions['_' . $extension_row[$i]['ext_id']]['comment'], @@ -250,15 +250,15 @@ if ($submit && $mode == 'groups') { $allowed_list = array(); - for ($i = 0; $i < sizeof($group_allowed_list); $i++) { - for ($j = 0; $j < sizeof($group_change_list); $j++) { + for ($i = 0; $i < count($group_allowed_list); $i++) { + for ($j = 0; $j < count($group_change_list); $j++) { if ($group_allowed_list[$i] == $group_change_list[$j]) { $allowed_list[$j] = 1; } } } - for ($i = 0; $i < sizeof($group_change_list); $i++) { + for ($i = 0; $i < count($group_change_list); $i++) { $allowed = (isset($allowed_list[$i])) ? 1 : 0; $filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]); @@ -471,7 +471,7 @@ if (@$add_forum && $e_mode == 'perm' && $group) { $add_forums_list = get_var('entries', array(0)); $add_all_forums = false; - for ($i = 0; $i < sizeof($add_forums_list); $i++) { + for ($i = 0; $i < count($add_forums_list); $i++) { if ($add_forums_list[$i] == 0) { $add_all_forums = true; } @@ -506,7 +506,7 @@ if (@$add_forum && $e_mode == 'perm' && $group) { } // Generate array for Auth_Pack, do not add doubled forums - for ($i = 0; $i < sizeof($add_forums_list); $i++) { + for ($i = 0; $i < count($add_forums_list); $i++) { if (!in_array($add_forums_list[$i], $auth_p)) { $auth_p[] = $add_forums_list[$i]; } @@ -543,13 +543,13 @@ if (@$delete_forum && $e_mode == 'perm' && $group) { $auth_p = array(); // Generate array for Auth_Pack, delete the chosen ones - for ($i = 0; $i < sizeof($auth_p2); $i++) { + for ($i = 0; $i < count($auth_p2); $i++) { if (!in_array($auth_p2[$i], $delete_forums_list)) { $auth_p[] = $auth_p2[$i]; } } - $auth_bitstream = (sizeof($auth_p) > 0) ? auth_pack($auth_p) : ''; + $auth_bitstream = (count($auth_p) > 0) ? auth_pack($auth_p) : ''; $sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group; @@ -596,7 +596,7 @@ if ($e_mode == 'perm' && $group) { } } - for ($i = 0; $i < sizeof($forum_perm); $i++) { + for ($i = 0; $i < count($forum_perm); $i++) { $template->assign_block_vars('allow_option_values', array( 'VALUE' => $forum_perm[$i]['forum_id'], 'OPTION' => htmlCHR($forum_perm[$i]['forum_name'])) @@ -675,7 +675,7 @@ if ($e_mode == 'perm' && $group) { $message .= ($message == '') ? $forum_name : '
' . $forum_name; } - if (sizeof($empty_perm_forums) > 0) { + if (count($empty_perm_forums) > 0) { $template->assign_vars(array('ERROR_MESSAGE' => $lang['NOTE_ADMIN_EMPTY_GROUP_PERMISSIONS'] . $message)); } } diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 90d3dee82..249e0b9ed 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -42,7 +42,7 @@ if (isset($_REQUEST['submit'])) { } $prunetime = TIMENOW - 86400 * $prunedays; - $forum_csv = in_array($all_forums, $f_selected) ? $all_forums : join(',', $f_selected); + $forum_csv = in_array($all_forums, $f_selected) ? $all_forums : implode(',', $f_selected); $where_sql = ($forum_csv != $all_forums) ? "WHERE forum_id IN($forum_csv)" : ''; diff --git a/admin/admin_log.php b/admin/admin_log.php index 3452a403b..ccfbc006f 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -106,7 +106,7 @@ if ($var =& $_REQUEST[$type_key]) { if (in_array($all_types, $type_selected)) { $type_selected = array($all_types); } - $type_csv = join(',', $type_selected); + $type_csv = implode(',', $type_selected); $url = ($type_csv != $def_types) ? url_arg($url, $type_key, $type_csv) : $url; } @@ -120,7 +120,7 @@ if ($var =& $_REQUEST[$user_key]) { if (in_array($all_users, $user_selected)) { $user_selected = array($all_users); } - $user_csv = join(',', $user_selected); + $user_csv = implode(',', $user_selected); $url = ($user_csv != $def_users) ? url_arg($url, $user_key, $user_csv) : $url; } @@ -134,7 +134,7 @@ if ($var =& $_REQUEST[$forum_key]) { if (in_array($all_forums, $forum_selected)) { $forum_selected = array($all_forums); } - $forum_csv = join(',', $forum_selected); + $forum_csv = implode(',', $forum_selected); $url = ($forum_csv != $def_forums) ? url_arg($url, $forum_key, $forum_csv) : $url; } @@ -144,7 +144,7 @@ $topic_csv = ''; if ($var =& $_REQUEST[$topic_key]) { $topic_selected = get_id_ary($var); - $topic_csv = join(',', $topic_selected); + $topic_csv = implode(',', $topic_selected); $url = ($topic_csv) ? url_arg($url, $topic_key, $topic_csv) : $url; } diff --git a/admin/admin_mass_email.php b/admin/admin_mass_email.php index 4e6fd805d..c25b5902b 100644 --- a/admin/admin_mass_email.php +++ b/admin/admin_mass_email.php @@ -54,7 +54,7 @@ if (isset($_POST['submit'])) { foreach ($sql as $row) { $user_id_sql[] = ',' . $row['ban_userid']; } - $user_id_sql = join('', $user_id_sql); + $user_id_sql = implode('', $user_id_sql); if ($group_id != -1) { $user_list = DB()->fetch_rowset(" @@ -113,7 +113,7 @@ $template->assign_vars(array( 'MESSAGE' => $message, 'SUBJECT' => $subject, - 'ERROR_MESSAGE' => ($errors) ? join('
', array_unique($errors)) : '', + 'ERROR_MESSAGE' => ($errors) ? implode('
', array_unique($errors)) : '', 'S_USER_ACTION' => 'admin_mass_email.php', 'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups), diff --git a/admin/index.php b/admin/index.php index 5e838b41a..a4394593e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -263,7 +263,7 @@ print_page('index.tpl', 'admin'); // Functions function inarray($needle, $haystack) { - for ($i = 0; $i < sizeof($haystack); $i++) { + for ($i = 0; $i < count($haystack); $i++) { if ($haystack[$i] == $needle) { return true; } diff --git a/admin/stats/tracker.php b/admin/stats/tracker.php index 2e892f4dc..cd7a6eb4a 100644 --- a/admin/stats/tracker.php +++ b/admin/stats/tracker.php @@ -131,11 +131,11 @@ echo "\n \n"; -echo "\n peers: in last " . join(' / ', $peers_in_last_minutes) . " min\n"; -echo "\n" . join(' / ', $peers_in_last_min) . "\n"; +echo "\n peers: in last " . implode(' / ', $peers_in_last_minutes) . " min\n"; +echo "\n" . implode(' / ', $peers_in_last_min) . "\n"; echo "\n peers in last $peers_in_last_sec_limit sec
[ per second, DESC order --> ]
last peer: $stat[last_peer_time] seconds ago
" . date("j M H:i:s [T O]") . " \n"; -echo '
 ' . join(' ', $peers_in_last_sec) . "
\n"; +echo '
 ' . implode(' ', $peers_in_last_sec) . "
\n"; echo ''; diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php index c177255d0..a73ff89c7 100644 --- a/bt/includes/init_tr.php +++ b/bt/includes/init_tr.php @@ -53,7 +53,7 @@ function tracker_exit() $str[] = sprintf('%.4f' . LOG_SEPR . '%02d%%', $DBS->sql_timetotal, $sql_total_perc); $str[] = $DBS->num_queries; $str[] = sprintf('%.1f', sys('la')); - $str = join(LOG_SEPR, $str) . LOG_LF; + $str = implode(LOG_SEPR, $str) . LOG_LF; dbg_log($str, '!!gentime'); } } diff --git a/callseed.php b/callseed.php index fc8976768..d71714316 100644 --- a/callseed.php +++ b/callseed.php @@ -51,7 +51,7 @@ $sql = DB()->fetch_rowset("SELECT ban_userid FROM " . BB_BANLIST . " WHERE ban_u foreach ($sql as $row) { $ban_user_id[] = ',' . $row['ban_userid']; } -$ban_user_id = join('', $ban_user_id); +$ban_user_id = implode('', $ban_user_id); $user_list = DB()->fetch_rowset(" SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl diff --git a/common.php b/common.php index f8dd24ed3..768392690 100644 --- a/common.php +++ b/common.php @@ -213,7 +213,7 @@ function utime() function bb_log($msg, $file_name) { if (is_array($msg)) { - $msg = join(LOG_LF, $msg); + $msg = implode(LOG_LF, $msg); } $file_name .= (LOG_EXT) ? '.' . LOG_EXT : ''; return file_write($msg, LOG_DIR . '/' . $file_name); @@ -413,7 +413,7 @@ function sys($param) { switch ($param) { case 'la': - return function_exists('sys_getloadavg') ? join(' ', sys_getloadavg()) : 0; + return function_exists('sys_getloadavg') ? implode(' ', sys_getloadavg()) : 0; break; case 'mem': return function_exists('memory_get_usage') ? memory_get_usage() : 0; @@ -475,7 +475,7 @@ function log_request($file = '', $prepend_str = false, $add_post = true) if (!empty($_POST) && $add_post) { $str[] = "post: " . str_compact(urldecode(http_build_query($_POST))); } - $str = join("\t", $str) . "\n"; + $str = implode("\t", $str) . "\n"; bb_log($str, $file); } diff --git a/dl_list.php b/dl_list.php index f9828ed77..8378029e5 100644 --- a/dl_list.php +++ b/dl_list.php @@ -128,7 +128,7 @@ if ($mode == 'set_topics_dl_status') { } // Get existing topics -if ($req_topics_sql = join(',', $req_topics_ary)) { +if ($req_topics_sql = implode(',', $req_topics_ary)) { $sql = "SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_id IN($req_topics_sql)"; foreach (DB()->fetch_rowset($sql) as $row) { diff --git a/group.php b/group.php index 8a5961198..493c98684 100644 --- a/group.php +++ b/group.php @@ -281,7 +281,7 @@ if (!$group_id) { foreach ($members as $members_id) { $sql_in[] = (int)$members_id; } - if (!$sql_in = join(',', $sql_in)) { + if (!$sql_in = implode(',', $sql_in)) { bb_die($lang['NONE_SELECTED']); } diff --git a/index.php b/index.php index 805d2681b..ed60a32bf 100644 --- a/index.php +++ b/index.php @@ -255,7 +255,7 @@ foreach ($cat_forums as $cid => $c) { 'POSTS' => commify($f['forum_posts']), 'TOPICS' => commify($f['forum_topics']), 'LAST_SF_ID' => isset($f['last_sf_id']) ? $f['last_sf_id'] : null, - 'MODERATORS' => isset($moderators[$fid]) ? join(', ', $moderators[$fid]) : '', + 'MODERATORS' => isset($moderators[$fid]) ? implode(', ', $moderators[$fid]) : '', 'FORUM_FOLDER_ALT' => ($new) ? $lang['NEW'] : $lang['OLD'], )); @@ -365,7 +365,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) { $week_list[] = profile_url($week) . ' (' . birthday_age($week['user_birthday'] - 1) . ')'; } $week_all = ($week_all) ? ' ...' : ''; - $week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $week_list)) . $week_all; + $week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all; } else { $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']); } @@ -380,7 +380,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) { $today_list[] = profile_url($today) . ' (' . birthday_age($today['user_birthday']) . ')'; } $today_all = ($today_all) ? ' ...' : ''; - $today_list = $lang['BIRTHDAY_TODAY'] . join(', ', $today_list) . $today_all; + $today_list = $lang['BIRTHDAY_TODAY'] . implode(', ', $today_list) . $today_all; } else { $today_list = $lang['NOBIRTHDAY_TODAY']; } diff --git a/install/upgrade/r583-convert_avatars.php b/install/upgrade/r583-convert_avatars.php index c7b028607..60b938a42 100644 --- a/install/upgrade/r583-convert_avatars.php +++ b/install/upgrade/r583-convert_avatars.php @@ -80,7 +80,7 @@ if ($confirm) { DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1"); $avatars_ok++; } else { - echo "{$row['user_id']}: ", join("\n{$row['user_id']}: ", $upload->errors), "\n"; + echo "{$row['user_id']}: ", implode("\n{$row['user_id']}: ", $upload->errors), "\n"; $avatars_err++; } } diff --git a/library/ajax/group_membership.php b/library/ajax/group_membership.php index ed4551dc3..5c99a2534 100644 --- a/library/ajax/group_membership.php +++ b/library/ajax/group_membership.php @@ -71,7 +71,7 @@ switch ($mode) { } } if ($html) { - $this->response['group_list_html'] = ''; + $this->response['group_list_html'] = ''; } else { $this->response['group_list_html'] = $lang['GROUP_LIST_HIDDEN']; } diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php index 872cac13f..52f76bf25 100644 --- a/library/ajax/index_data.php +++ b/library/ajax/index_data.php @@ -43,7 +43,7 @@ switch ($mode) { foreach ($stats['birthday_week_list'] as $week) { $html[] = profile_url($week) . ' (' . birthday_age($week['user_birthday']) . ')'; } - $html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html)); + $html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $html)); } else { $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']); } @@ -59,7 +59,7 @@ switch ($mode) { foreach ($stats['birthday_today_list'] as $today) { $html[] = profile_url($today) . ' (' . birthday_age($today['user_birthday']) . ')'; } - $html = $lang['BIRTHDAY_TODAY'] . join(', ', $html); + $html = $lang['BIRTHDAY_TODAY'] . implode(', ', $html); } else { $html = $lang['NOBIRTHDAY_TODAY']; } @@ -88,7 +88,7 @@ switch ($mode) { } $html = ': '; - $html .= ($moderators) ? join(', ', $moderators) : $lang['NONE']; + $html .= ($moderators) ? implode(', ', $moderators) : $lang['NONE']; unset($moderators, $mod); $datastore->rm('moderators'); break; diff --git a/library/attach_mod/displaying.php b/library/attach_mod/displaying.php index 943b5e1e4..bb8f26f00 100644 --- a/library/attach_mod/displaying.php +++ b/library/attach_mod/displaying.php @@ -46,7 +46,7 @@ function init_complete_extensions_data() } $allowed_extensions = array(); - for ($i = 0, $size = sizeof($extension_informations); $i < $size; $i++) { + for ($i = 0, $size = count($extension_informations); $i < $size; $i++) { $extension = strtolower(trim($extension_informations[$i]['extension'])); $allowed_extensions[] = $extension; $display_categories[$extension] = intval($extension_informations[$i]['cat_id']); @@ -140,12 +140,12 @@ function init_display_post_attachments($switch_attachment) } } - if (sizeof($post_id_array) == 0) { + if (count($post_id_array) == 0) { return; } $rows = get_attachments_from_post($post_id_array); - $num_rows = sizeof($rows); + $num_rows = count($rows); if ($num_rows == 0) { return; @@ -183,7 +183,7 @@ function display_attachments($post_id) { global $template, $upload_dir, $userdata, $allowed_extensions, $display_categories, $download_modes, $lang, $attachments, $upload_icons, $attach_config; - $num_attachments = @sizeof($attachments['_' . $post_id]); + $num_attachments = @count($attachments['_' . $post_id]); if ($num_attachments == 0) { return; diff --git a/library/attach_mod/includes/functions_admin.php b/library/attach_mod/includes/functions_admin.php index 51280986f..fd142fc46 100644 --- a/library/attach_mod/includes/functions_admin.php +++ b/library/attach_mod/includes/functions_admin.php @@ -106,7 +106,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0) */ function sort_multi_array($sort_array, $key, $sort_order, $pre_string_sort = 0) { - $last_element = sizeof($sort_array) - 1; + $last_element = count($sort_array) - 1; if (!$pre_string_sort) { $string_sort = (!is_numeric(@$sort_array[$last_element - 1][$key])) ? true : false; @@ -266,7 +266,7 @@ function search_attachments($order_by, &$total_rows) $sql = 'SELECT a.*, t.post_id, p.post_time, p.topic_id FROM ' . BB_ATTACHMENTS . ' t, ' . BB_ATTACHMENTS_DESC . ' a, ' . BB_POSTS . ' p WHERE '; - if (sizeof($where_sql) > 0) { + if (count($where_sql) > 0) { $sql .= implode('AND', $where_sql) . ' AND '; } @@ -309,7 +309,7 @@ function search_attachments($order_by, &$total_rows) function limit_array($array, $start, $pagelimit) { // array from start - start+pagelimit - $limit = (sizeof($array) < ($start + $pagelimit)) ? sizeof($array) : $start + $pagelimit; + $limit = (count($array) < ($start + $pagelimit)) ? count($array) : $start + $pagelimit; $limit_array = []; diff --git a/library/attach_mod/includes/functions_attach.php b/library/attach_mod/includes/functions_attach.php index 54c4d951e..3c07d3ae2 100644 --- a/library/attach_mod/includes/functions_attach.php +++ b/library/attach_mod/includes/functions_attach.php @@ -103,7 +103,7 @@ function auth_pack($auth_array) $one_char = $two_char = false; $auth_cache = ''; - for ($i = 0; $i < sizeof($auth_array); $i++) { + for ($i = 0; $i < count($auth_array); $i++) { $val = base64_pack(intval($auth_array[$i])); if (strlen($val) == 1 && !$one_char) { $auth_cache .= $one_char_encoding; @@ -316,7 +316,7 @@ function get_attachments_from_post($post_id_array) */ function get_total_attach_filesize($attach_ids) { - if (!is_array($attach_ids) || !sizeof($attach_ids)) { + if (!is_array($attach_ids) || !count($attach_ids)) { return 0; } @@ -356,7 +356,7 @@ function get_extension_informations() function attachment_sync_topic($topics) { if (is_array($topics)) { - $topics = join(',', $topics); + $topics = implode(',', $topics); } $posts_without_attach = $topics_without_attach = array(); @@ -372,7 +372,7 @@ function attachment_sync_topic($topics) foreach ($rowset as $row) { $posts_without_attach[] = $row['post_id']; } - if ($posts_sql = join(',', $posts_without_attach)) { + if ($posts_sql = implode(',', $posts_without_attach)) { DB()->query("UPDATE " . BB_POSTS . " SET post_attachment = 0 WHERE post_id IN($posts_sql)"); } } @@ -399,7 +399,7 @@ function attachment_sync_topic($topics) foreach ($rowset as $row) { $topics_without_attach[] = $row['topic_id']; } - if ($topics_sql = join(',', $topics_without_attach)) { + if ($topics_sql = implode(',', $topics_without_attach)) { DB()->query("UPDATE " . BB_TOPICS . " SET topic_attachment = 0 WHERE topic_id IN($topics_sql)"); } } diff --git a/library/attach_mod/includes/functions_delete.php b/library/attach_mod/includes/functions_delete.php index 228db7451..cee349b4e 100644 --- a/library/attach_mod/includes/functions_delete.php +++ b/library/attach_mod/includes/functions_delete.php @@ -94,7 +94,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, } } - if (!sizeof($post_id_array)) { + if (!count($post_id_array)) { return; } @@ -139,13 +139,13 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, } } - if (!sizeof($attach_id_array)) { + if (!count($attach_id_array)) { return; } $sql_id = 'post_id'; - if (sizeof($post_id_array) && sizeof($attach_id_array)) { + if (count($post_id_array) && count($attach_id_array)) { $sql = 'DELETE FROM ' . BB_ATTACHMENTS . ' WHERE attach_id IN (' . implode(', ', $attach_id_array) . ") AND $sql_id IN (" . implode(', ', $post_id_array) . ')'; @@ -187,7 +187,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, } //bt end - for ($i = 0; $i < sizeof($attach_id_array); $i++) { + for ($i = 0; $i < count($attach_id_array); $i++) { $sql = 'SELECT attach_id FROM ' . BB_ATTACHMENTS . ' WHERE attach_id = ' . (int)$attach_id_array[$i]; @@ -236,7 +236,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, } // Now Sync the Topic/PM - if (sizeof($post_id_array)) { + if (count($post_id_array)) { $sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id IN (' . implode(', ', $post_id_array) . ') diff --git a/library/attach_mod/includes/functions_selects.php b/library/attach_mod/includes/functions_selects.php index 1a771aa8a..286448ab9 100644 --- a/library/attach_mod/includes/functions_selects.php +++ b/library/attach_mod/includes/functions_selects.php @@ -50,7 +50,7 @@ function group_select($select_name, $default_group = 0) $group_name[$num_rows]['group_id'] = 0; $group_name[$num_rows]['group_name'] = $lang['NOT_ASSIGNED']; - for ($i = 0; $i < sizeof($group_name); $i++) { + for ($i = 0; $i < count($group_name); $i++) { if (!$default_group) { $selected = ($i == 0) ? ' selected="selected"' : ''; } else { @@ -93,7 +93,7 @@ function download_select($select_name, $group_id = 0) $group_select = ''; - for ($i = 0; $i < sizeof($types); $i++) { + for ($i = 0; $i < count($types); $i++) { if (!$group_id) { $selected = ($types[$i] == NONE_CAT) ? ' selected="selected"' : ''; } else { @@ -172,7 +172,7 @@ function size_select($select_name, $size_compare) $select_field = '