Statistics on Index

Modifications for phpBB3. Try the Mods here and share Your own Mods
There is no support here! Only Read Access!
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
User avatar
Stoker
Site Admin
Site Admin
Posts: 3540
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Statistics on Index

Post by Stoker »

Title: Statistics on Index
Version: 1.0.1
Author: Stoker
Description: Statistics on Index for phpbb3 is displaying some extra statistics on forum index.
We have statistics for user, posts, topics and attachments.
ModX: Yes
Image
AutoMod: Yes
Image
Demo: This board
Download:
Statistics_on_Index.zip
(39.2 KiB) Downloaded 581 times
Screenshot:
stats.png


Old instructions, no longer used:
[spoiler]Instructions:

Open: index.php
Find:

Code: Select all

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts	= $config['num_posts'];
$total_topics	= $config['num_topics'];
$total_users	= $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
Replace with:

Code: Select all

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts	= $config['num_posts'];
$total_topics	= $config['num_topics'];
$total_files	= $config['num_files'];
$total_users	= $config['num_users'];
$start_date  	= date("d M Y, H:i:s", $config['board_startdate'] );
$boarddays = ceil((time() - $config['board_startdate']) / 86400);

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$posts_per_year = $posts_per_day * 365;
$l_posts_per_year_s = ($posts_per_year == 0) ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
$posts_per_user = $total_posts / $total_users;
$l_posts_per_user_s = ($posts_per_user == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$posts_per_topic = $total_posts / $total_topics;
$l_posts_per_topic_s = ($posts_per_topic == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$topics_per_year = $topics_per_day * 365;
$l_topics_per_year_s = ($topics_per_year == 0) ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
$topics_per_user = $total_topics / $total_users;
$l_topics_per_user_s = ($topics_per_user == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$files_per_day = $total_files / $boarddays;
$l_files_per_day_s = ($files_per_day == 0) ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
$files_per_year = $files_per_day * 365;
$l_files_per_year_s = ($files_per_year == 0) ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
$files_per_user = $total_files / $total_users;
$l_files_per_user_s = ($files_per_day == 0) ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$users_per_year = $users_per_day * 365;
$l_users_per_year_s = ($users_per_year == 0) ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';
Find:

Code: Select all

'TOTAL_POSTS'	=> sprintf($user->lang[$l_total_post_s], $total_posts),
	'TOTAL_TOPICS'	=> sprintf($user->lang[$l_total_topic_s], $total_topics),
	'TOTAL_USERS'	=> sprintf($user->lang[$l_total_user_s], $total_users),
	'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
Replace with:

Code: Select all

'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], number_format($total_posts, 0, ',', '.')),
	 'POSTS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_day_s], $posts_per_day)),
	 'POSTS_PER_YEAR'    => sprintf($user->lang[$l_posts_per_year_s], number_format($posts_per_year, 0, ',', '.')),
	 'POSTS_PER_TOPIC'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic)),
	 'POSTS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_user_s], $posts_per_user)),
	 'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], number_format($total_topics, 0, ',', '.')),
	 'TOPICS_PER_DAY'	=> str_replace('.', ',', sprintf($user->lang[$l_topics_per_day_s], $topics_per_day)),
	 'TOPICS_PER_YEAR'	=> sprintf($user->lang[$l_topics_per_year_s], number_format($topics_per_year, 0, ',', '.')),
	 'TOPICS_PER_USER'	=> str_replace('.', ',', sprintf($user->lang[$l_topics_per_user_s], $topics_per_user)),
	 'TOTAL_FILES'    => sprintf($user->lang[$l_total_file_s], number_format($total_files, 0, ',', '.')),
	 'FILES_PER_DAY'	=> str_replace('.', ',', sprintf($user->lang[$l_files_per_day_s], $files_per_day)),
	 'FILES_PER_YEAR'    => sprintf($user->lang[$l_files_per_year_s], number_format($files_per_year, 0, ',', '.')),
	 'FILES_PER_USER'	=> str_replace('.', ',', sprintf($user->lang[$l_files_per_user_s], $files_per_user)),
	 'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], number_format($total_users, 0, ',', '.')),
	 'USERS_PER_DAY'	=> str_replace('.', ',', sprintf($user->lang[$l_users_per_day_s], $users_per_day)),
	 'USERS_PER_YEAR'    => sprintf($user->lang[$l_users_per_year_s], number_format($users_per_year, 0, ',', '.')),
	 'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
	 'START_DATE'         => $start_date,
Open: language/en/common.php
Find:

Code: Select all

?>
Before add:

Code: Select all

// BEGIN MOD more stats on index
$lang = array_merge($lang, array(
	'START_DATE'				=> 'We have been online since',
	'POSTS_PER_DAY_OTHER'	=> 'Posts per day <strong>%.2f</strong>',
	'POSTS_PER_DAY_ZERO'	=> 'Posts per day <strong>None</strong>',
	'POSTS_PER_TOPIC_OTHER'	=> 'Posts per topic <strong>%.2f</strong>',
	'POSTS_PER_YEAR_OTHER'	=> 'Posts per year <strong>%s</strong>',
	'POSTS_PER_YEAR_ZERO'	=> 'Posts per year <strong>None</strong>',
	'POSTS_PER_TOPIC_ZERO'	=> 'Posts per topic <strong>None</strong>',
	'POSTS_PER_USER_OTHER'	=> 'Posts per member <strong>%.2f</strong>',
	'POSTS_PER_USER_ZERO'	=> 'Posts per member <strong>None</strong>',
	'TOPICS_PER_DAY_OTHER'	=> 'Topics per day <strong>%.2f</strong>',
	'TOPICS_PER_DAY_ZERO'	=> 'Topics per day <strong>None</strong>',
	'TOPICS_PER_YEAR_OTHER'	=> 'Topics per year <strong>%s</strong>',
	'TOPICS_PER_YEAR_ZERO'	=> 'Topics per year <strong>None</strong>',
	'TOPICS_PER_USER_OTHER'	=> 'Topics per member <strong>%.2f</strong>',
	'TOPICS_PER_USER_ZERO'	=> 'Topics per member <strong>None</strong>',
	'USERS_PER_DAY_OTHER'	=> 'Members per day <strong>%.2f</strong>',
	'USERS_PER_DAY_ZERO'	=> 'Members per day <strong>None</strong>',
	'USERS_PER_YEAR_OTHER'	=> 'Members per year <strong>%s</strong>',
	'USERS_PER_YEAR_ZERO'	=> 'Members per year <strong>None</strong>',
	'TOTAL_POSTS_OTHER'	=> 'Total posts <strong>%s</strong>',
	'TOTAL_POSTS_ZERO'	=> 'Total posts <strong>0</strong>',
	'TOTAL_TOPICS_OTHER'=> 'Total topics <strong>%s</strong>',
	'TOTAL_TOPICS_ZERO'	=> 'Total topics <strong>0</strong>',
	'TOTAL_USERS_OTHER'	=> 'Total members <strong>%s</strong>',
	'TOTAL_USERS_ZERO'	=> 'Total members <strong>0</strong>',
	'TOTAL_FILES_OTHER'	=> 'Total attachments <strong>%s</strong>',
	'TOTAL_FILES_ZERO'	=> 'Total attachments <strong>0</strong>',
	'FILES_PER_DAY_OTHER'	=> 'Attachments per day <strong>%.2f</strong>',
	'FILES_PER_DAY_ZERO'	=> 'Attachments per day <strong>None</strong>',
	'FILES_PER_YEAR_OTHER'	=> 'Attachments per year <strong>%s</strong>',
	'FILES_PER_YEAR_ZERO'	=> 'Attachments per year <strong>None</strong>',
	'FILES_PER_USER_OTHER'	=> 'Attachments per member <strong>%.2f</strong>',
	'FILES_PER_USER_ZERO'	=> 'Attachments per member <strong>None</strong>',
));
Open: styles/prosilver/template/index_body.html
Find:

Code: Select all

<p>{TOTAL_POSTS} &bull; {TOTAL_TOPICS} &bull; {TOTAL_USERS} &bull; {NEWEST_USER}</p>
Replace with:

Code: Select all

<p>{TOTAL_POSTS} &bull; {POSTS_PER_YEAR} &bull; {POSTS_PER_DAY} &bull; {POSTS_PER_TOPIC} &bull; {POSTS_PER_USER}<br />
    {TOTAL_TOPICS} &bull; {TOPICS_PER_YEAR} &bull; {TOPICS_PER_DAY} &bull; {TOPICS_PER_USER}<br />
	{TOTAL_FILES} &bull; {FILES_PER_YEAR} &bull; {FILES_PER_DAY} &bull; {FILES_PER_USER}<br />
	{TOTAL_USERS} &bull; {USERS_PER_YEAR} &bull; {USERS_PER_DAY} &bull; {NEWEST_USER}<br />
	{L_START_DATE} <strong>{START_DATE}</strong></p>
Open: styles/subsilver2/template/index_body.html
Find:

Code: Select all

<p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {NEWEST_USER}</p>
Replace with:

Code: Select all

<p class="genmed">{TOTAL_POSTS} | {POSTS_PER_YEAR} | {POSTS_PER_DAY} | {POSTS_PER_TOPIC} | {POSTS_PER_USER}<br />
    {TOTAL_TOPICS} | {TOPICS_PER_YEAR} | {TOPICS_PER_DAY} | {TOPICS_PER_USER}<br />
	{TOTAL_FILES} | {FILES_PER_YEAR} | {FILES_PER_DAY} | {FILES_PER_USER}<br />
	{TOTAL_USERS} | {USERS_PER_YEAR} | {USERS_PER_DAY} | {NEWEST_USER}<br />
	{L_START_DATE} <b>{START_DATE}</b></p>
Save, upload and refresh template.[/spoiler]
Board rules! No PM support
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

not wokr :(
User avatar
Fire-Fox
BBCoder IV
BBCoder IV
Posts: 275
Joined: 22 Mar 2010, 13:24
Location: Denmark

Re: Statistics - Users and topics per day

Post by Fire-Fox »

It should work, what error do you get?
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

Parse error: syntax error, unexpected '}' in /home/mus/domains/muskleforum.com/public_html/cache/tpl_skyblue_index_body.html.php on line 79

Code: Select all

<h3><?php echo ((isset($this->_rootref['L_STATISTICS'])) ? $this->_rootref['L_STATISTICS'] : ((isset($user->lang['STATISTICS'])) ? $user->lang['STATISTICS'] : '{ STATISTICS }')); ?></h3>
	<p><?php echo (isset($this->_rootref['TOTAL_POSTS'])) ? $this->_rootref['TOTAL_POSTS'] : ''; ?> &bull; <?php echo (isset($this->_rootref['POSTS_PER_YEAR'])) ? $this->_rootref['POSTS_PER_YEAR'] : ''; ?> &bull; <?php echo (isset($this->_rootref['POSTS_PER_DAY'])) ? $this->_rootref['POSTS_PER_DAY'] : ''; ?> &bull; <?php echo (isset($this->_rootref['POSTS_PER_TOPIC'])) ? $this->_rootref['POSTS_PER_TOPIC'] : ''; ?> &bull; <?php echo (isset($this->_rootref['POSTS_PER_USER'])) ? $this->_rootref['POSTS_PER_USER'] : ''; ?><br />
    <?php echo (isset($this->_rootref['TOTAL_TOPICS'])) ? $this->_rootref['TOTAL_TOPICS'] : ''; ?> &bull; <?php echo (isset($this->_rootref['TOPICS_PER_YEAR'])) ? $this->_rootref['TOPICS_PER_YEAR'] : ''; ?> &bull; <?php echo (isset($this->_rootref['TOPICS_PER_DAY'])) ? $this->_rootref['TOPICS_PER_DAY'] : ''; ?> &bull; <?php echo (isset($this->_rootref['TOPICS_PER_USER'])) ? $this->_rootref['TOPICS_PER_USER'] : ''; ?><br />
   <?php echo (isset($this->_rootref['TOTAL_FILES'])) ? $this->_rootref['TOTAL_FILES'] : ''; ?> &bull; <?php echo (isset($this->_rootref['FILES_PER_YEAR'])) ? $this->_rootref['FILES_PER_YEAR'] : ''; ?> &bull; <?php echo (isset($this->_rootref['FILES_PER_DAY'])) ? $this->_rootref['FILES_PER_DAY'] : ''; ?> &bull; <?php echo (isset($this->_rootref['FILES_PER_USER'])) ? $this->_rootref['FILES_PER_USER'] : ''; ?><br />
   <?php echo (isset($this->_rootref['TOTAL_USERS'])) ? $this->_rootref['TOTAL_USERS'] : ''; ?> &bull; <?php echo (isset($this->_rootref['USERS_PER_YEAR'])) ? $this->_rootref['USERS_PER_YEAR'] : ''; ?> &bull; <?php echo (isset($this->_rootref['USERS_PER_DAY'])) ? $this->_rootref['USERS_PER_DAY'] : ''; ?> &bull; <?php echo (isset($this->_rootref['NEWEST_USER'])) ? $this->_rootref['NEWEST_USER'] : ''; ?><br />
   <?php echo ((isset($this->_rootref['L_START_DATE'])) ? $this->_rootref['L_START_DATE'] : ((isset($user->lang['START_DATE'])) ? $user->lang['START_DATE'] : '{ START_DATE }')); ?> <strong><?php echo (isset($this->_rootref['START_DATE'])) ? $this->_rootref['START_DATE'] : ''; ?></strong></p>
	<?php } } $this->_tpl_include('overall_footer.html'); ?>
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

What i do?
User avatar
Stoker
Site Admin
Site Admin
Posts: 3540
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Statistics - Users and topics per day

Post by Stoker »

Check the language file edit and index.php edit
Board rules! No PM support
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

Langue files remainder

Code: Select all

// BEGIN mChat Mod
$lang = array_merge($lang, array(
	'MCHAT'			=> 'Chat',
	'MCHAT_COPYRIGHT'	=> '&copy; <a href="http://www.phpbb3bbcodes.com/">phpBB3BBCodes.com</a>',
));
// END mChat Mod

// BEGIN MOD more stats on index
$lang = array_merge($lang, array(
   'START_DATE'            => 'We have been online since',
   'POSTS_PER_DAY_OTHER'   => 'Posts per day <strong>%.2f</strong>',
   'POSTS_PER_DAY_ZERO'   => 'Posts per day <strong>None</strong>',
   'POSTS_PER_TOPIC_OTHER'   => 'Posts per topic <strong>%.2f</strong>',
   'POSTS_PER_YEAR_OTHER'   => 'Posts per year <strong>%s</strong>',
   'POSTS_PER_YEAR_ZERO'   => 'Posts per year <strong>None</strong>',
   'POSTS_PER_TOPIC_ZERO'   => 'Posts per topic <strong>None</strong>',
   'POSTS_PER_USER_OTHER'   => 'Posts per member <strong>%.2f</strong>',
   'POSTS_PER_USER_ZERO'   => 'Posts per member <strong>None</strong>',
   'TOPICS_PER_DAY_OTHER'   => 'Topics per day <strong>%.2f</strong>',
   'TOPICS_PER_DAY_ZERO'   => 'Topics per day <strong>None</strong>',
   'TOPICS_PER_YEAR_OTHER'   => 'Topics per year <strong>%s</strong>',
   'TOPICS_PER_YEAR_ZERO'   => 'Topics per year <strong>None</strong>',
   'TOPICS_PER_USER_OTHER'   => 'Topics per member <strong>%.2f</strong>',
   'TOPICS_PER_USER_ZERO'   => 'Topics per member <strong>None</strong>',
   'USERS_PER_DAY_OTHER'   => 'Members per day <strong>%.2f</strong>',
   'USERS_PER_DAY_ZERO'   => 'Members per day <strong>None</strong>',
   'USERS_PER_YEAR_OTHER'   => 'Members per year <strong>%s</strong>',
   'USERS_PER_YEAR_ZERO'   => 'Members per year <strong>None</strong>',
   'TOTAL_POSTS_OTHER'   => 'Total posts <strong>%s</strong>',
   'TOTAL_POSTS_ZERO'   => 'Total posts <strong>0</strong>',
   'TOTAL_TOPICS_OTHER'=> 'Total topics <strong>%s</strong>',
   'TOTAL_TOPICS_ZERO'   => 'Total topics <strong>0</strong>',
   'TOTAL_USERS_OTHER'   => 'Total members <strong>%s</strong>',
   'TOTAL_USERS_ZERO'   => 'Total members <strong>0</strong>',
   'TOTAL_FILES_OTHER'   => 'Total attachments <strong>%s</strong>',
   'TOTAL_FILES_ZERO'   => 'Total attachments <strong>0</strong>',
   'FILES_PER_DAY_OTHER'   => 'Attachments per day <strong>%.2f</strong>',
   'FILES_PER_DAY_ZERO'   => 'Attachments per day <strong>None</strong>',
   'FILES_PER_YEAR_OTHER'   => 'Attachments per year <strong>%s</strong>',
   'FILES_PER_YEAR_ZERO'   => 'Attachments per year <strong>None</strong>',
   'FILES_PER_USER_OTHER'   => 'Attachments per member <strong>%.2f</strong>',
   'FILES_PER_USER_ZERO'   => 'Attachments per member <strong>None</strong>',
));?>
User avatar
Stoker
Site Admin
Site Admin
Posts: 3540
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Statistics - Users and topics per day

Post by Stoker »

Clear the cache manyually in FTP and check the index_body.html edit
Board rules! No PM support
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

What if I return to its original settings? Wipe those settings that message out?

Went to get stuck on when I made that change inde_body.html # PROG # file.
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Statistics - Users and topics per day

Post by Oliver »

index.php

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_files   = $config['num_files'];
$total_users   = $config['num_users'];
$start_date     = date("d M Y, H:i:s", $config['board_startdate'] );
$boarddays = ceil((time() - $config['board_startdate']) / 86400);

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$posts_per_year = $posts_per_day * 365;
$l_posts_per_year_s = ($posts_per_year == 0) ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
$posts_per_user = $total_posts / $total_users;
$l_posts_per_user_s = ($posts_per_user == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$posts_per_topic = $total_posts / $total_topics;
$l_posts_per_topic_s = ($posts_per_topic == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$topics_per_year = $topics_per_day * 365;
$l_topics_per_year_s = ($topics_per_year == 0) ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
$topics_per_user = $total_topics / $total_users;
$l_topics_per_user_s = ($topics_per_user == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$files_per_day = $total_files / $boarddays;
$l_files_per_day_s = ($files_per_day == 0) ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
$files_per_year = $files_per_day * 365;
$l_files_per_year_s = ($files_per_year == 0) ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
$files_per_user = $total_files / $total_users;
$l_files_per_user_s = ($files_per_day == 0) ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$users_per_year = $users_per_day * 365;
$l_users_per_year_s = ($users_per_year == 0) ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend = 1
		ORDER BY group_name ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend = 1
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
	$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

	if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
	{
		$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
	}
	else
	{
		$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
	}
}
$db->sql_freeresult($result);

$legend = implode(', ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
	$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
		FROM ' . USERS_TABLE . ' u
		LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
		WHERE (b.ban_id IS NULL
			OR b.ban_exclude = 1)
			AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
			AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		if ($age = (int) substr($row['user_birthday'], -4))
		{
			$birthday_list .= ' (' . ($now['year'] - $age) . ')';
		}
	}
	$db->sql_freeresult($result);
}

// Assign index specific vars
$template->assign_vars(array(
	'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], number_format($total_posts, 0, ',', '.')),
    'POSTS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_day_s], $posts_per_day)),
    'POSTS_PER_YEAR'    => sprintf($user->lang[$l_posts_per_year_s], number_format($posts_per_year, 0, ',', '.')),
    'POSTS_PER_TOPIC'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic)),
    'POSTS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_user_s], $posts_per_user)),
    'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], number_format($total_topics, 0, ',', '.')),
    'TOPICS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_day_s], $topics_per_day)),
    'TOPICS_PER_YEAR'   => sprintf($user->lang[$l_topics_per_year_s], number_format($topics_per_year, 0, ',', '.')),
    'TOPICS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_user_s], $topics_per_user)),
    'TOTAL_FILES'    => sprintf($user->lang[$l_total_file_s], number_format($total_files, 0, ',', '.')),
    'FILES_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_day_s], $files_per_day)),
    'FILES_PER_YEAR'    => sprintf($user->lang[$l_files_per_year_s], number_format($files_per_year, 0, ',', '.')),
    'FILES_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_user_s], $files_per_user)),
    'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], number_format($total_users, 0, ',', '.')),
    'USERS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_users_per_day_s], $users_per_day)),
    'USERS_PER_YEAR'    => sprintf($user->lang[$l_users_per_year_s], number_format($users_per_year, 0, ',', '.')),
    'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
    'START_DATE'         => $start_date,

	'LEGEND'		=> $legend,
	'BIRTHDAY_LIST'	=> $birthday_list,

	'FORUM_IMG'				=> $user->img('forum_read', 'NO_NEW_POSTS'),
	'FORUM_NEW_IMG'			=> $user->img('forum_unread', 'NEW_POSTS'),
	'FORUM_LOCKED_IMG'		=> $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
	'FORUM_NEW_LOCKED_IMG'	=> $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

	'S_LOGIN_ACTION'			=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,

	'U_MARK_FORUMS'		=> ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
	'U_MCP'				=> ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);

// BEGIN mChat Mod
if(!defined('MCHAT_INCLUDE') && $config['mchat_on_index'] && $config['mchat_enable'] && $auth->acl_get('u_mchat_view'))
{
	define('MCHAT_INCLUDE', true);
	$mchat_include_index = true;
	include($phpbb_root_path.'mchat.'.$phpEx);
}
// END mChat Mod

include($phpbb_root_path . 'includes/functions_activity_stats.' . $phpEx);
activity_mod();
// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
	'body' => 'index_body.html')
);

page_footer();

?>
Locked