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:
@@ -198,7 +198,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
|
||||
}
|
||||
|
||||
if (!sizeof($author_id_ary))
|
||||
if (!count($author_id_ary))
|
||||
{
|
||||
trigger_error('NO_SEARCH_RESULTS');
|
||||
}
|
||||
@@ -220,7 +220,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
|
||||
// Which forums should not be searched? Author searches are also carried out in unindexed forums
|
||||
if (empty($keywords) && sizeof($author_id_ary))
|
||||
if (empty($keywords) && count($author_id_ary))
|
||||
{
|
||||
$ex_fid_ary = array_keys($auth->acl_getf('!f_read', true));
|
||||
}
|
||||
@@ -229,7 +229,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true))));
|
||||
}
|
||||
|
||||
$not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";
|
||||
$not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";
|
||||
|
||||
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id
|
||||
FROM ' . FORUMS_TABLE . ' f
|
||||
@@ -256,7 +256,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sizeof($search_forum))
|
||||
if (count($search_forum))
|
||||
{
|
||||
if ($search_child)
|
||||
{
|
||||
@@ -309,9 +309,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
{
|
||||
$correct_query = $search->split_keywords($keywords, $search_terms);
|
||||
$common_words = $search->get_common_words();
|
||||
if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id))
|
||||
if (!$correct_query || (!$search->get_search_query() && !count($author_id_ary) && !$search_id))
|
||||
{
|
||||
$ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
|
||||
$ignored = (count($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
|
||||
$word_length = $search->get_word_length();
|
||||
if ($word_length)
|
||||
{
|
||||
@@ -324,7 +324,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$keywords && sizeof($author_id_ary))
|
||||
if (!$keywords && count($author_id_ary))
|
||||
{
|
||||
// if it is an author search we want to show topics by default
|
||||
$show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts');
|
||||
@@ -384,7 +384,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
WHERE t.topic_moved_id = 0
|
||||
$last_post_time_sql
|
||||
AND " . $m_approve_topics_fid_sql . '
|
||||
' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . '
|
||||
' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . '
|
||||
ORDER BY t.topic_last_post_time DESC';
|
||||
$field = 'topic_id';
|
||||
break;
|
||||
@@ -422,7 +422,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
AND p.topic_id = t.topic_id
|
||||
$last_post_time
|
||||
AND $m_approve_posts_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
" . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
$sql_sort";
|
||||
$field = 'post_id';
|
||||
}
|
||||
@@ -435,7 +435,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
AND p.topic_id = t.topic_id
|
||||
$last_post_time
|
||||
AND $m_approve_topics_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
" . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
$sql_sort";
|
||||
$field = 'topic_id';
|
||||
}
|
||||
@@ -451,7 +451,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
|
||||
$sql_where = 'AND t.topic_moved_id = 0
|
||||
AND ' . $m_approve_topics_fid_sql . '
|
||||
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
|
||||
' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
|
||||
|
||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
|
||||
$s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = '';
|
||||
@@ -477,7 +477,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
FROM ' . POSTS_TABLE . ' p
|
||||
WHERE p.post_time > ' . $user->data['user_lastvisit'] . '
|
||||
AND ' . $m_approve_posts_fid_sql . '
|
||||
' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
|
||||
$sql_sort";
|
||||
$field = 'post_id';
|
||||
}
|
||||
@@ -488,7 +488,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . '
|
||||
AND t.topic_moved_id = 0
|
||||
AND ' . $m_approve_topics_fid_sql . '
|
||||
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
|
||||
' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
|
||||
$sql_sort";
|
||||
/*
|
||||
[Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul)
|
||||
@@ -562,7 +562,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$search_id = '';
|
||||
}
|
||||
|
||||
$total_match_count = sizeof($id_ary);
|
||||
$total_match_count = count($id_ary);
|
||||
if ($total_match_count)
|
||||
{
|
||||
// Limit the number to $total_matches_limit for pre-made searches
|
||||
@@ -592,7 +592,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
{
|
||||
$total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
}
|
||||
else if (sizeof($author_id_ary))
|
||||
else if (count($author_id_ary))
|
||||
{
|
||||
$firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false;
|
||||
$total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
@@ -642,10 +642,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
|
||||
$sql_where = '';
|
||||
|
||||
if (sizeof($id_ary))
|
||||
if (count($id_ary))
|
||||
{
|
||||
$sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary);
|
||||
$sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : '';
|
||||
$sql_where .= (count($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : '';
|
||||
$sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql);
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// If we have some shadow topics, update the rowset to reflect their topic information
|
||||
if (sizeof($shadow_topic_list))
|
||||
if (count($shadow_topic_list))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
@@ -987,7 +987,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
unset($text_only_message);
|
||||
|
||||
// Pull attachment data
|
||||
if (sizeof($attach_list))
|
||||
if (count($attach_list))
|
||||
{
|
||||
$use_attach_list = $attach_list;
|
||||
$attach_list = array();
|
||||
@@ -1001,7 +1001,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($attach_list))
|
||||
if (count($attach_list))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
|
Reference in New Issue
Block a user