No errors whatsoever, the page execution also continues as normal it just skips the <vb:each parts.
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'topstats');
define('CSRF_PROTECTION', true);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array(
'none' => array(
'topstats_articles',
'topstats_forums',
'topstats_threads',
'topstats_users',
),
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($show['member'] AND !empty($_GET['show']))
{
if (in_array($_GET['show'], array(1,2,4,5,6,10,11)))
{
foreach($vbulletin->forumcache AS $forum)
{
if (!$forum['displayorder'] OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
$excluded_forum_ids .= ',' . $forum['forumid'];
}
// $forumpermissions = fetch_permissions($forum['forumid']);
$forumpermissions = $vbulletin->userinfo['forumpermissions']["{$forum['forumid']}"];
if (!($forumpermissions & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($vbulletin->forumcache["{$forum['forumid']}"]['showprivate'] == 1 OR (!$vbulletin->forumcache["{$forum['forumid']}"]['showprivate'] AND !$vbulletin->options['showprivateforums'])))
{
$excluded_forum_ids .= ',' . $forum['forumid'];
}
if ($_GET['cardsharing'] == 1)
{
if (in_array($forum["forumid"], array(2947,3061,3065,1612,3082)))
{
$included_forum_ids .= ',' . substr($forum['childlist'], 0, -3);
}
}
}
unset($forumpermissions, $forum);
$excluded_forum_ids = substr($excluded_forum_ids, 1);
if ($excluded_forum_ids != '')
{
$excluded_ids = "AND data.forumid NOT IN($excluded_forum_ids)";
}
$included_forum_ids = substr($included_forum_ids, 1);
if ($included_forum_ids != '')
{
$included_ids = "AND data.forumid IN ($included_forum_ids)";
}
}
switch ($_GET['show'])
{
case 1: // Latest Posts
$sqluserid = 'lastposterid';
$sqlsortfield = 'lastpost';
break;
case 2: // Latest Threads
$sqluserid = 'postuserid';
$sqlsortfield = 'dateline';
break;
case 3: // Latest Articles
$sqlsortfield = 'publishdate';
break;
case 4: // Top Threads - Most Replies
$sqluserid = 'postuserid';
$sqlsortfield = 'replycount';
break;
case 5: // Top Threads - Most Views
$sqluserid = 'postuserid';
$sqlsortfield = 'views';
break;
case 6: // Top Threads - Highest Rating
$sqluserid = 'postuserid';
$sqlsortfield = 'voteavg DESC, votenum';
break;
case 7: // Top Articles - Most Comments
$sqlsortfield = 'replycount';
break;
case 8: // Top Articles - Most Views
$sqlsortfield = 'viewcount';
break;
case 9: // Top Articles - Highest Rating
$sqlsortfield = 'ratingtotal';
break;
case 10: // Top Forums - Most Posts
$sqlsortfield = 'replycount';
break;
case 11: // Top Forums - Most Threads
$sqlsortfield = 'threadcount';
break;
case 12: // Top Members - Most Posts
$sqlsortfield = 'posts';
break;
case 13: // Top Members - Most Threads
$sqlsortfield = 'posts';
break;
case 14: // Top Members - Most Uploads
$sqlsortfield = 'uploads';
break;
case 15: // Top Members - Most Shouts
$sqlsortfield = 'dbtech_vbshout_shouts_lifetime';
break;
case 16: // Top Members - Highest Reputation
$sqlsortfield = 'reputation';
break;
case 17: // Top Members - Most Profile Visits
$sqlsortfield = 'profilevisits';
break;
case 18: // New Members
$sqlsortfield = 'userid';
break;
}
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
$limitlower = ($pagenumber - 1) * 20;
$limitupper = ($pagenumber) * 20;
if ($limitlower < 0)
{
$limitlower = 0;
}
switch ($_GET['show'])
{
case 1:
case 2:
case 4:
case 5:
case 6:
if ($_GET['show'] == 6)
{
$vbulletin->options['showvotes'] = intval($vbulletin->options['showvotes']);
$votequery = "
IF(votenum >= " . $vbulletin->options['showvotes'] . ", votenum, 0) AS votenum,
IF(votenum >= " . $vbulletin->options['showvotes'] . " AND votenum > 0, votetotal / votenum, 0) AS voteavg, votetotal,
";
}
$result = $vbulletin->db->query_read("
SELECT subscribeforumid, user.userid, usergroupid, displaygroupid, username, data.threadid, title, data.lastpost, data.forumid, pollid, replycount, views, " . iif($_GET['show'] == 6, $votequery) . "attach, data.lastpostid, prefixid, taglist
". iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ", readtime") . "
FROM " . TABLE_PREFIX . "thread AS data
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = $sqluserid)
LEFT JOIN " . TABLE_PREFIX . "subscribeforum AS subscribeforum ON (subscribeforum.forumid = data.forumid AND subscribeforum.userid = " . $vbulletin->userinfo['userid'] . ")
" . iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = data.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
WHERE NOT ISNULL(data.threadid) AND visible = '1' AND open != '10' $excluded_ids $included_ids
ORDER BY $sqlsortfield DESC
LIMIT $limitlower, 20
");
break;
case 3:
case 7:
case 8:
case 9:
$result = $vbulletin->db->query_read("
SELECT replycount, GROUP_CONCAT(category.categoryid, '|', category) AS category, user.userid, usergroupid, displaygroupid, username, node.nodeid, nodeinfo.title, viewcount, publishdate
FROM " . TABLE_PREFIX . "cms_node AS node
INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS nodeinfo ON (nodeinfo.nodeid = node.nodeid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = node.userid)
LEFT JOIN " . TABLE_PREFIX . "cms_nodecategory AS nodecategory ON (nodecategory.nodeid = node.nodeid)
LEFT JOIN " . TABLE_PREFIX . "cms_category AS category ON (category.categoryid = nodecategory.categoryid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = nodeinfo.associatedthreadid)
WHERE contenttypeid = 18 and setpublish = 1
GROUP BY node.nodeid
ORDER BY $sqlsortfield DESC
LIMIT $limitlower, 20
");
break;
case 10:
case 11:
$result = $db->query_read("
SELECT subscribeforumid, data.forumid, replycount, lastpost, threadcount
". iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ', readtime') . "
FROM " . TABLE_PREFIX . "forum AS data
LEFT JOIN " . TABLE_PREFIX . "subscribeforum AS subscribeforum ON (subscribeforum.forumid = data.forumid AND subscribeforum.userid = " . $vbulletin->userinfo['userid'] . ")
" . iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = data.forumid AND forumread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
WHERE replycount > 0 $excluded_ids $included_ids
ORDER BY $sqlsortfield DESC
LIMIT $limitlower, 20
");
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
$result = $db->query_read("
SELECT userid, usergroupid, displaygroupid, username, usertitle, joindate, lastactivity, posts, uploads, reputation, reputationlevelid, dbtech_vbshout_shouts_lifetime
FROM " . TABLE_PREFIX . "user
ORDER BY $sqlsortfield DESC
LIMIT $limitlower, 20
");
break;
}
while ($topstats_bit = $db->fetch_array($result, MYSQL_ASSOC))
{
switch ($_GET['show'])
{
case 1:
case 2:
case 4:
case 5:
case 6:
if ($topstats_bit['lastpost'] > $vbulletin->userinfo['lastvisit'])
{
if ($vbulletin->options['threadmarking'] AND $topstats_bit['readtime'])
{
$threadview = $topstats_bit['readtime'];
}
else
{
$threadview = intval(fetch_bbarray_cookie('thread_lastview', $topstats_bit['threadid']));
}
if ($topstats_bit['lastpost'] > $threadview)
{
$topstats_bit['newpost'] = true;
}
}
if (!empty($topstats_bit['prefixid']))
{
$topstats_bit['prefix'] = $vbphrase["prefix_{$topstats_bit['prefixid']}_title_rich"].": ";
}
$topstats_bit['fullthreadtitle'] = strip_tags($topstats_bit['title']);
$topstats_bit['titletrimmed'] = fetch_trimmed_title($topstats_bit['title'], 40);
$topstats_bit['pageinfo_lastpost'] = array('p' => $topstats_bit['lastpostid']);
if ($_GET['show'] == 1)
{
$topstats_bit['pageinfo_newpost'] = array('goto' => 'newpost');
}
$topstats_bit['taglist'] = strip_tags($topstats_bit['taglist']);
$topstats_bit['fullforumtitle'] = strip_tags($vbulletin->forumcache["{$topstats_bit['forumid']}"]['title_clean']);
$topstats_bit['forumtitle'] = fetch_trimmed_title($topstats_bit['fullforumtitle'], 25);
$topstats_bit['musername'] = fetch_musername($topstats_bit);
$topstats_bit['memberaction_dropdown'] = construct_memberaction_dropdown($topstats_bit);
$topstats_bit['date'] = vbdate($vbulletin->options['dateformat'], $topstats_bit['lastpost'], 1);
$topstats_bit['time'] = vbdate($vbulletin->options['timeformat'], $topstats_bit['lastpost']);
if ($_GET['show'] == 6)
{
if ($topstats_bit['votetotal'] > 0)
{
$topstats_bit['voteavg'] = vb_number_format($topstats_bit['votetotal'] / $topstats_bit['votenum'], 1);
$topstats_bit['rating'] = intval(round($topstats_bit['votetotal'] / $topstats_bit['votenum']));
}
if (empty($topstats_bit['rating']))
{
$topstats_bit['rating'] = 0;
}
}
else
{
$topstats_bit['replycount'] = vb_number_format($topstats_bit['replycount']);
$topstats_bit['views'] = vb_number_format($topstats_bit['views']);
}
break;
case 3:
case 7:
case 8:
case 9:
if ($topstats_bit['publishdate'] > $vbulletin->userinfo['lastvisit'])
{
$topstats_bit['newpost'] = true;
}
$topstats_bit['fullarticletitle'] = strip_tags($topstats_bit['title']);
$topstats_bit['articletitle'] = fetch_trimmed_title($topstats_bit['fullarticletitle'], 40);
$categories = explode(',', $topstats_bit['category']);
foreach ($categories AS $category)
{
$category = explode('|', $category);
$topstats_bit['cat']['categoryid'] = strip_tags($category[0]);
$topstats_bit['cat']['fullcategorytitle'] = strip_tags($category[1]);
$topstats_bit['cat']['categorytitle'] = fetch_trimmed_title($topstats_bit['cat']['fullcategorytitle'], 25);
$topstats_bit['categories'][] = $topstats_bit['cat'];
}
unset($category);
$topstats_bit['musername'] = fetch_musername($topstats_bit);
$topstats_bit['memberaction_dropdown'] = construct_memberaction_dropdown($topstats_bit);
$topstats_bit['date'] = vbdate($vbulletin->options['dateformat'], $topstats_bit['publishdate'], 1);
$topstats_bit['time'] = vbdate($vbulletin->options['timeformat'], $topstats_bit['publishdate']);
$topstats_bit['views'] = vb_number_format($topstats_bit['viewcount']);
break;
case 10:
case 11:
if (!$vbulletin->userinfo['lastvisit'])
{
$topstats_bit['newpost'] = true;
}
else
{
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
{
$userlastvisit = (!empty($topstats_bit['readtime']) ? $topstats_bit['readtime'] : (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)));
}
else
{
$forumview = intval(fetch_bbarray_cookie('forum_view', $topstats_bit['forumid']));
$userlastvisit = ($forumview > $vbulletin->userinfo['lastvisit'] ? $forumview : $vbulletin->userinfo['lastvisit']);
}
if ($topstats_bit['lastpost'] AND $userlastvisit < $topstats_bit['lastpost'] AND ($vbulletin->userinfo['forumpermissions'][$topstats_bit['forumid']] & $vbulletin->bf_ugp_forumpermissions['canviewothers']))
{
$topstats_bit['newpost'] = true;
}
}
$topstats_bit['fullforumtitle'] = strip_tags($vbulletin->forumcache["{$topstats_bit['forumid']}"]['title_clean']);
$topstats_bit['forumtitle'] = fetch_trimmed_title($topstats_bit['fullforumtitle'], 50);
$topstats_bit['fulldescription'] = strip_tags($vbulletin->forumcache["{$topstats_bit['forumid']}"]['description_clean']);
$topstats_bit['description'] = fetch_trimmed_title($topstats_bit['fulldescription'], 50);
$topstats_bit['threadcount'] = vb_number_format($topstats_bit['threadcount']);
$topstats_bit['replycount'] = vb_number_format($topstats_bit['replycount']);
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
$topstats_bit['musername'] = fetch_musername($topstats_bit);
$topstats_bit['memberaction_dropdown'] = construct_memberaction_dropdown($topstats_bit);
$topstats_bit['usertitle'] = strip_tags($topstats_bit['usertitle']);
$topstats_bit['join_date'] = vbdate($vbulletin->options['dateformat'], $topstats_bit['joindate'], 1);
$topstats_bit['join_time'] = vbdate($vbulletin->options['timeformat'], $topstats_bit['joindate']);
$topstats_bit['activity_date'] = vbdate($vbulletin->options['dateformat'], $topstats_bit['lastactivity'], 1);
$topstats_bit['activity_time'] = vbdate($vbulletin->options['timeformat'], $topstats_bit['lastactivity']);
$topstats_bit['posts'] = vb_number_format($topstats_bit['posts']);
$topstats_bit['uploads'] = vb_number_format($topstats_bit['uploads']);
$topstats_bit['shouts'] = vb_number_format($topstats_bit['dbtech_vbshout_shouts_lifetime']);
require_once(DIR . '/includes/functions_reputation.php');
$topstats_bit['showreputation'] = true;
cache_permissions($topstats_bit);
fetch_reputation_image($topstats_bit, $topstats_bit['permissions']);
break;
}
$topstats_bits[] = $topstats_bit;
}
$db->free_result($result);
unset($topstats_bit);
switch ($_GET['show'])
{
case 1:
case 2:
case 4:
case 5:
$templater = vB_Template::Create('topstats_threads');
break;
case 6:
$templater = vB_Template::Create('topstats_threads_rating');
break;
case 3:
case 7:
case 8:
case 9:
$templater = vB_Template::Create('topstats_articles');
break;
case 10:
case 11:
$templater = vB_Template::Create('topstats_forums');
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
$templater = vB_Template::Create('topstats_users');
break;
}
$templater->register('pagenumber', $pagenumber);
$templater->register('topstats_bits', $topstats_bits);
print_output($templater->render());
}
?>