Vergleich stats.php - 1.8.0 - 1.8.36

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'stats.php');


define("IN_MYBB", 1);
define('THIS_SCRIPT', 'stats.php');


$templatelist = "stats,stats_thread";


$templatelist = "stats,stats_thread,stats_topforum";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";

require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";

Zeile 20Zeile 21
// Load global language phrases
$lang->load("stats");


// Load global language phrases
$lang->load("stats");


add_breadcrumb($lang->nav_stats);


add_breadcrumb($lang->nav_stats);


$stats = $cache->read("stats");

if($stats['numthreads'] < 1 || $stats['numusers'] < 1)
{
error($lang->not_enough_info_stats);

$stats = $cache->read("stats");

if($stats['numthreads'] < 1 || $stats['numusers'] < 1)
{
error($lang->not_enough_info_stats);

}

}


if($mybb->settings['statsenabled'] != 1)
{


if($mybb->settings['statsenabled'] != 1)
{

Zeile 56Zeile 57
// Get forum permissions
$unviewableforums = get_unviewable_forums(true);
$inactiveforums = get_inactive_forums();

// Get forum permissions
$unviewableforums = get_unviewable_forums(true);
$inactiveforums = get_inactive_forums();

$fidnot = '1=1 AND ';
$unviewableforumsarray = array();


$unviewablefids = $inactivefids = array();
$fidnot = '';


if($unviewableforums)

if($unviewableforums)

{
$fidnot .= "fid NOT IN ($unviewableforums) AND ";
$unviewableforumsfids = explode(',', str_replace("'", '', $unviewableforums));
foreach($unviewableforumsfids as $fid)
{
$unviewableforumsarray[] = (int)$fid;
}
}

{
$fidnot .= "AND fid NOT IN ($unviewableforums)";
$unviewablefids = explode(',', $unviewableforums);
}





if($inactiveforums)
{

if($inactiveforums)
{

	$fidnot .= "fid NOT IN ($inactiveforums) AND ";
$unviewableforumsfids = explode(',', $inactiveforums);
foreach($unviewableforumsfids as $fid)










	$fidnot .= "AND fid NOT IN ($inactiveforums)";
$inactivefids = explode(',', $inactiveforums);
}

$unviewableforumsarray = array_merge($unviewablefids, $inactivefids);

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
$onlyusfids = array();
foreach($group_permissions as $gpfid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)

	{

	{

		$unviewableforumsarray[] = (int)$fid;

		$onlyusfids[] = $gpfid;

	}
}


	}
}


Zeile 91Zeile 98
{
foreach($most_replied as $key => $thread)
{

{
foreach($most_replied as $key => $thread)
{

		if(!in_array($thread['fid'], $unviewableforumsarray))




		if(
!in_array($thread['fid'], $unviewableforumsarray) &&
(!in_array($thread['fid'], $onlyusfids) || ($mybb->user['uid'] && $thread['uid'] == $mybb->user['uid']))
)

		{
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$numberbit = my_number_format($thread['replies']);
$numbertype = $lang->replies;
$thread['threadlink'] = get_thread_link($thread['tid']);
eval("\$mostreplies .= \"".$templates->get("stats_thread")."\";");

		{
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$numberbit = my_number_format($thread['replies']);
$numbertype = $lang->replies;
$thread['threadlink'] = get_thread_link($thread['tid']);
eval("\$mostreplies .= \"".$templates->get("stats_thread")."\";");

		}
}
}

		}
}
}


// Most viewed threads
$most_viewed = $cache->read("most_viewed_threads");


// Most viewed threads
$most_viewed = $cache->read("most_viewed_threads");

Zeile 116Zeile 126
{
foreach($most_viewed as $key => $thread)
{

{
foreach($most_viewed as $key => $thread)
{

		if(!in_array($thread['fid'], $unviewableforumsarray))




		if(
!in_array($thread['fid'], $unviewableforumsarray) &&
(!in_array($thread['fid'], $onlyusfids) || ($mybb->user['uid'] && $thread['uid'] == $mybb->user['uid']))
)

		{
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$numberbit = my_number_format($thread['views']);

		{
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$numberbit = my_number_format($thread['views']);

Zeile 129Zeile 142

$statistics = $cache->read('statistics');
$mybb->settings['statscachetime'] = (int)$mybb->settings['statscachetime'];


$statistics = $cache->read('statistics');
$mybb->settings['statscachetime'] = (int)$mybb->settings['statscachetime'];

 


if($mybb->settings['statscachetime'] < 1)
{
$mybb->settings['statscachetime'] = 0;

if($mybb->settings['statscachetime'] < 1)
{
$mybb->settings['statscachetime'] = 0;

}
$interval = (int)$mybb->settings['statscachetime']*60860;

if(!$statistics || TIME_NOW-$interval > $statistics['time'] || $mybb->settings['statscachetime'] == 0)
{


}

$interval = $mybb->settings['statscachetime']*3600;

if(!$statistics || $interval == 0 || TIME_NOW - $interval > $statistics['time'])
{

	$cache->update_statistics();
$statistics = $cache->read('statistics');

	$cache->update_statistics();
$statistics = $cache->read('statistics');

}


}


// Top forum

// Top forum

if(!isset($statistics['top_forum']['posts']))
{




$query = $db->simple_select('forums', 'fid, name, threads, posts', "type='f'$fidnot", array('order_by' => 'posts', 'order_dir' => 'DESC', 'limit' => 1));
$forum = $db->fetch_array($query);

if(empty($forum['fid']))
{

	$topforum = $lang->none;
$topforumposts = $lang->no;
$topforumthreads = $lang->no;
}
else
{

	$topforum = $lang->none;
$topforumposts = $lang->no;
$topforumthreads = $lang->no;
}
else
{

	$forum = $forum_cache[(int)$statistics['top_forum']['fid']];

$topforum = "<a href=\"".get_forum_link($forum['fid'])."\">{$forum['name']}</a>";
$topforumposts = (int)$statistics['top_forum']['posts'];
$topforumthreads = (int)$statistics['top_forum']['threads'];

	$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));
$forum['link'] = get_forum_link($forum['fid']);
eval("\$topforum = \"".$templates->get("stats_topforum")."\";");
$topforumposts = $forum['posts'];
$topforumthreads = $forum['threads'];

}

// Top referrer defined for the templates even if we don't use it

}

// Top referrer defined for the templates even if we don't use it

Zeile 164Zeile 182
	// Only show this if we have anything more the 0 referrals
if($statistics['top_referrer']['referrals'] > 0)
{

	// Only show this if we have anything more the 0 referrals
if($statistics['top_referrer']['referrals'] > 0)
{

		$toprefuser = build_profile_link($statistics['top_referrer']['username'], $statistics['top_referrer']['uid']);

		$toprefuser = build_profile_link(htmlspecialchars_uni($statistics['top_referrer']['username']), $statistics['top_referrer']['uid']);

		$top_referrer = $lang->sprintf($lang->top_referrer, $toprefuser, my_number_format($statistics['top_referrer']['referrals']));
}
}

		$top_referrer = $lang->sprintf($lang->top_referrer, $toprefuser, my_number_format($statistics['top_referrer']['referrals']));
}
}

Zeile 183Zeile 201
	}
else
{

	}
else
{

		$topposter = build_profile_link($statistics['top_poster']['username'], $statistics['top_poster']['uid']);

		$topposter = build_profile_link(htmlspecialchars_uni($statistics['top_poster']['username']), $statistics['top_poster']['uid']);

	}

$topposterposts = $statistics['top_poster']['poststoday'];

	}

$topposterposts = $statistics['top_poster']['poststoday'];