Alias functions usage.

(cherry picked from commit 4a79c08)
This commit is contained in:
Yuriy Pikhtarev 2017-05-05 00:57:55 +03:00 committed by Vasily Komrakov
commit 6abd9babc9
No known key found for this signature in database
GPG key ID: 558236680C20A69A
53 changed files with 197 additions and 197 deletions

View file

@ -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;

View file

@ -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 = [];

View file

@ -101,7 +101,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;
@ -310,7 +310,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;
}
@ -350,7 +350,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();
@ -366,7 +366,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)");
}
}
@ -393,7 +393,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)");
}
}

View file

@ -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) . ')

View file

@ -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 = '<select name="' . $select_name . '">';
for ($i = 0; $i < sizeof($types_download); $i++) {
for ($i = 0; $i < count($types_download); $i++) {
if (!$group_id) {
$selected = ($types_download[$i] == INLINE_LINK) ? ' selected="selected"' : '';
} else {
@ -138,14 +138,14 @@ function category_select($select_name, $group_id = 0)
$types = array(NONE_CAT);
$modes = array('none');
for ($i = 0; $i < sizeof($types_category); $i++) {
for ($i = 0; $i < count($types_category); $i++) {
$types[] = $types_category[$i];
$modes[] = $modes_category[$i];
}
$group_select = '<select name="' . $select_name . '" style="width:100px">';
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 = '<select name="' . $select_name . '">';
for ($i = 0; $i < sizeof($size_types_text); $i++) {
for ($i = 0; $i < count($size_types_text); $i++) {
$selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
$select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
}
@ -204,7 +204,7 @@ function quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($quota_name); $i++) {
for ($i = 0; $i < count($quota_name); $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}
@ -235,7 +235,7 @@ function default_quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($quota_name); $i++) {
for ($i = 0; $i < count($quota_name); $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}