Change count() to sizeof()
This commit is contained in:
@@ -240,7 +240,7 @@ class acp_portal
|
|||||||
// Links require preprocessing
|
// Links require preprocessing
|
||||||
|
|
||||||
$links = ( strlen($portal_config['portal_links_array']) ) ? utf_unserialize($portal_config['portal_links_array']) : array() ;
|
$links = ( strlen($portal_config['portal_links_array']) ) ? utf_unserialize($portal_config['portal_links_array']) : array() ;
|
||||||
$this->link_num = count( $links );
|
$this->link_num = sizeof( $links );
|
||||||
|
|
||||||
$lid = request_var('link', 0);
|
$lid = request_var('link', 0);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ $portal_announcement_length = ($announcement < 0) ? $portal_config['portal_annou
|
|||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_announcements_permissions'], $portal_config['portal_number_of_announcements'], $portal_announcement_length, $portal_config['portal_announcements_day'], 'announcements', $start);
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_announcements_permissions'], $portal_config['portal_number_of_announcements'], $portal_announcement_length, $portal_config['portal_announcements_day'], 'announcements', $start);
|
||||||
|
|
||||||
// Any announcements present? If not terminate it here.
|
// Any announcements present? If not terminate it here.
|
||||||
if (count($fetch_news) == 0)
|
if (sizeof($fetch_news) == 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('announcements_row', array(
|
$template->assign_block_vars('announcements_row', array(
|
||||||
'S_NO_TOPICS' => true,
|
'S_NO_TOPICS' => true,
|
||||||
@@ -95,7 +95,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
|
|||||||
|
|
||||||
$str_where = ( strlen($str_where) > 0 ) ? 'AND (forum_id = 0 OR (' . trim(substr($str_where, 0, -4)) . '))' : '';
|
$str_where = ( strlen($str_where) > 0 ) ? 'AND (forum_id = 0 OR (' . trim(substr($str_where, 0, -4)) . '))' : '';
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
$sql = 'SELECT sizeof(topic_id) AS num_topics
|
||||||
FROM ' . TOPICS_TABLE . '
|
FROM ' . TOPICS_TABLE . '
|
||||||
WHERE ((topic_type = ' . POST_GLOBAL . ')
|
WHERE ((topic_type = ' . POST_GLOBAL . ')
|
||||||
OR topic_type = ' . POST_ANNOUNCE . ')
|
OR topic_type = ' . POST_ANNOUNCE . ')
|
||||||
@@ -112,7 +112,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
|
|||||||
if($announcement < 0)
|
if($announcement < 0)
|
||||||
// Show the announcements overview
|
// Show the announcements overview
|
||||||
{
|
{
|
||||||
$count = count($fetch_news)-1;
|
$count = sizeof($fetch_news)-1;
|
||||||
for ($i = 0; $i < $count; $i++)
|
for ($i = 0; $i < $count; $i++)
|
||||||
{
|
{
|
||||||
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
||||||
@@ -163,7 +163,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
|
|||||||
'L_READ_FULL' => $read_full,
|
'L_READ_FULL' => $read_full,
|
||||||
'OPEN' => $open_bracket,
|
'OPEN' => $open_bracket,
|
||||||
'CLOSE' => $close_bracket,
|
'CLOSE' => $close_bracket,
|
||||||
'S_NOT_LAST' => ($i < count($fetch_news) - 1) ? true : false,
|
'S_NOT_LAST' => ($i < sizeof($fetch_news) - 1) ? true : false,
|
||||||
'S_POLL' => $fetch_news[$i]['poll'],
|
'S_POLL' => $fetch_news[$i]['poll'],
|
||||||
'S_UNREAD_INFO' => $unread_topic,
|
'S_UNREAD_INFO' => $unread_topic,
|
||||||
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
|
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $portal_news_length = ($news < 0) ? $portal_config['portal_news_length'] : 0;
|
|||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], $portal_news_length, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news', $start);
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], $portal_news_length, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news', $start);
|
||||||
|
|
||||||
// Any news present? If not terminate it here.
|
// Any news present? If not terminate it here.
|
||||||
if (count($fetch_news) == 0)
|
if (sizeof($fetch_news) == 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('news_row', array(
|
$template->assign_block_vars('news_row', array(
|
||||||
'S_NO_TOPICS' => true,
|
'S_NO_TOPICS' => true,
|
||||||
@@ -93,7 +93,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
|
|||||||
|
|
||||||
$topic_type = ($portal_config['portal_show_all_news']) ? '( topic_type <> ' . POST_ANNOUNCE . ' ) AND ( topic_type <> ' . POST_GLOBAL . ')' : 'topic_type = ' . POST_NORMAL;
|
$topic_type = ($portal_config['portal_show_all_news']) ? '( topic_type <> ' . POST_ANNOUNCE . ' ) AND ( topic_type <> ' . POST_GLOBAL . ')' : 'topic_type = ' . POST_NORMAL;
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
$sql = 'SELECT sizeof(topic_id) AS num_topics
|
||||||
FROM ' . TOPICS_TABLE . '
|
FROM ' . TOPICS_TABLE . '
|
||||||
WHERE ' . $topic_type . '
|
WHERE ' . $topic_type . '
|
||||||
AND topic_approved = 1
|
AND topic_approved = 1
|
||||||
@@ -107,7 +107,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
|
|||||||
if($news < 0)
|
if($news < 0)
|
||||||
// Show the news overview
|
// Show the news overview
|
||||||
{
|
{
|
||||||
$count = count($fetch_news)-1;
|
$count = sizeof($fetch_news)-1;
|
||||||
for ($i = 0; $i < $count; $i++)
|
for ($i = 0; $i < $count; $i++)
|
||||||
{
|
{
|
||||||
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
|
||||||
@@ -155,7 +155,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
|
|||||||
'L_READ_FULL' => $read_full,
|
'L_READ_FULL' => $read_full,
|
||||||
'OPEN' => $open_bracket,
|
'OPEN' => $open_bracket,
|
||||||
'CLOSE' => $close_bracket,
|
'CLOSE' => $close_bracket,
|
||||||
'S_NOT_LAST' => ($i < count($fetch_news) - 1) ? true : false,
|
'S_NOT_LAST' => ($i < sizeof($fetch_news) - 1) ? true : false,
|
||||||
'S_POLL' => $fetch_news[$i]['poll'],
|
'S_POLL' => $fetch_news[$i]['poll'],
|
||||||
'S_UNREAD_INFO' => $unread_topic,
|
'S_UNREAD_INFO' => $unread_topic,
|
||||||
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
|
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
|
||||||
|
|||||||
@@ -28,19 +28,19 @@ function get_db_stat($mode)
|
|||||||
switch( $mode )
|
switch( $mode )
|
||||||
{
|
{
|
||||||
case 'announcmenttotal':
|
case 'announcmenttotal':
|
||||||
$sql = 'SELECT COUNT(distinct t.topic_id) AS announcment_total
|
$sql = 'SELECT sizeof(distinct t.topic_id) AS announcment_total
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||||
WHERE t.topic_type = ' . POST_ANNOUNCE . '
|
WHERE t.topic_type = ' . POST_ANNOUNCE . '
|
||||||
AND p.post_id = t.topic_first_post_id';
|
AND p.post_id = t.topic_first_post_id';
|
||||||
break;
|
break;
|
||||||
case 'stickytotal':
|
case 'stickytotal':
|
||||||
$sql = 'SELECT COUNT(distinct t.topic_id) AS sticky_total
|
$sql = 'SELECT sizeof(distinct t.topic_id) AS sticky_total
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||||
WHERE t.topic_type = ' . POST_STICKY . '
|
WHERE t.topic_type = ' . POST_STICKY . '
|
||||||
AND p.post_id = t.topic_first_post_id';
|
AND p.post_id = t.topic_first_post_id';
|
||||||
break;
|
break;
|
||||||
case 'attachmentstotal':
|
case 'attachmentstotal':
|
||||||
$sql = 'SELECT COUNT(attach_id) AS attachments_total
|
$sql = 'SELECT sizeof(attach_id) AS attachments_total
|
||||||
FROM ' . ATTACHMENTS_TABLE;
|
FROM ' . ATTACHMENTS_TABLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ if (!defined('IN_PORTAL'))
|
|||||||
if ($user->data['is_registered'])
|
if ($user->data['is_registered'])
|
||||||
{
|
{
|
||||||
// new posts since last visit
|
// new posts since last visit
|
||||||
$sql = "SELECT COUNT(distinct post_id) as total
|
$sql = "SELECT sizeof(distinct post_id) as total
|
||||||
FROM " . POSTS_TABLE . "
|
FROM " . POSTS_TABLE . "
|
||||||
WHERE post_time >= " . $user->data['session_last_visit'];
|
WHERE post_time >= " . $user->data['session_last_visit'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ if ($config['load_online'] && $config['load_online_time'] && $display_online_lis
|
|||||||
{
|
{
|
||||||
if ($db->sql_layer === 'sqlite')
|
if ($db->sql_layer === 'sqlite')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(session_ip) as num_guests
|
$sql = 'SELECT sizeof(session_ip) as num_guests
|
||||||
FROM (
|
FROM (
|
||||||
SELECT DISTINCT s.session_ip
|
SELECT DISTINCT s.session_ip
|
||||||
FROM ' . SESSIONS_TABLE . ' s
|
FROM ' . SESSIONS_TABLE . ' s
|
||||||
@@ -94,7 +94,7 @@ if ($config['load_online'] && $config['load_online_time'] && $display_online_lis
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(DISTINCT s.session_ip) as num_guests
|
$sql = 'SELECT sizeof(DISTINCT s.session_ip) as num_guests
|
||||||
FROM ' . SESSIONS_TABLE . ' s
|
FROM ' . SESSIONS_TABLE . ' s
|
||||||
WHERE s.session_user_id = ' . ANONYMOUS . '
|
WHERE s.session_user_id = ' . ANONYMOUS . '
|
||||||
AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
|
AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if (!defined('IN_PORTAL'))
|
|||||||
$words_array = array();
|
$words_array = array();
|
||||||
|
|
||||||
// Get words and number of those words
|
// Get words and number of those words
|
||||||
$sql = 'SELECT l.word_text, COUNT(*) AS word_count
|
$sql = 'SELECT l.word_text, sizeof(*) AS word_count
|
||||||
FROM ' . SEARCH_WORDLIST_TABLE . ' AS l, ' . SEARCH_WORDMATCH_TABLE . ' AS m
|
FROM ' . SEARCH_WORDLIST_TABLE . ' AS l, ' . SEARCH_WORDMATCH_TABLE . ' AS m
|
||||||
WHERE m.word_id = l.word_id
|
WHERE m.word_id = l.word_id
|
||||||
GROUP BY m.word_id
|
GROUP BY m.word_id
|
||||||
|
|||||||
Reference in New Issue
Block a user