[addon]edited stats page

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
enzo250gto
Registered User
Posts: 100
Joined: Tue Nov 27, 2001 4:14 am

[addon]edited stats page

Post by enzo250gto »

I've been editing the statistics.php file that is offered on this site. Some of the things I've included are:
multilanguage support (just need to add on line into the statistics.php file to do so).
I'm also working on attachment stats. This I need help on. Please visit this link http://www.ferrariforum.net/forum/statistics.php

At the bottom my Top Attaching Users is displaying but I cannot get it to order desc by # of attachments. Can someone help me? I'm using AcydBurns code. The problem is the array or drop down sort list that is in the file. I cannot figure out how to change the sort method and the query statement is a bit confusing to me. Here is what I have in my statistics.php file for that section:

Code: Select all

$sql = "SELECT u.username, u.user_id, count(*) as total_attachments, sum(a.filesize) as total_size
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id, u.username " . 
	$order_by;

	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't query attachments", "", __LINE__, __FILE__, $sql);
	}

	if( ( $db->sql_numrows($result) ) > 0 )
	{
		$members = $db->sql_fetchrowset($result);

		for ($i = 0; $i < count($members); $i++)
		{
			$username = $members[$i]['username'];
			$total_attachments = $members[$i]['total_attachments'];
			$total_size = $members[$i]['total_size'];

			$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$template->assign_block_vars("memberrow", array(
				"ROW_NUMBER" => $i + ( $HTTP_GET_VARS['start'] + 1 ),
				"ROW_COLOR" => "#" . $row_color,
				"ROW_CLASS" => $row_class,
				"USERNAME" => $username,
				"TOTAL_ATTACHMENTS" => $total_attachments,
				"TOTAL_SIZE" => intval($total_size/1024),
				"U_VIEW_MEMBER" => append_sid("admin_attach_cp.$phpEx?view=attachments&uid=" . $members[$i]['user_id']))
			);
		}
	}

	$sql = "SELECT u.user_id
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Error getting total users.", "", __LINE__, __FILE__, $sql);
	}

	$total_rows = $db->sql_numrows($result);

totoelectro
Registered User
Posts: 358
Joined: Tue Dec 11, 2001 8:47 am
Location: Nimes (South of France)
Contact:

Post by totoelectro »

how include this in statistics.php ???

enzo250gto
Registered User
Posts: 100
Joined: Tue Nov 27, 2001 4:14 am

entire code

Post by enzo250gto »

Here is the entire code on the page. I just need to figure out how to sort the top attaching users in a descending order and to show only the top 10
Also how do I get the total directory size of attachments to show? Its coming up as "Not available."

Code: Select all

<?php
		/***************************************************************************
		                             statistics.php
		                             -------------------
		    begin                : Tue February 26 2002
		    copyright            : (C) 2002 Nivisec.com
		    email                : admin@nivisec.com
		
		    $Id: statistics.php,v 1.2.1 2002/04/18 02:43:12 nivisec Exp $
		
		 ***************************************************************************/
		
		/***************************************************************************
		 *                                         				                                
		 *   This program is free software; you can redistribute it and/or modify  	
		 *   it under the terms of the GNU General Public License as published by  
		 *   the Free Software Foundation; either version 2 of the License, or	    	
		 *   (at your option) any later version.
		 *
		 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
//Start user modifiable variables
//
$return_limit = 10;
//Vote Images based on the theme path, (i.e. templates/CURRNT_THEME/ is already inserted)
$vote_left = "images/vote_lcap.gif";
$vote_right = "images/vote_rcap.gif";
$vote_bar = "images/voting_bar.gif";
//
//End user modifiable variables
//

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);
init_userprefs($userdata);
//
// End session management
//

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_statistics.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main_attach.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_attach.' . $phpEx);

// Do the math :) (i think this is the same method as in philip mayer's statistic's file)
// Taken from Acyd Burn.
function do_math($firstval, $value, $total, &$percentage, &$bar_percent)
{
	$cst = ($firstval > 0) ? 90 / $firstval : 90;

	if ( $value != 0  )
	{
		$percentage = ( $total ) ? round( min(100, ($value / $total) * 100)) : 0;
	}
	else
	{
		$percentage = 0;
	}

	$bar_percent = round($value * $cst);
}

$template->set_filenames(array(
"body" => "statistics.tpl")
);

$template->assign_vars(array(
"GRAPH_IMAGE" => $graph_image,

"L_ADMIN_STATISTICS" => $lang['Admin_Stats'],

"L_MOST_ACTIVE" => $lang['Most_Active_Topics'],
"L_MOST_VIEWED" => $lang['Most_Viewed_Topics'],
"L_TOP_POSTERS" => $lang['Top_Posting_Users'],

"L_USES" => $lang['Uses'],
"L_RANK" => $lang['Rank'],
"L_PERCENTAGE" => $lang['Percent'],
"L_GRAPH" => $lang['Graph'],
"L_REPLIES" => $lang['Replies'],
"L_TOPIC" => $lang['Topic'],
"L_VIEWS" => $lang['Views'],
"L_USERNAME" => $lang['Username'],
"L_POSTS" => $lang['Posts'],
"L_STATISTIC" => $lang['Statistic'],
"L_VALUE" => $lang['Value'],
"L_ATTACH" => $lang['Attach_a'],
"L_ATTACH_US" => $lang['Attach_us'],
"PAGE_NAME" => $lang['Statistics'])
);

//
// Authorization SQL
//
$auth_data_sql = "";
$sql = "SELECT forum_id
FROM " . FORUMS_TABLE;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve forum_id data", "", __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result)) {
	$is_auth = auth('auth_view', $row['forum_id'], $userdata);
	if ($is_auth['auth_view'])
	{
		$auth_data_sql .= ( $auth_data_sql != "") ? ", " . $row['forum_id'] : $row['forum_id'];
	}
}

//
// Getting voting bar info from template
//
if( !$board_config['override_user_style'] )
{
	if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
	{
		$style = $userdata['user_style'];
		if( !$theme )
		$style =  $board_config['default_style'];
	}
	else
	$style =  $board_config['default_style'];
}
else
$style =  $board_config['default_style'];

$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";

if(!$result = $db->sql_query($sql))
{
	message_die(CRITICAL_ERROR, "Couldn't query database for theme info.");
}
if( !$row = $db->sql_fetchrow($result) )
{
	message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style.");
}

$template_path = 'templates/' ;
$template_name = $row['template_name'] ;

$current_template_path = $template_path . $template_name . '/';

$template->assign_vars(array(
"LEFT_GRAPH_IMAGE" => $current_template_path . $vote_left,
"RIGHT_GRAPH_IMAGE" => $current_template_path . $vote_right,
"GRAPH_IMAGE" => $current_template_path . $vote_bar)
);

//
// Top posters SQL
//
$sql = "SELECT user_id, username, user_posts
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
AND user_posts > 0
ORDER BY user_posts DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}

$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result);
$percentage = 0;
$bar_percent = 0;

$firstcount = $user_data[0]['user_posts'];

for ($i = 0; $i < $user_count; $i++)
{
	do_math($firstcount, $user_data[$i]['user_posts'], get_db_stat('postcount'), $percentage, $bar_percent);

	$template->assign_block_vars("users", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"USERNAME" => $user_data[$i]['username'],
	"PERCENTAGE" => $percentage,
	"BAR" => $bar_percent,
	"URL" => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $user_data[$i]['user_id'],
	"POSTS" => $user_data[$i]['user_posts'])
	);
}

//
// Most active topics SQL
//
$sql = "SELECT topic_id, topic_title, topic_replies
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_replies > 0
ORDER BY topic_replies DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
	$template->assign_block_vars("topicreplies", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"TITLE" => $topic_data[$i]['topic_title'],
	"REPLIES" => $topic_data[$i]['topic_replies'],
	"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
	);
}

//
// Most viewed topics SQL
//
$rank = 0;
$sql = "SELECT topic_id, topic_title, topic_views
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_views > 0
ORDER BY topic_views DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
	$template->assign_block_vars("topicviews", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"TITLE" => $topic_data[$i]['topic_title'],
	"VIEWS" => $topic_data[$i]['topic_views'],
	"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
	);
}

//
// Get forum statistics (taken from admin panel)
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');

$start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);

$boarddays = ( time() - $board_config['board_startdate'] ) / 86400;

$posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
$topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
$users_per_day = sprintf("%.2f", $total_users / $boarddays);

$avatar_dir_size = 0;

if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
{
	while( $file = @readdir($avatar_dir) )
	{
		if( $file != "." && $file != ".." )
		{
			$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
		}
	}
	@closedir($avatar_dir);

	//
	// This bit of code translates the avatar directory size into human readable format
	// Borrowed the code from the PHP.net annoted manual, origanally written by:
	// Jesse (jesse@jess.on.ca)
	//
	if($avatar_dir_size >= 1048576)
	{
		$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
	}
	else if($avatar_dir_size >= 1024)
	{
		$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
	}
	else
	{
		$avatar_dir_size = $avatar_dir_size . " Bytes";
	}

}
else
{
	// Couldn't open Avatar dir.
	$avatar_dir_size = $lang['Not_available'];
}

if($posts_per_day > $total_posts)
{
	$posts_per_day = $total_posts;
}

if($topics_per_day > $total_topics)
{
	$topics_per_day = $total_topics;
}

if($users_per_day > $total_users)
{
	$users_per_day = $total_users;
}

//
// DB size ... MySQL only
//
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
//
if( preg_match("/^mysql/", SQL_LAYER) )
{
	$sql = "SELECT VERSION() AS mysql_version";
	if($result = $db->sql_query($sql))
	{
		$row = $db->sql_fetchrow($result);
		$version = $row['mysql_version'];

		if( preg_match("/^(3\.23|4\.)/", $version) )
		{
			$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname;

			$sql = "SHOW TABLE STATUS
			FROM " . $db_name;
			if($result = $db->sql_query($sql))
			{
				$tabledata_ary = $db->sql_fetchrowset($result);

				$dbsize = 0;
				for($i = 0; $i < count($tabledata_ary); $i++)
				{
					if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" )
					{
						if( $table_prefix != "" )
						{
							if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
							{
								$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
							}
						}
						else
						{
							$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
						}
					}
				}

				if( $dbsize >= 1048576 )
				{
					$dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
				}
				else if( $dbsize >= 1024 )
				{
					$dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
				}
				else
				{
					$dbsize = sprintf("%.2f Bytes", $dbsize);
				}
			} // Else we couldn't get the table status.
		}
		else
		{
			$dbsize = $lang['Not_available'];
		}
	}
	else
	{
		$dbsize = $lang['Not_available'];
	}
}
else
{
	$dbsize = $lang['Not_available'];
}

//
//Newest user data
//
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
$sql = "SELECT user_regdate
FROM " . USERS_TABLE . "
WHERE user_id = " . $newest_userdata['user_id'] . "
LIMIT 1";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$newest_user_date = $row['user_regdate'];

//
//Most Online data
//
$sql = "SELECT *
FROM " . CONFIG_TABLE . "
WHERE config_name = 'record_online_users'
OR config_name = 'record_online_date'";

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve configuration data", "", __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);
$most_users_date = ($row['config_value'] > 0) ? create_date($board_config['default_dateformat'], $row['config_value'], $board_config['board_timezone']) : $most_users_date = $lang['Not_available'];

$row = $db->sql_fetchrow($result);
$most_users = ($row['config_value'] > 0) ? $row['config_value'] : $lang['Not_available'];

$statistic_array = array($lang['Number_posts'],$lang['Posts_per_day'],$lang['Number_topics'],$lang['Topics_per_day'],$lang['Number_users'],$lang['Users_per_day'],$lang['Board_started'],$lang['Board_Up_Days'],$lang['Database_size'],$lang['Avatar_dir_size'],$lang['Latest_Reg_User_Date'],$lang['Latest_Reg_User'],$lang['Most_Ever_Online_Date'],$lang['Most_Ever_Online'],$lang['Gzip_compression']);
$value_array = array($total_posts, $posts_per_day, $total_topics, $topics_per_day, $total_users, $users_per_day, $start_date, sprintf('%.2f', $boarddays), $dbsize, $avatar_dir_size, create_date($board_config['default_dateformat'], $newest_user_date, $board_config['board_timezone']), sprintf('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">' . $newest_user . '</a>'), $most_users_date, $most_users, ( $board_config['gzip_compress'] ) ? $lang['Enabled'] : $lang['Disabled']);

for ($i = 0; $i < count($statistic_array); $i += 2)
{
	$template->assign_block_vars("adminrow", array(
	"STATISTIC" => $statistic_array[$i],
	"VALUE" => $value_array[$i],
	"STATISTIC2" => (isset($statistic_array[$i+1])) ? $statistic_array[$i + 1] : "",
	"VALUE2" => (isset($value_array[$i+1])) ? $value_array[$i + 1] : "")
	);
}

//
// Statistics
//




$upload_dir_size = 0;

	if ($dirname = @opendir($upload_dir))
	{
		while( $file = @readdir($dirname) )
		{
			if( $file != "." && $file != ".." )
			{
				$upload_dir_size += @filesize($upload_dir . "/" . $file);
			}
		}
		@closedir($dirname);

		if($upload_dir_size >= 1048576)
		{
			$upload_dir_size = round($upload_dir_size / 1048576 * 100) / 100 . " " . $lang['MB'];
			
		}
		else if($upload_dir_size >= 1024)
		{
			$upload_dir_size = round($upload_dir_size / 1024 * 100) / 100 . " " . $lang['KB'];
			
		}
		else
		{
			$upload_dir_size = $upload_dir_size . " " . $lang['Bytes'];
			
		}

	}
	else
	{
		$upload_dir_size = $lang['Not_available'];
	}

	$sql = "SELECT count(*) AS total
	FROM " . ATTACH_DESC_TABLE;

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total attachments.", "", __LINE__, __FILE__, $sql);
	}

	$total = $db->sql_fetchrow($result);
	$number_of_attachments = $total['total'];

	$sql = "SELECT post_id
	FROM " . ATTACH_DESC_TABLE . "
	GROUP BY post_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total posts.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_posts = $db->sql_numrows($result);

	$sql = "SELECT p.topic_id
	FROM " . ATTACH_DESC_TABLE . " a, " . POSTS_TABLE . " p
	WHERE a.post_id = p.post_id
	GROUP BY p.topic_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total topics.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_topics = $db->sql_numrows($result);

	$sql = "SELECT u.user_id
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total users.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_users = $db->sql_numrows($result);

	$template->assign_vars(array(
		"L_STATISTIC" => $lang['Statistic'],
		"L_VALUE" => $lang['Value'],
		"L_NUMBER_OF_ATTACHMENTS" => $lang['Number_of_attachments'],
		"L_TOTAL_FILESIZE" => $lang['Total_filesize'],
		"L_ATTACH_QUOTA" => $lang['Attach_quota'],
		"L_NUMBER_OF_POSTS" => $lang['Number_posts_attach'],
		"L_NUMBER_OF_TOPICS" => $lang['Number_topics_attach'],
		"L_NUMBER_OF_USERS" => $lang['Number_users_attach'],
		
		"TOTAL_FILESIZE" => $upload_dir_size,
		"ATTACH_QUOTA" => $attachment_quota,
		"NUMBER_OF_ATTACHMENTS" => $number_of_attachments,
		"NUMBER_OF_POSTS" => $number_of_posts,
		"NUMBER_OF_TOPICS" => $number_of_topics,
		"NUMBER_OF_USERS" => $number_of_users)
	);


//
// Username
//



	$sql = "SELECT u.username, u.user_id, count(*) as total_attachments, sum(a.filesize) as total_size
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id, u.username " . 
	$order_by;

	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't query attachments", "", __LINE__, __FILE__, $sql);
	}

	if( ( $db->sql_numrows($result) ) > 0 )
	{
		$members = $db->sql_fetchrowset($result);

		for ($i = 0; $i < count($members); $i++)
		{
			$username = $members[$i]['username'];
			$total_attachments = $members[$i]['total_attachments'];
			$total_size = $members[$i]['total_size'];

			$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$template->assign_block_vars("memberrow", array(
				"ROW_NUMBER" => $i + ( $HTTP_GET_VARS['start'] + 1 ),
				"ROW_COLOR" => "#" . $row_color,
				"ROW_CLASS" => $row_class,
				"USERNAME" => $username,
				"TOTAL_ATTACHMENTS" => $total_attachments,
				"TOTAL_SIZE" => intval($total_size/1024),
				"U_VIEW_MEMBER" => append_sid("admin_attach_cp.$phpEx?view=attachments&uid=" . $members[$i]['user_id']))
			);
		}
	}

	$sql = "SELECT u.user_id
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Error getting total users.", "", __LINE__, __FILE__, $sql);
	}

	$total_rows = $db->sql_numrows($result);


//
// End forum statistics
//

//
//Output the page
//
$page_title = $lang['Statistics'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->pparse("body");

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

totoelectro
Registered User
Posts: 358
Joined: Tue Dec 11, 2001 8:47 am
Location: Nimes (South of France)
Contact:

Post by totoelectro »

my statisitcs.php is different !! he include TOP SMILIES

and your statistics.php give an error !!!

my statistics.php

Code: Select all

<?php
/**********************************************************************************
########################################################
## Mod Title:   Statistics
## Mod Version: 1.2.1
## Author:       Billy Sauls < nivisec@hotmail.com >
########################################################
**********************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
//Start user modifiable variables
//
$return_limit = 10;
//Vote Images based on the theme path, (i.e. templates/CURRNT_THEME/ is already inserted)
$vote_left = "images/vote_lcap.gif";
$vote_right = "images/vote_rcap.gif";
$vote_bar = "images/voting_bar.gif";
//
//End user modifiable variables
//

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);
init_userprefs($userdata);
//
// End session management
//

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_statistics.' . $phpEx);

// Do the math :) (i think this is the same method as in philip mayer's statistic's file)
// Taken from Acyd Burn.
function do_math($firstval, $value, $total, &$percentage, &$bar_percent)
{
	$cst = ($firstval > 0) ? 90 / $firstval : 90;

	if ( $value != 0  )
	{
		$percentage = ( $total ) ? round( min(100, ($value / $total) * 100)) : 0;
	}
	else
	{
		$percentage = 0;
	}

	$bar_percent = round($value * $cst);
}

$template->set_filenames(array(
"body" => "statistics.tpl")
);

$template->assign_vars(array(
"GRAPH_IMAGE" => $graph_image,

"L_ADMIN_STATISTICS" => $lang['Admin_Stats'],
"L_TOP_SMILIES" => $lang['Top_Smilies'],
"L_MOST_ACTIVE" => $lang['Most_Active_Topics'],
"L_MOST_VIEWED" => $lang['Most_Viewed_Topics'],
"L_TOP_POSTERS" => $lang['Top_Posting_Users'],

"L_USES" => $lang['Uses'],
"L_RANK" => $lang['Rank'],
"L_PERCENTAGE" => $lang['Percent'],
"L_GRAPH" => $lang['Graph'],
"L_REPLIES" => $lang['Replies'],
"L_TOPIC" => $lang['Topic'],
"L_VIEWS" => $lang['Views'],
"L_USERNAME" => $lang['Username'],
"L_POSTS" => $lang['Posts'],
"L_STATISTIC" => $lang['Statistic'],
"L_VALUE" => $lang['Value'],
"L_IMAGE" => $lang['smiley_url'],
"L_CODE" => $lang['smiley_code'],
"PAGE_NAME" => $lang['Statistics'])
);

//
// Authorization SQL
//
$auth_data_sql = "";
$sql = "SELECT forum_id
FROM " . FORUMS_TABLE;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve forum_id data", "", __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result)) {
	$is_auth = auth('auth_view', $row['forum_id'], $userdata);
	if ($is_auth['auth_view'])
	{
		$auth_data_sql .= ( $auth_data_sql != "") ? ", " . $row['forum_id'] : $row['forum_id'];
	}
}

//
// Getting voting bar info from template
//
if( !$board_config['override_user_style'] )
{
	if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
	{
		$style = $userdata['user_style'];
		if( !$theme )
		$style =  $board_config['default_style'];
	}
	else
	$style =  $board_config['default_style'];
}
else
$style =  $board_config['default_style'];

$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";

if(!$result = $db->sql_query($sql))
{
	message_die(CRITICAL_ERROR, "Couldn't query database for theme info.");
}
if( !$row = $db->sql_fetchrow($result) )
{
	message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style.");
}

$template_path = 'templates/' ;
$template_name = $row['template_name'] ;

$current_template_path = $template_path . $template_name . '/';

$template->assign_vars(array(
"LEFT_GRAPH_IMAGE" => $current_template_path . $vote_left,
"RIGHT_GRAPH_IMAGE" => $current_template_path . $vote_right,
"GRAPH_IMAGE" => $current_template_path . $vote_bar)
);

//
// Top posters SQL
//
$sql = "SELECT user_id, username, user_posts
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
AND user_posts > 0
ORDER BY user_posts DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}

$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result);
$percentage = 0;
$bar_percent = 0;

$firstcount = $user_data[0]['user_posts'];

for ($i = 0; $i < $user_count; $i++)
{
	do_math($firstcount, $user_data[$i]['user_posts'], get_db_stat('postcount'), $percentage, $bar_percent);

	$template->assign_block_vars("users", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"USERNAME" => $user_data[$i]['username'],
	"PERCENTAGE" => $percentage,
	"BAR" => $bar_percent,
	"URL" => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $user_data[$i]['user_id'],
	"POSTS" => $user_data[$i]['user_posts'])
	);
}

//
// Most active topics SQL
//
$sql = "SELECT topic_id, topic_title, topic_replies
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_replies > 0
ORDER BY topic_replies DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
	$template->assign_block_vars("topicreplies", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"TITLE" => $topic_data[$i]['topic_title'],
	"REPLIES" => $topic_data[$i]['topic_replies'],
	"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
	);
}

//
// Most viewed topics SQL
//
$rank = 0;
$sql = "SELECT topic_id, topic_title, topic_views
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_views > 0
ORDER BY topic_views DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
	$template->assign_block_vars("topicviews", array(
	"RANK" => $i+1,
	"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
	"TITLE" => $topic_data[$i]['topic_title'],
	"VIEWS" => $topic_data[$i]['topic_views'],
	"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
	);
}

//
// Get forum statistics (taken from admin panel)
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');

$start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);

$boarddays = ( time() - $board_config['board_startdate'] ) / 86400;

$posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
$topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
$users_per_day = sprintf("%.2f", $total_users / $boarddays);

$avatar_dir_size = 0;

if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
{
	while( $file = @readdir($avatar_dir) )
	{
		if( $file != "." && $file != ".." )
		{
			$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
		}
	}
	@closedir($avatar_dir);

	//
	// This bit of code translates the avatar directory size into human readable format
	// Borrowed the code from the PHP.net annoted manual, origanally written by:
	// Jesse (jesse@jess.on.ca)
	//
	if($avatar_dir_size >= 1048576)
	{
		$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
	}
	else if($avatar_dir_size >= 1024)
	{
		$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
	}
	else
	{
		$avatar_dir_size = $avatar_dir_size . " Bytes";
	}

}
else
{
	// Couldn't open Avatar dir.
	$avatar_dir_size = $lang['Not_available'];
}

if($posts_per_day > $total_posts)
{
	$posts_per_day = $total_posts;
}

if($topics_per_day > $total_topics)
{
	$topics_per_day = $total_topics;
}

if($users_per_day > $total_users)
{
	$users_per_day = $total_users;
}

//
// DB size ... MySQL only
//
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
//
if( preg_match("/^mysql/", SQL_LAYER) )
{
	$sql = "SELECT VERSION() AS mysql_version";
	if($result = $db->sql_query($sql))
	{
		$row = $db->sql_fetchrow($result);
		$version = $row['mysql_version'];

		if( preg_match("/^(3\.23|4\.)/", $version) )
		{
			$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname;

			$sql = "SHOW TABLE STATUS
			FROM " . $db_name;
			if($result = $db->sql_query($sql))
			{
				$tabledata_ary = $db->sql_fetchrowset($result);

				$dbsize = 0;
				for($i = 0; $i < count($tabledata_ary); $i++)
				{
					if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" )
					{
						if( $table_prefix != "" )
						{
							if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
							{
								$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
							}
						}
						else
						{
							$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
						}
					}
				}

				if( $dbsize >= 1048576 )
				{
					$dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
				}
				else if( $dbsize >= 1024 )
				{
					$dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
				}
				else
				{
					$dbsize = sprintf("%.2f Bytes", $dbsize);
				}
			} // Else we couldn't get the table status.
		}
		else
		{
			$dbsize = $lang['Not_available'];
		}
	}
	else
	{
		$dbsize = $lang['Not_available'];
	}
}
else
{
	$dbsize = $lang['Not_available'];
}

//
//Newest user data
//
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
$sql = "SELECT user_regdate
FROM " . USERS_TABLE . "
WHERE user_id = " . $newest_userdata['user_id'] . "
LIMIT 1";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$newest_user_date = $row['user_regdate'];

//
//Most Online data
//
$sql = "SELECT *
FROM " . CONFIG_TABLE . "
WHERE config_name = 'record_online_users'
OR config_name = 'record_online_date'";

if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve configuration data", "", __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);
$most_users_date = ($row['config_value'] > 0) ? create_date($board_config['default_dateformat'], $row['config_value'], $board_config['board_timezone']) : $most_users_date = $lang['Not_available'];

$row = $db->sql_fetchrow($result);
$most_users = ($row['config_value'] > 0) ? $row['config_value'] : $lang['Not_available'];

$statistic_array = array($lang['Number_posts'],$lang['Posts_per_day'],$lang['Number_topics'],$lang['Topics_per_day'],$lang['Number_users'],$lang['Users_per_day'],$lang['Board_started'],$lang['Board_Up_Days'],$lang['Database_size'],$lang['Avatar_dir_size'],$lang['Latest_Reg_User_Date'],$lang['Latest_Reg_User'],$lang['Most_Ever_Online_Date'],$lang['Most_Ever_Online'],$lang['Gzip_compression']);
$value_array = array($total_posts, $posts_per_day, $total_topics, $topics_per_day, $total_users, $users_per_day, $start_date, sprintf('%.2f', $boarddays), $dbsize, $avatar_dir_size, create_date($board_config['default_dateformat'], $newest_user_date, $board_config['board_timezone']), sprintf('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">' . $newest_user . '</a>'), $most_users_date, $most_users, ( $board_config['gzip_compress'] ) ? $lang['Enabled'] : $lang['Disabled']);

for ($i = 0; $i < count($statistic_array); $i += 2)
{
	$template->assign_block_vars("adminrow", array(
	"STATISTIC" => $statistic_array[$i],
	"VALUE" => $value_array[$i],
	"STATISTIC2" => (isset($statistic_array[$i+1])) ? $statistic_array[$i + 1] : "",
	"VALUE2" => (isset($value_array[$i+1])) ? $value_array[$i + 1] : "")
	);
}
//
// End forum statistics
//

//
// Most used smilies
//
$sql = "SELECT SUM(smile_stat) as total
FROM " . SMILIES_TABLE;
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve smilie data", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_post_perc = $row['total'];

$sql = "SELECT code, smile_url, smile_stat
FROM " . SMILIES_TABLE . "
WHERE smile_stat > 0
ORDER BY smile_stat DESC
LIMIT " . $return_limit;


if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't retrieve smilie data", "", __LINE__, __FILE__, $sql);
}

$smilie_data = $db->sql_fetchrowset($result);
$top_perc = $smilie_data[0]['smile_stat'];

if ($top_perc)
{
	for ($i = 0; $i < count($smilie_data); $i++)
	{
		do_math($top_perc, $smilie_data[$i]['smile_stat'], $total_post_perc, $percentage, $bar_percent);

		$template->assign_block_vars("topsmilies", array(
		"RANK" => $i+1,
		"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
		"CODE" => $smilie_data[$i]['code'],
		"USES" => $smilie_data[$i]['smile_stat'],
		"PERCENTAGE" => $percentage,
		"BAR" => $bar_percent,
		"URL" => '<img src="'. $board_config['smilies_path'] . '/' . $smilie_data[$i]['smile_url'] . '" alt="' . $smilie_data[$i]['smile_url'] . '" border="0">')
		);
	}
}
//
//Output the page
//
$page_title = $lang['Statistics'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->pparse("body");

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

how make this attacment include ????

enzo250gto
Registered User
Posts: 100
Joined: Tue Nov 27, 2001 4:14 am

stats feature

Post by enzo250gto »

The reason mine does not have the smiles is because I did not want to alter my posting.php file which must be done for this to work. My stats page works fine for my computer. Try this link http://www.ferrariforum.net/forum/statistics.php

The reason you will get errors when using my file is because I altered the language files. The stats mod on here does not use the lang files to its full extent so I added some lines for multi-language support.

If you want to add the attachment stats you will need to do the following.
Add this to statistics.tpl

Code: Select all

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">
  <tr> 
          <td class="catHead" align="center" colspan="3" height="28"> <span class="cattitle">{L_ATTACH}</span> 
          </td> 
  </tr>
  <tr> 
	<th width="50%" nowrap="nowrap" height="25" class="thCornerL">{L_STATISTIC}</th>
	<th width="50%" height="25" class="thCornerR">{L_VALUE}</th>
  </tr>
  <tr> 
	<td class="row1" nowrap="nowrap">{L_NUMBER_OF_ATTACHMENTS}:</td>
	<td class="row2"><b>{NUMBER_OF_ATTACHMENTS}</b></td>
  </tr>
  <tr> 
	<td class="row1" nowrap="nowrap">{L_TOTAL_FILESIZE}:</td>
	<td class="row2"><b>{TOTAL_FILESIZE}</b></td>
  </tr>
  <tr> 
	<td class="row1" nowrap="nowrap">{L_NUMBER_OF_POSTS}:</td>
	<td class="row2"><b>{NUMBER_OF_POSTS}</b></td>
  </tr>
  <tr> 
	<td class="row1" nowrap="nowrap">{L_NUMBER_OF_TOPICS}:</td>
	<td class="row2"><b>{NUMBER_OF_TOPICS}</b></td>
  </tr>
  <tr> 
	<td class="row1" nowrap="nowrap">{L_NUMBER_OF_USERS}:</td>
	<td class="row2"><b>{NUMBER_OF_USERS}</b></td>
  </tr>
</table>
<br>

<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
	<tr> 
          <td class="catHead" align="center" colspan="4" height="28"> <span class="cattitle">{L_ATTACH_US}</span> 
          </td> 
      </tr>
	<tr> 
	  <th height="25" class="thCornerL">#</th>
	  <th class="thTop">{L_USERNAME}</th>
	  <th class="thTop">{L_ATTACHMENTS}</th>
	  <th class="thCornerR">{L_SIZE}</th>
	</tr>
	<!-- BEGIN memberrow -->
	<tr> 
	  <td class="{memberrow.ROW_CLASS}" align="center"><span class="gen">&nbsp;{memberrow.ROW_NUMBER}&nbsp;</span></td>
	  <td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a href="{memberrow.U_VIEW_MEMBER}" class="gen">{memberrow.USERNAME}</a></span></td>
	  <td class="{memberrow.ROW_CLASS}" align="center" valign="middle">&nbsp;<b>{memberrow.TOTAL_ATTACHMENTS}</b>&nbsp;</td>
	  <td class="{memberrow.ROW_CLASS}" align="center">&nbsp;<b>{memberrow.TOTAL_SIZE}</b>&nbsp;</td>
	</tr>
	<!-- END memberrow -->
 </table>
These are the necessary tables which will be used to display the information in the .tpl

You will also need to add this into your statistics.php

Code: Select all

//
// Statistics
//




$upload_dir_size = 0;

	if ($dirname = @opendir($upload_dir))
	{
		while( $file = @readdir($dirname) )
		{
			if( $file != "." && $file != ".." )
			{
				$upload_dir_size += @filesize($upload_dir . "/" . $file);
			}
		}
		@closedir($dirname);

		if($upload_dir_size >= 1048576)
		{
			$upload_dir_size = round($upload_dir_size / 1048576 * 100) / 100 . " " . $lang['MB'];
			
		}
		else if($upload_dir_size >= 1024)
		{
			$upload_dir_size = round($upload_dir_size / 1024 * 100) / 100 . " " . $lang['KB'];
			
		}
		else
		{
			$upload_dir_size = $upload_dir_size . " " . $lang['Bytes'];
			
		}

	}
	else
	{
		$upload_dir_size = $lang['Not_available'];
	}

	$sql = "SELECT count(*) AS total
	FROM " . ATTACH_DESC_TABLE;

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total attachments.", "", __LINE__, __FILE__, $sql);
	}

	$total = $db->sql_fetchrow($result);
	$number_of_attachments = $total['total'];

	$sql = "SELECT post_id
	FROM " . ATTACH_DESC_TABLE . "
	GROUP BY post_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total posts.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_posts = $db->sql_numrows($result);

	$sql = "SELECT p.topic_id
	FROM " . ATTACH_DESC_TABLE . " a, " . POSTS_TABLE . " p
	WHERE a.post_id = p.post_id
	GROUP BY p.topic_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total topics.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_topics = $db->sql_numrows($result);

	$sql = "SELECT u.user_id
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id";

	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Error getting total users.", "", __LINE__, __FILE__, $sql);
	}

	$number_of_users = $db->sql_numrows($result);

	$template->assign_vars(array(
		"L_STATISTIC" => $lang['Statistic'],
		"L_VALUE" => $lang['Value'],
		"L_NUMBER_OF_ATTACHMENTS" => $lang['Number_of_attachments'],
		"L_TOTAL_FILESIZE" => $lang['Total_filesize'],
		"L_ATTACH_QUOTA" => $lang['Attach_quota'],
		"L_NUMBER_OF_POSTS" => $lang['Number_posts_attach'],
		"L_NUMBER_OF_TOPICS" => $lang['Number_topics_attach'],
		"L_NUMBER_OF_USERS" => $lang['Number_users_attach'],
		
		"TOTAL_FILESIZE" => $upload_dir_size,
		"ATTACH_QUOTA" => $attachment_quota,
		"NUMBER_OF_ATTACHMENTS" => $number_of_attachments,
		"NUMBER_OF_POSTS" => $number_of_posts,
		"NUMBER_OF_TOPICS" => $number_of_topics,
		"NUMBER_OF_USERS" => $number_of_users)
	);


//
// Username
//



	$sql = "SELECT u.username, u.user_id, count(*) as total_attachments, sum(a.filesize) as total_size
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id, u.username " . 
	$order_by;

	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't query attachments", "", __LINE__, __FILE__, $sql);
	}

	if( ( $db->sql_numrows($result) ) > 0 )
	{
		$members = $db->sql_fetchrowset($result);

		for ($i = 0; $i < count($members); $i++)
		{
			$username = $members[$i]['username'];
			$total_attachments = $members[$i]['total_attachments'];
			$total_size = $members[$i]['total_size'];

			$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$template->assign_block_vars("memberrow", array(
				"ROW_NUMBER" => $i + ( $HTTP_GET_VARS['start'] + 1 ),
				"ROW_COLOR" => "#" . $row_color,
				"ROW_CLASS" => $row_class,
				"USERNAME" => $username,
				"TOTAL_ATTACHMENTS" => $total_attachments,
				"TOTAL_SIZE" => intval($total_size/1024),
				"U_VIEW_MEMBER" => append_sid("admin_attach_cp.$phpEx?view=attachments&uid=" . $members[$i]['user_id']))
			);
		}
	}

	$sql = "SELECT u.user_id
	FROM " . ATTACH_DESC_TABLE . " a, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
	WHERE (a.post_id = p.post_id) AND (u.user_id = p.poster_id)
	GROUP BY u.user_id";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Error getting total users.", "", __LINE__, __FILE__, $sql);
	}

	$total_rows = $db->sql_numrows($result);


Put all this right before

Code: Select all

//
// End forum statistics
//
You will also need to add

Code: Select all

"L_ATTACH" => $lang['Attach_a'],
"L_ATTACH_US" => $lang['Attach_us'],
just after

Code: Select all

"L_VALUE" => $lang['Value'],
Now open your lang_statistics.php file and add

Code: Select all

$lang['Attach_a'] = "Attachment Statistics";
$lang['Attach_us'] = "Top Attaching Users";
Also make sure to add

Code: Select all

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main_attach.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_attach.' . $phpEx);
after

Code: Select all

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_statistics.' . $phpEx);
which is found in the statistics.php file

totoelectro
Registered User
Posts: 358
Joined: Tue Dec 11, 2001 8:47 am
Location: Nimes (South of France)
Contact:

Post by totoelectro »

8O

Code: Select all

Erreur Générale 
  
Error getting total posts. 
8O

User avatar
YellowGirls
Registered User
Posts: 168
Joined: Mon Apr 15, 2002 10:08 am

Post by YellowGirls »

Give it an Mod for this Attachment Statistics?Because i need so an Mod!
Or can you say me what i must change for it?

YellowGirls :)

User avatar
YellowGirls
Registered User
Posts: 168
Joined: Mon Apr 15, 2002 10:08 am

Post by YellowGirls »

@enzo250gto can you say me please what i must do to displayed the Attachment stats in statistics.php :?:

Greets YellowGirls

User avatar
YellowGirls
Registered User
Posts: 168
Joined: Mon Apr 15, 2002 10:08 am

Post by YellowGirls »

Oh sorry i have not see that you have it already post :o

I became the same error :
Error getting total posts.


An idea how wher the error is?

YellowGirls

enzo250gto
Registered User
Posts: 100
Joined: Tue Nov 27, 2001 4:14 am

errors

Post by enzo250gto »

Yellowgirl,
I would have to see your code first. Also I'm using AttachmentMod 2.1.0 because I've been to lazy to update to the newest. I believe the newer version has some changes in the database. I will try to upgrade to the newer version of the attachment mod and alter the stats to include this information and post it.

User avatar
YellowGirls
Registered User
Posts: 168
Joined: Mon Apr 15, 2002 10:08 am

Post by YellowGirls »

Here my files :)

Statistics.php
<?php
/***************************************************************************
statistics.php
-------------------
begin : Tue February 26 2002
copyright : (C) 2002 Nivisec.com
email : admin@nivisec.com

$Id: statistics.php,v 1.2.1 2002/04/18 02:43:12 nivisec Exp $

***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
//Start user modifiable variables
//
$return_limit = 10;
//Vote Images based on the theme path, (i.e. templates/CURRNT_THEME/ is already inserted)
$vote_left = "images/vote_lcap.gif";
$vote_right = "images/vote_rcap.gif";
$vote_bar = "images/voting_bar.gif";
//
//End user modifiable variables
//

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);
init_userprefs($userdata);
//
// End session management
//

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_statistics.' . $phpEx);

// Do the math :) (i think this is the same method as in philip mayer's statistic's file)
// Taken from Acyd Burn.
function do_math($firstval, $value, $total, &$percentage, &$bar_percent)
{
$cst = ($firstval > 0) ? 90 / $firstval : 90;

if ( $value != 0 )
{
$percentage = ( $total ) ? round( min(100, ($value / $total) * 100)) : 0;
}
else
{
$percentage = 0;
}

$bar_percent = round($value * $cst);
}

$template->set_filenames(array(
"body" => "statistics.tpl")
);

$template->assign_vars(array(
'TOTAL_PMS' => sprintf($lang['pms_total'], $board_config['pms_sent']),
"GRAPH_IMAGE" => $graph_image,

"L_ADMIN_STATISTICS" => $lang['Admin_Stats'],
"L_TOP_SMILIES" => $lang['Top_Smilies'],
"L_MOST_ACTIVE" => $lang['Most_Active_Topics'],
"L_MOST_VIEWED" => $lang['Most_Viewed_Topics'],
"L_TOP_POSTERS" => $lang['Top_Posting_Users'],

"L_USES" => $lang['Uses'],
"L_RANK" => $lang['Rank'],
"L_PERCENTAGE" => $lang['Percent'],
"L_GRAPH" => $lang['Graph'],
"L_REPLIES" => $lang['Replies'],
"L_TOPIC" => $lang['Topic'],
"L_VIEWS" => $lang['Views'],
"L_USERNAME" => $lang['Username'],
"L_POSTS" => $lang['Posts'],
"L_STATISTIC" => $lang['Statistic'],
"L_VALUE" => $lang['Value'],
"L_IMAGE" => $lang['smiley_url'],
"L_CODE" => $lang['smiley_code'],
"PAGE_NAME" => $lang['Statistics'])
);

//
// Authorization SQL
//
$auth_data_sql = "";
$sql = "SELECT forum_id
FROM " . FORUMS_TABLE;

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve forum_id data", "", __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result)) {
$is_auth = auth('auth_view', $row['forum_id'], $userdata);
if ($is_auth['auth_view'])
{
$auth_data_sql .= ( $auth_data_sql != "") ? ", " . $row['forum_id'] : $row['forum_id'];
}
}

//
// Getting voting bar info from template
//
if( !$board_config['override_user_style'] )
{
if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
{
$style = $userdata['user_style'];
if( !$theme )
$style = $board_config['default_style'];
}
else
$style = $board_config['default_style'];
}
else
$style = $board_config['default_style'];

$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";

if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Couldn't query database for theme info.");
}
if( !$row = $db->sql_fetchrow($result) )
{
message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style.");
}

$template_path = 'templates/' ;
$template_name = $row['template_name'] ;

$current_template_path = $template_path . $template_name . '/';

$template->assign_vars(array(
"LEFT_GRAPH_IMAGE" => $current_template_path . $vote_left,
"RIGHT_GRAPH_IMAGE" => $current_template_path . $vote_right,
"GRAPH_IMAGE" => $current_template_path . $vote_bar)
);

//
// Top posters SQL
//
$sql = "SELECT user_id, username, user_posts
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
AND user_posts > 0
ORDER BY user_posts DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}

$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result);
$percentage = 0;
$bar_percent = 0;

$firstcount = $user_data[0]['user_posts'];

for ($i = 0; $i < $user_count; $i++)
{
do_math($firstcount, $user_data[$i]['user_posts'], get_db_stat('postcount'), $percentage, $bar_percent);

$template->assign_block_vars("users", array(
"RANK" => $i+1,
"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
"USERNAME" => $user_data[$i]['username'],
"PERCENTAGE" => $percentage,
"BAR" => $bar_percent,
"URL" => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $user_data[$i]['user_id'],
"POSTS" => $user_data[$i]['user_posts'])
);
}

//
// Most active topics SQL
//
$sql = "SELECT topic_id, topic_title, topic_replies
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_replies > 0
ORDER BY topic_replies DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
$template->assign_block_vars("topicreplies", array(
"RANK" => $i+1,
"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
"TITLE" => $topic_data[$i]['topic_title'],
"REPLIES" => $topic_data[$i]['topic_replies'],
"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
);
}

//
// Most viewed topics SQL
//
$rank = 0;
$sql = "SELECT topic_id, topic_title, topic_views
FROM " . TOPICS_TABLE ."
WHERE forum_id IN ($auth_data_sql)
AND topic_status <> 2
AND topic_views > 0
ORDER BY topic_views DESC
LIMIT " . $return_limit;

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve topic data", "", __LINE__, __FILE__, $sql);
}

$topic_data = $db->sql_fetchrowset($result);

for ($i = 0; $i < count($topic_data); $i++)
{
$template->assign_block_vars("topicviews", array(
"RANK" => $i+1,
"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
"TITLE" => $topic_data[$i]['topic_title'],
"VIEWS" => $topic_data[$i]['topic_views'],
"URL" => $phpbb_root_path . "viewtopic.php?t=" . $topic_data[$i]['topic_id'])
);
}

//
// Get forum statistics (taken from admin panel)
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');

$start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);

$boarddays = ( time() - $board_config['board_startdate'] ) / 86400;

$posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
$topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
$users_per_day = sprintf("%.2f", $total_users / $boarddays);

$avatar_dir_size = 0;

if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
{
while( $file = @readdir($avatar_dir) )
{
if( $file != "." && $file != ".." )
{
$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
}
}
@closedir($avatar_dir);

//
// This bit of code translates the avatar directory size into human readable format
// Borrowed the code from the PHP.net annoted manual, origanally written by:
// Jesse (jesse@jess.on.ca)
//
if($avatar_dir_size >= 1048576)
{
$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
}
else if($avatar_dir_size >= 1024)
{
$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
}
else
{
$avatar_dir_size = $avatar_dir_size . " Bytes";
}

}
else
{
// Couldn't open Avatar dir.
$avatar_dir_size = $lang['Not_available'];
}

if($posts_per_day > $total_posts)
{
$posts_per_day = $total_posts;
}

if($topics_per_day > $total_topics)
{
$topics_per_day = $total_topics;
}

if($users_per_day > $total_users)
{
$users_per_day = $total_users;
}

//
// DB size ... MySQL only
//
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
//
if( preg_match("/^mysql/", SQL_LAYER) )
{
$sql = "SELECT VERSION() AS mysql_version";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$version = $row['mysql_version'];

if( preg_match("/^(3\.23|4\.)/", $version) )
{
$db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname;

$sql = "SHOW TABLE STATUS
FROM " . $db_name;
if($result = $db->sql_query($sql))
{
$tabledata_ary = $db->sql_fetchrowset($result);

$dbsize = 0;
for($i = 0; $i < count($tabledata_ary); $i++)
{
if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" )
{
if( $table_prefix != "" )
{
if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
}
}
else
{
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
}
}
}

if( $dbsize >= 1048576 )
{
$dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
}
else if( $dbsize >= 1024 )
{
$dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
}
else
{
$dbsize = sprintf("%.2f Bytes", $dbsize);
}
} // Else we couldn't get the table status.
}
else
{
$dbsize = $lang['Not_available'];
}
}
else
{
$dbsize = $lang['Not_available'];
}
}
else
{
$dbsize = $lang['Not_available'];
}

//
//Newest user data
//
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
$sql = "SELECT user_regdate
FROM " . USERS_TABLE . "
WHERE user_id = " . $newest_userdata['user_id'] . "
LIMIT 1";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$newest_user_date = $row['user_regdate'];

//
//Most Online data
//
$sql = "SELECT *
FROM " . CONFIG_TABLE . "
WHERE config_name = 'record_online_users'
OR config_name = 'record_online_date'";

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve configuration data", "", __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);
$most_users_date = ($row['config_value'] > 0) ? create_date($board_config['default_dateformat'], $row['config_value'], $board_config['board_timezone']) : $most_users_date = $lang['Not_available'];

$row = $db->sql_fetchrow($result);
$most_users = ($row['config_value'] > 0) ? $row['config_value'] : $lang['Not_available'];

$statistic_array = array($lang['Number_posts'],$lang['Posts_per_day'],$lang['Number_topics'],$lang['Topics_per_day'],$lang['Number_users'],$lang['Users_per_day'],$lang['Board_started'],$lang['Board_Up_Days'],$lang['Database_size'],$lang['Avatar_dir_size'],$lang['Latest_Reg_User_Date'],$lang['Latest_Reg_User'],$lang['Most_Ever_Online_Date'],$lang['Most_Ever_Online'],$lang['Gzip_compression'],$lang['PM']);
$value_array = array($total_posts, $posts_per_day, $total_topics, $topics_per_day, $total_users, $users_per_day, $start_date, sprintf('%.2f', $boarddays), $dbsize, $avatar_dir_size, create_date($board_config['default_dateformat'], $newest_user_date, $board_config['board_timezone']), sprintf('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">' . $newest_user . '</a>'), $most_users_date, $most_users, ( $board_config['gzip_compress'] ) ? $lang['Enabled'] : $lang['Disabled'],sprintf($lang['pms_total'], $board_config['pms_sent']));

for ($i = 0; $i < count($statistic_array); $i += 2)
{
$template->assign_block_vars("adminrow", array(
"STATISTIC" => $statistic_array[$i],
"VALUE" => $value_array[$i],
"STATISTIC2" => (isset($statistic_array[$i+1])) ? $statistic_array[$i + 1] : "",
"VALUE2" => (isset($value_array[$i+1])) ? $value_array[$i + 1] : "")
);
}
//
// End forum statistics
//

//
// Most used smilies
//
$sql = "SELECT SUM(smile_stat) as total
FROM " . SMILIES_TABLE;
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve smilie data", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_post_perc = $row['total'];

$sql = "SELECT code, smile_url, smile_stat
FROM " . SMILIES_TABLE . "
WHERE smile_stat > 0
ORDER BY smile_stat DESC
LIMIT " . $return_limit;


if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve smilie data", "", __LINE__, __FILE__, $sql);
}

$smilie_data = $db->sql_fetchrowset($result);
$top_perc = $smilie_data[0]['smile_stat'];

if ($top_perc)
{
for ($i = 0; $i < count($smilie_data); $i++)
{
do_math($top_perc, $smilie_data[$i]['smile_stat'], $total_post_perc, $percentage, $bar_percent);

$template->assign_block_vars("topsmilies", array(
"RANK" => $i+1,
"CLASS" => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
"CODE" => $smilie_data[$i]['code'],
"USES" => $smilie_data[$i]['smile_stat'],
"PERCENTAGE" => $percentage,
"BAR" => $bar_percent,
"URL" => '<img src="'. $board_config['smilies_path'] . '/' . $smilie_data[$i]['smile_url'] . '" alt="' . $smilie_data[$i]['smile_url'] . '" border="0">')
);
}
}
//
//Output the page
//
$page_title = $lang['Statistics'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$sql = "SELECT user_id, username, user_regdate FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_regdate DESC LIMIT 10";
if ( !($result = $db->sql_query($sql)) )
{
message_die('hmm.. a Fehler!?', '', __LINE__, __FILE__, $sql);
}

while ($row = $db->sql_fetchrow($result))
{
$user_id=$row['user_id'];
$template->assign_block_vars("newest", array(
'NEWEST_USER' => $row['username'],
'PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"),
'DATE' => create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone'])) );
}
include('rate_index.'.$phpEx);
$template->pparse("body");

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>


statistics.tpl
<table>
<tr>
<td align="left" valign="middle" class="nav" width="100%">
<span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
</span>
</td>
</tr>
</table>

<table border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" align="center" colspan="4">
<span class="cattitle">{L_ADMIN_STATISTICS}</span>
</td>
</tr>
<tr>
<th colspan="1" class="thCornerL" align="center"><strong>{L_STATISTIC}</strong></td>
<th width="25%" class="thTop" align="center"><strong>{L_VALUE}</strong></td>
<th width="25%" class="thTop" align="center"><strong>{L_STATISTIC}</strong></td>
<th width="25%" class="thCornerR" align="center"><strong>{L_VALUE}</strong></td>
</tr>

<!-- BEGIN adminrow -->
<tr>
<td class="row2" align="center"><span class="gen">{adminrow.STATISTIC}</span></td>
<td class="row1" width="25%" align="center"><span class="gen">{adminrow.VALUE}</span></td>
<td class="row2" align="center"><span class="gen">{adminrow.STATISTIC2}</span></td>
<td class="row1" width="25%" align="center"><span class="gen">{adminrow.VALUE2}</span></td>
</tr>
<!-- END adminrow -->
</table>
<br />
<br />
<!-- Neueste Registrierungen -->
<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="7" height="28"><span class="cattitle"><center>{L_LASTREGISTER}</center></span></tr>
<tr>
<th colspan="1" class="thCornerL" align="center"><strong>{L_USERNAME}</strong></th>
<th class="thTop" align="center"><strong>{L_REGISTERED}</strong></th></tr>
<!-- BEGIN newest -->
<tr>
<td class="row1" align="center" height="28"><span class="gen"><a href="{newest.PROFILE}" class="genmed">{newest.NEWEST_USER}</a></span></td>
<td class="row1" align="center"><span class="gen">{newest.DATE}</span></td>
<!-- END newest -->
</tr>
</table>
</td>
</tr>
</table>
<!-- Neueste Registrierungen -->
<br />
<br />
<table border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" align="center" colspan="5">
<span class="cattitle">{L_TOP_POSTERS}</span>
</td>
</tr>
<tr>
<th colspan="1" class="thCornerL" align="center"><strong>{L_RANK}</strong></th>
<th colspan="1" class="thTop" align="center" width="10%"><strong>{L_USERNAME}</strong></th>
<th colspan="1" class="thTop" align="center" width="10%"><strong>{L_POSTS}</strong></th>
<th colspan="1" class="thTop" align="center" width="10%"><strong>{L_PERCENTAGE}</strong></th>
<th colspan="1" class="thCornerR" align="center" width="50%"><strong>{L_GRAPH}</strong></th>
</tr>
<!-- BEGIN users -->
<tr>
<td class="{users.CLASS}" align="center" width="10%"><span class="gen">{users.RANK}</span></td>
<td class="{users.CLASS}" align="center" width="10%"><span class="gen"><a href="{users.URL}">{users.USERNAME}</a></span></td>
<td class="{users.CLASS}" align="center" width="10%"><span class="gen">{users.POSTS}</span></td>
<td class="{users.CLASS}" align="center" width="10%"><span class="gen">{users.PERCENTAGE}%</span></td>
<td class="{users.CLASS}" align="left" width="50%">
<table cellspacing="0" cellpadding="0" border="0" align="left">
<tr>
<td align="right"><img src="{LEFT_GRAPH_IMAGE}" width="4" height="12" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" align="left" width="{users.BAR}%">
<tr>
<td><img src="{GRAPH_IMAGE}" width="100%" height="12" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" align="left">
<tr>
<td align="left"><img src="{RIGHT_GRAPH_IMAGE}" width="4" height="12" /></td>
</tr>
</table>
</td>
</tr>
<!-- END users -->
</table>
<br />
<br />
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td valign="top" width="50%">
<table border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" align="center" colspan="3"><span class="cattitle">{L_MOST_VIEWED}</span></td>
</tr>
<tr>
<th colspan="1" class="thCornerL" align="left"><strong>{L_RANK}</strong></th>
<th class="thTop" align="center"><strong>{L_VIEWS}</strong></th>
<th class="thCornerR" align="center"><strong>{L_TOPIC}</strong></th>
<!-- BEGIN topicviews -->
<tr>
<td class="{topicviews.CLASS}" align="center" width="5%"><span class="gen">{topicviews.RANK}</span></td>
<td class="{topicviews.CLASS}" align="center" width="20%"><span class="gen">{topicviews.VIEWS}</span></td>
<td class="{topicviews.CLASS}" align="center"><span class="gen"><a href="{topicviews.URL}">{topicviews.TITLE}</a></span></td>
</tr>
<!-- END topicviews -->
</table>
</td>
<td valign="top" width="50%">
<table border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" align="center" colspan="3" height="28"> <span class="cattitle">{L_MOST_ACTIVE}</span>
</td>
</tr>
<tr>
<th colspan="1" class="thCornerL" align="left"><strong>{L_RANK}</strong></th>
<th class="thTop" align="center"><strong>{L_REPLIES}</strong></th>
<th class="thCornerR" align="center"><strong>{L_TOPIC}</strong></th>
</tr>
<!-- BEGIN topicreplies -->
<tr>
<td class="{topicreplies.CLASS}" align="center" width="5%"><span class="gen">{topicreplies.RANK}</span></td>
<td class="{topicreplies.CLASS}" align="center" width="20%"><span class="gen">{topicreplies.REPLIES}</span></td>
<td class="{topicreplies.CLASS}" align="center"><span class="gen"><a href="{topicreplies.URL}">{topicreplies.TITLE}</a></span></td>
</tr>
<!-- END topicreplies -->
</table>
</td>
</tr>
</table>
<br />
<br />
<!-- Most Rating Topics -->
<table width="100%" cellpadding="0" cellspacing="1" border="0" class="forumline">
<tr><td class="catHead" colspan="7" height="28"><span class="cattitle"><center>{L_TOP_RATED}</center></span>
<tr>
<th class="thCornerL" align="center"><strong>{L_RANK}</strong></th>
<th class="thTop" align="center"><strong>{L_TOPIC}</strong></th>
<th class="thTop" align="center"><strong>{L_NUMBER}</strong></th>
<th class="thTop" align="center"><strong>{L_RATING}</strong></th>
<th class="thTop" align="center"><strong>{L_MINIMUM}</strong></th>
<th class="thTop" align="center"><strong>{L_MAXIMUM}</strong></th>
<th class="thCornerR" align="center"><strong>{L_RATER}</strong></th></tr>
<!-- BEGIN ratingrow -->
<tr>
<td class="row1" align="center" height="28"><span class="gen">{ratingrow.RANK}</span></td>
<td class="row1" align="center"><span class="gen"><a href="{ratingrow.URL}">{ratingrow.TITLE}</a></span></td>
<td class="row1" align="center"><span class="gen">{ratingrow.NUMBER_OF_RATES}</span></td>
<td class="row1" align="center"><span class="gen">{ratingrow.RATING}</span></td>
<td class="row1" align="center"><span class="gen">{ratingrow.MIN}</span></td>
<td class="row1" align="center"><span class="gen">{ratingrow.MAX}</span></td>
<td class="row1" align="center"><span class="gen">{ratingrow.LAST_RATER_TIME}<br>{ratingrow.LAST_RATER}</span></td>
</tr>
<!-- END ratingrow -->
</table>
<!-- Most Rating Topics -->
<br />
<br />
<table border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" align="center" colspan="6">
<span class="cattitle">{L_TOP_SMILIES}</span>
</td>
</tr>
<tr>
<th colspan="1" class="thCornerL" align="center"><strong>{L_RANK}</strong></th>
<th class="thTop" align="center"><strong>{L_USES}</strong></th>
<th class="thTop" align="center"><strong>{L_IMAGE}</strong></th>
<th class="thTop" align="center"><strong>{L_CODE}</strong></th>
<th class="thTop" align="center"><strong>{L_PERCENTAGE}</strong></th>
<th class="thCornerR" align="center"><strong>{L_GRAPH}</strong></th>
</tr>

<!-- BEGIN topsmilies -->
<tr>
<td class="{topsmilies.CLASS}" align="center" width="5%"><span class="gen">{topsmilies.RANK}</span></td>
<td class="{topsmilies.CLASS}" align="center" width="5%"><span class="gen">{topsmilies.USES}</span></td>
<td class="{topsmilies.CLASS}" align="center" width="15%"><span class="gen">{topsmilies.URL}</span></td>
<td class="{topsmilies.CLASS}" align="center" width="15%"><span class="gen">{topsmilies.CODE}</span></td>
<td class="{topsmilies.CLASS}" align="center" width="10%"><span class="gen">{topsmilies.PERCENTAGE}%</span></td>
<td class="{topsmilies.CLASS}" width="50%" align="left">
<table cellspacing="0" cellpadding="0" border="0" align="left">
<tr>
<td align="right"><img src="{LEFT_GRAPH_IMAGE}" width="4" height="12" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" align="left" width="{topsmilies.BAR}%">
<tr>
<td><img src="{GRAPH_IMAGE}" width="100%" height="12" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" align="left">
<tr>
<td align="left"><img src="{RIGHT_GRAPH_IMAGE}" width="4" height="12" /></td>
</tr>
</table>
</td>
</tr>
<!-- END topsmilies -->
</table>


I hope that you can help me to add Attachment stats to my Statisticspage :)

Greets YellowGirls :D

eric1
Registered User
Posts: 2
Joined: Sun Jul 28, 2002 11:41 pm
Location: France
Contact:

this the version of the statistic mod

Post by eric1 »

this version is 1.2.2

statistic mod 1.2.2

Acyd Burn
Consultant
Consultant
Posts: 5830
Joined: Wed Dec 05, 2001 8:31 pm
Location: Behind You
Name: Meik Sievertsen

Post by Acyd Burn »

And Version 1.2.3 is here. ;)

eric1
Registered User
Posts: 2
Joined: Sun Jul 28, 2002 11:41 pm
Location: France
Contact:

thanks

Post by eric1 »

thanks for this !!

:wink:

Post Reply

Return to “[2.0.x] MODs in Development”