diff options
author | rxu <rxu@mail.ru> | 2017-06-28 00:58:03 +0700 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2018-01-01 13:56:04 +0100 |
commit | f8fbe3793680af1dae2db2829cfc84068831c52f (patch) | |
tree | 54c7108b28fb58688a8695a0b592c163314a09f9 /phpBB/includes/functions_privmsgs.php | |
parent | ff18802656e72981f6ecb613d756bc19f2462689 (diff) | |
download | forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.gz forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.bz2 forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.xz forums-f8fbe3793680af1dae2db2829cfc84068831c52f.zip |
[ticket/14972] replace all occurrences of sizeof() with the count()
PHPBB3-14972
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ff962075a8..444bf2c7e0 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -466,7 +466,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $user_rules = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - if (sizeof($user_rules)) + if (count($user_rules)) { $sql = 'SELECT zebra_id, friend, foe FROM ' . ZEBRA_TABLE . " @@ -499,7 +499,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $db->sql_freeresult($result); // Retrieve user memberships - if (sizeof($user_ids)) + if (count($user_ids)) { $sql = 'SELECT * FROM ' . USER_GROUP_TABLE . ' @@ -600,14 +600,14 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // only gone through if new messages arrive. // Delete messages - if (sizeof($delete_ids)) + if (count($delete_ids)) { - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); } // Set messages to Unread - if (sizeof($unread_ids)) + if (count($unread_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_unread = 0 @@ -618,7 +618,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } // mark messages as important - if (sizeof($important_ids)) + if (count($important_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_marked = 1 - pm_marked @@ -631,7 +631,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Move into folder $folder = array(); - if (sizeof($move_into_folder)) + if (count($move_into_folder)) { // Determine Full Folder Action - we need the move to folder id later eventually $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; @@ -676,12 +676,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Check Message Limit - we calculate with the complete array, most of the time it is one message // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) - if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; // If destination folder itself is full... - if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } @@ -699,7 +699,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) WHERE user_id = $user_id AND folder_id = $dest_folder ORDER BY msg_id ASC"; - $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $user->data['message_limit'])); + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + count($msg_ary)) - $user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -708,7 +708,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } $db->sql_freeresult($result); - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, $dest_folder); } } @@ -744,7 +744,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } - if (sizeof($action_ary)) + if (count($action_ary)) { // Move from OUTBOX to SENTBOX // We are not checking any full folder status here... SENTBOX is a special treatment (old messages get deleted) @@ -785,7 +785,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $move_msg_ids = array($move_msg_ids); } - if (sizeof($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && + if (count($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && !in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)) && $cur_folder_id != $dest_folder) { // We have to check the destination folder ;) @@ -805,7 +805,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol trigger_error('NOT_AUTHORISED'); } - if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $row['pm_count'] + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '<br /><br />'; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $row['folder_id']) . '">', '</a>', $row['folder_name']); @@ -822,7 +822,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); - if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $num_messages + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '<br /><br />'; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">', '</a>', $user->lang['PM_INBOX']); @@ -949,7 +949,7 @@ function handle_mark_actions($user_id, $mark_action) $msg_ids = $request->variable('marked_msg_id', array(0)); $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -981,7 +981,7 @@ function handle_mark_actions($user_id, $mark_action) { delete_pm($user_id, $msg_ids, $cur_folder_id); - $success_msg = (sizeof($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $success_msg = (count($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); meta_refresh(3, $redirect); @@ -1032,7 +1032,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $msg_ids = array($msg_ids); } - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -1069,7 +1069,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $db->sql_freeresult($result); unset($msg_ids); - if (!sizeof($delete_rows)) + if (!count($delete_rows)) { return false; } @@ -1156,7 +1156,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $delete_ids = array_keys($delete_rows); - if (sizeof($delete_ids)) + if (count($delete_ids)) { // Check if there are any attachments we need to remove /** @var \phpbb\attachment\manager $attachment_manager */ @@ -1289,7 +1289,7 @@ function phpbb_delete_users_pms($user_ids) $num_pms = (int) $row['num_undelivered_privmsgs']; $undelivered_user[$num_pms][] = (int) $row['user_id']; - if (sizeof($undelivered_user[$num_pms]) > 50) + if (count($undelivered_user[$num_pms]) > 50) { // If there are too many users affected the query might get // too long, so we update the value for the first bunch here. @@ -1416,7 +1416,7 @@ function rebuild_header($check_ary) $_types = array('u', 'g'); foreach ($_types as $type) { - if (sizeof(${$type})) + if (count(${$type})) { foreach (${$type} as $id) { @@ -1461,7 +1461,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } $address = array(); - if (sizeof($u)) + if (count($u)) { $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' @@ -1485,7 +1485,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) $db->sql_freeresult($result); } - if (sizeof($g)) + if (count($g)) { if ($plaintext) { @@ -1532,7 +1532,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } } - if (sizeof($address) && !$plaintext) + if (count($address) && !$plaintext) { $template->assign_var('S_' . strtoupper($check_type) . '_RECIPIENT', true); @@ -1651,7 +1651,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($data_ary['address_list'][$ug_type]) && sizeof($data_ary['address_list'][$ug_type])) + if (isset($data_ary['address_list'][$ug_type]) && count($data_ary['address_list'][$ug_type])) { foreach ($data_ary['address_list'][$ug_type] as $id => $field) { @@ -1673,7 +1673,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) } } - if (isset($data_ary['address_list']['g']) && sizeof($data_ary['address_list']['g'])) + if (isset($data_ary['address_list']['g']) && count($data_ary['address_list']['g'])) { // We need to check the PM status of group members (do they want to receive PM's?) // Only check if not a moderator or admin, since they are allowed to override this user setting @@ -1696,7 +1696,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $db->sql_freeresult($result); } - if (!sizeof($recipients)) + if (!count($recipients)) { trigger_error('NO_RECIPIENT'); } @@ -1764,7 +1764,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) break; } - if (sizeof($sql_data)) + if (count($sql_data)) { if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') { @@ -1844,7 +1844,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $orphan_rows[(int) $attach_row['attach_id']] = array(); } - if (sizeof($orphan_rows)) + if (count($orphan_rows)) { $sql = 'SELECT attach_id, filesize, physical_filename FROM ' . ATTACHMENTS_TABLE . ' @@ -2038,7 +2038,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - if (sizeof($rowset) == 1 && !$in_post_mode) + if (count($rowset) == 1 && !$in_post_mode) { return false; } @@ -2051,7 +2051,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode // Re-order rowset to be able to get the next/prev message rows... $rowset = array_values($rowset); - for ($i = 0, $size = sizeof($rowset); $i < $size; $i++) + for ($i = 0, $size = count($rowset); $i < $size; $i++) { $row = &$rowset[$i]; $id = (int) $row['msg_id']; @@ -2197,7 +2197,7 @@ function get_recipient_strings($pm_by_id) foreach ($_types as $ug_type) { - if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + if (isset($address[$message_id][$ug_type]) && count($address[$message_id][$ug_type])) { foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) { |