MyBB Community Forums

Full Version: Statistics Page Issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm having a few problems with my Forum Statistics page: http://homeundone.com/stats.php

This first issue is that a PHP error is repeating a few dozen times at the top of the page, while it renders mostly normal anyways.
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/home/public_html/stats.php on line 84

The second issue is that sensitive thread titles from our moderator section are being displayed in the top threads section. Even to those regular or unlogged in users who do not have permission to view those categories or threads.

I'd appreciate any and all help, thanks.
I uploaded a fresh fresh stats.php from the latest package. That fixed the PHP errors.

Can someone help me with the thread issue?
Go into mybb_datacache from phpMyAdmin and delete the rows most_viewed_threads and most_replied_threads

Go to stats.php and it should regenerate correctly
Thanks Tiki. That got things moving again.

I'm still looking for a solution to the sensitive thread title issue. I can't see why threads in private categories are invisible to guests everywhere but on the stats page.
quacktacular Wrote:I'm still looking for a solution to the sensitive thread title issue. I can't see why threads in private categories are invisible to guests everywhere but on the stats page.

Open stats.php

Search for
// Get forum permissions
$unviewableforumsarray = array();
$unviewableforums = get_unviewable_forums();
$fidnot = '1=1';
if($unviewableforums)
{
    $fidnot = "fid NOT IN ($unviewableforums)";
}
if($unviewableforums)
{
    $fidnot = "fid NOT IN ($unviewableforums)";
    $unviewableforumsarray = explode(',', $unviewableforums);
} 

and replace with
// Get forum permissions
$unviewableforumsarray = array();
$unviewableforums = get_unviewable_forums();
$fidnot = '1=1';
if($unviewableforums)
{
    $fidnot = "fid NOT IN ($unviewableforums)";
    $unviewableforumsarray = explode(',', $unviewableforums);
} 

Search for
$query = $db->simple_select(TABLE_PREFIX."threads", "tid, subject, replies", "", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); 

and replace with
$query = $db->simple_select(TABLE_PREFIX."threads", "tid, subject, replies", $fidnot, array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); 

Search for
$query = $db->simple_select(TABLE_PREFIX."threads", "tid, subject, views", "", array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); 

and replace with
$query = $db->simple_select(TABLE_PREFIX."threads", "tid, subject, views", $fidnot, array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); 

Search for
if(!$mostrepliedthreads || $mostrepliedthreads['lastupdated'] <= time()-60*60*24) 

and replace with
if($mostrepliedthreads || $mostrepliedthreads['lastupdated'] <= time()-60*60*24) 

Search for
if(!$mostviewedthreads || $mostviewedthreads['lastupdated'] <= time()-60*60*24) 

and replace with
if($mostviewedthreads || $mostviewedthreads['lastupdated'] <= time()-60*60*24) 

Dyers Eve