<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: new_infusion_panel.php
| Author: INSERT NAME HERE
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

if (file_exists(INFUSIONS."top_shouters_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."top_shouters_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."top_shouters_panel/locale/English.php";
}

$shoutQuery = dbquery("SELECT shout_name, count(*) FROM ".DB_SHOUTBOX." GROUP BY shout_name ORDER BY `count(*)` DESC LIMIT 0 , 10");
openside($locale['tsp_001']);
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr class='tbl2' align='center'>\n";
echo "<td width='10'><span class='small'><strong>".$locale['tsp_002']."</strong></span></td>\n";
echo "<td width='50'><span class='small'><strong>".$locale['tsp_003']."</strong></span></td>\n";
echo "<td width='50'><span class='small'><strong>".$locale['tsp_004']."</strong></span></td>\n";
echo "</tr>\n";
$count = 1;
$i = 0;
while($shoutData = dbarray($shoutQuery)) {
	if ($shoutData['shout_name'] != '0') {
		$shoutuserQuery = dbquery("SELECT * FROM ".DB_USERS." WHERE user_id='".$shoutData['shout_name']."'");
		while ($shoutuserData=dbarray($shoutuserQuery)) {
			$i % 2 == 0 ? $rowclass="tbl1" : $rowclass="tbl2";
			echo "<tr class='".$rowclass."'>\n";
			echo "<td><span class='small'><strong>".$count."</strong></span></td>\n";
			echo "<td>&nbsp;<span class='small'><a href='".BASEDIR."profile.php?lookup=".$shoutuserData['user_id']."'>".$shoutuserData['user_name']."</a></span></td>\n";
			echo "<td><center><span class='small'>".$shoutData['count(*)']."</center></span></td>\n";
			echo "</tr>\n";
			$i++;
			$count++;
		}//while ($user=db
	} else {
		echo "<tr class='tbl1'>\n";
		echo "<td colspan='3'><span class='small'><strong>".$locale['tsp_005']."</strong></span></td>\n";
		echo "</tr>\n";
	}
	
}
echo "</table>\n";
closeside();
?>