mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/14972] replace all occurrences of sizeof() with the count()
PHPBB3-14972
This commit is contained in:
@@ -47,7 +47,7 @@ class mcp_main
|
||||
case 'unlock':
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class mcp_main
|
||||
|
||||
$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
|
||||
|
||||
if (!sizeof($post_ids))
|
||||
if (!count($post_ids))
|
||||
{
|
||||
trigger_error('NO_POST_SELECTED');
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class mcp_main
|
||||
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class mcp_main
|
||||
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class mcp_main
|
||||
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class mcp_main
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class mcp_main
|
||||
$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
|
||||
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
|
||||
|
||||
if (!sizeof($post_ids))
|
||||
if (!count($post_ids))
|
||||
{
|
||||
trigger_error('NO_POST_SELECTED');
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class mcp_main
|
||||
|
||||
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class mcp_main
|
||||
|
||||
$forum_info = phpbb_get_forum_data($forum_id, 'm_', true);
|
||||
|
||||
if (!sizeof($forum_info))
|
||||
if (!count($forum_info))
|
||||
{
|
||||
$this->main('main', 'front');
|
||||
return;
|
||||
@@ -342,7 +342,7 @@ function lock_unlock($action, $ids)
|
||||
);
|
||||
extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars)));
|
||||
|
||||
$success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
|
||||
$success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
|
||||
|
||||
meta_refresh(2, $redirect);
|
||||
$message = $user->lang[$success_msg];
|
||||
@@ -355,7 +355,7 @@ function lock_unlock($action, $ids)
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);
|
||||
confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields);
|
||||
}
|
||||
|
||||
redirect($redirect);
|
||||
@@ -373,25 +373,25 @@ function change_topic_type($action, $topic_ids)
|
||||
case 'make_announce':
|
||||
$new_topic_type = POST_ANNOUNCE;
|
||||
$check_acl = 'f_announce';
|
||||
$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';
|
||||
$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';
|
||||
break;
|
||||
|
||||
case 'make_global':
|
||||
$new_topic_type = POST_GLOBAL;
|
||||
$check_acl = 'f_announce_global';
|
||||
$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';
|
||||
$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';
|
||||
break;
|
||||
|
||||
case 'make_sticky':
|
||||
$new_topic_type = POST_STICKY;
|
||||
$check_acl = 'f_sticky';
|
||||
$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';
|
||||
$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';
|
||||
break;
|
||||
|
||||
default:
|
||||
$new_topic_type = POST_NORMAL;
|
||||
$check_acl = false;
|
||||
$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
|
||||
$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ function change_topic_type($action, $topic_ids)
|
||||
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids))
|
||||
if (($new_topic_type == POST_GLOBAL) && count($topic_ids))
|
||||
{
|
||||
// Delete topic shadows for global announcements
|
||||
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
|
||||
@@ -432,9 +432,9 @@ function change_topic_type($action, $topic_ids)
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
|
||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
|
||||
|
||||
if (sizeof($topic_ids))
|
||||
if (count($topic_ids))
|
||||
{
|
||||
$data = phpbb_get_topic_data($topic_ids);
|
||||
|
||||
@@ -496,7 +496,7 @@ function mcp_move_topic($topic_ids)
|
||||
{
|
||||
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
|
||||
|
||||
if (!sizeof($forum_data))
|
||||
if (!count($forum_data))
|
||||
{
|
||||
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
|
||||
}
|
||||
@@ -691,7 +691,7 @@ function mcp_move_topic($topic_ids)
|
||||
$sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
|
||||
}
|
||||
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
|
||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
|
||||
|
||||
foreach ($sync_sql as $forum_id_key => $array)
|
||||
{
|
||||
@@ -714,7 +714,7 @@ function mcp_move_topic($topic_ids)
|
||||
'ADDITIONAL_MSG' => $additional_msg)
|
||||
);
|
||||
|
||||
confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
|
||||
confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
|
||||
}
|
||||
|
||||
$redirect = $request->variable('redirect', "index.$phpEx");
|
||||
@@ -762,7 +762,7 @@ function mcp_restore_topic($topic_ids)
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';
|
||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';
|
||||
|
||||
$data = phpbb_get_topic_data($topic_ids);
|
||||
|
||||
@@ -784,7 +784,7 @@ function mcp_restore_topic($topic_ids)
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);
|
||||
confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);
|
||||
}
|
||||
|
||||
$topic_id = $request->variable('t', 0);
|
||||
@@ -842,7 +842,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';
|
||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';
|
||||
|
||||
$data = phpbb_get_topic_data($topic_ids);
|
||||
|
||||
@@ -927,10 +927,10 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||
'S_TOPIC_MODE' => true,
|
||||
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
|
||||
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
|
||||
'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', sizeof($topic_ids)),
|
||||
'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)),
|
||||
));
|
||||
|
||||
$l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
|
||||
$l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
|
||||
if ($only_softdeleted)
|
||||
{
|
||||
$l_confirm .= '_PERMANENTLY';
|
||||
@@ -1042,11 +1042,11 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||
{
|
||||
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
|
||||
}
|
||||
$affected_topics = sizeof($topic_info);
|
||||
$affected_topics = count($topic_info);
|
||||
// None of the topics is really deleted, so a redirect won't hurt much.
|
||||
$deleted_topics = 0;
|
||||
|
||||
$success_msg = (sizeof($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];
|
||||
$success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];
|
||||
|
||||
foreach ($approve_log as $row)
|
||||
{
|
||||
@@ -1093,7 +1093,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||
{
|
||||
$topic_id_list[] = $row['topic_id'];
|
||||
}
|
||||
$affected_topics = sizeof($topic_id_list);
|
||||
$affected_topics = count($topic_id_list);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$post_data = phpbb_get_post_data($post_ids);
|
||||
@@ -1132,7 +1132,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||
}
|
||||
$return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');
|
||||
|
||||
if (sizeof($post_ids) == 1)
|
||||
if (count($post_ids) == 1)
|
||||
{
|
||||
if ($deleted_topics)
|
||||
{
|
||||
@@ -1181,10 +1181,10 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||
'S_SOFTDELETED' => $only_softdeleted,
|
||||
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
|
||||
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
|
||||
'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', sizeof($post_ids)),
|
||||
'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)),
|
||||
));
|
||||
|
||||
$l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
|
||||
$l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
|
||||
if ($only_softdeleted)
|
||||
{
|
||||
$l_confirm .= '_PERMANENTLY';
|
||||
@@ -1247,11 +1247,11 @@ function mcp_fork_topic($topic_ids)
|
||||
{
|
||||
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
$additional_msg = $user->lang['NO_TOPIC_SELECTED'];
|
||||
}
|
||||
else if (!sizeof($forum_data))
|
||||
else if (!count($forum_data))
|
||||
{
|
||||
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
|
||||
}
|
||||
@@ -1409,7 +1409,7 @@ function mcp_fork_topic($topic_ids)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($post_rows))
|
||||
if (!count($post_rows))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1512,7 +1512,7 @@ function mcp_fork_topic($topic_ids)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
if (count($sql_ary))
|
||||
{
|
||||
$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
|
||||
}
|
||||
@@ -1536,7 +1536,7 @@ function mcp_fork_topic($topic_ids)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
if (count($sql_ary))
|
||||
{
|
||||
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
|
||||
}
|
||||
@@ -1557,7 +1557,7 @@ function mcp_fork_topic($topic_ids)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
if (count($sql_ary))
|
||||
{
|
||||
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
|
||||
}
|
||||
@@ -1589,7 +1589,7 @@ function mcp_fork_topic($topic_ids)
|
||||
sync('topic', 'topic_id', $new_topic_id_list);
|
||||
sync('forum', 'forum_id', $to_forum_id);
|
||||
|
||||
$config->increment('num_topics', sizeof($new_topic_id_list), false);
|
||||
$config->increment('num_topics', count($new_topic_id_list), false);
|
||||
$config->increment('num_posts', $total_posts, false);
|
||||
|
||||
foreach ($new_topic_id_list as $topic_id => $new_topic_id)
|
||||
@@ -1601,7 +1601,7 @@ function mcp_fork_topic($topic_ids)
|
||||
));
|
||||
}
|
||||
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
|
||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1611,7 +1611,7 @@ function mcp_fork_topic($topic_ids)
|
||||
'ADDITIONAL_MSG' => $additional_msg)
|
||||
);
|
||||
|
||||
confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
|
||||
confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
|
||||
}
|
||||
|
||||
$redirect = $request->variable('redirect', "index.$phpEx");
|
||||
|
Reference in New Issue
Block a user