<?php
if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $tracker_lang, $CURGROUP;
$blocktitle = $tracker_lang ['our_heroes'];
$content = ReadCache ( 'heroes', true );
if (! $content) {
	$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><td align=\"center\" class=\"embedded\">
<table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\ padding-bottom=\"0\">

<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">
  <tr>
    <td width=\"33%\" align=\"center\" style=\"border: none;\" valign=\"top\">
    <table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=colhead colspan=3 align=\"center\">" . $tracker_lang ['bonus'] . "</td></tr><tr><td align=\"center\">¹</td><td align=\"left\">" . $tracker_lang ['user'] . "</td><td align=\"center\">" . $tracker_lang ['amount'] . "</td></tr>";
	$bonus = sql_query ( "SELECT bonus, id, `group`, username FROM users WHERE bonus > 1 ORDER BY bonus DESC LIMIT 3" ) or sqlerr ( __FILE__, __LINE__ );
	$num = 0;
	while ( $bonus2 = mysql_fetch_array ( $bonus ) ) {
		++ $num;
		$id = $bonus2 ["id"];
		$bonus3 = $bonus2 ["bonus"];
		$content .= "<tr><td>$num.</td><td class=\"row3\" width=100%>" . WriteCurgroup ( "<a href=\"userdetails.php?id=$id\">", "\$CURGROUP['can_viewprof']" ) . get_user_group_color ( $bonus2 ["group"], $bonus2 ["username"] ) . WriteCurgroup ( "</a>", "\$CURGROUP['can_viewprof']" ) . "</td><td align=\"center\" class=\"row3\">$bonus3</td></tr>";
	}
	$content .= "</table></td>";
	
	$content .= "<td width=\"33%\" align=\"center\" valign=\"top\" style=\"border: none;\"><table class=main border=1 cellspacing=0 cellpadding=5><tr><td class=colhead colspan=3 align=\"center\">" . $tracker_lang ['respects'] . "</td></tr><tr><td align=\"center\">¹</td><td align=\"left\">" . $tracker_lang ['user'] . "</td><td align=\"center\">" . $tracker_lang ['amount'] . "</td></tr>";
	$sym = sql_query ( "SELECT simpaty, id, `group`, username FROM users WHERE simpaty >= 1 ORDER BY simpaty DESC LIMIT 3" ) or sqlerr ( __FILE__, __LINE__ );
	$num = 0;
	while ( $sym2 = mysql_fetch_array ( $sym ) ) {
		++ $num;
		$id = $sym2 ["id"];
		$sym3 = $sym2 ["simpaty"];
		$content .= "<tr><td>$num.</td><td class=\"row3\" width=100%>" . WriteCurgroup ( "<a href=\"userdetails.php?id=$id\">", "\$CURGROUP['can_viewprof']" ) . get_user_group_color ( $sym2 ["group"], $sym2 ["username"] ) . WriteCurgroup ( "</a>", "\$CURGROUP['can_viewprof']" ) . "</td><td align=\"center\" class=\"row3\">$sym3</td></tr>";
	}
	$content .= "</table></td>";
	$content .= "</tr><tr>";
	$content .= "<td width=\"33%\" align=\"center\" valign=\"top\" style=\"border: none;\"><table class=main border=1 cellspacing=0 cellpadding=5><tr><td class=colhead colspan=3 align=\"center\">" . $tracker_lang ['comments'] . "</td></tr><tr><td align=\"center\">¹</td><td align=\"left\">" . $tracker_lang ['user'] . "</td><td align=\"center\">" . $tracker_lang ['amount'] . "</td></tr>";
	$comm = sql_query ( "SELECT id, `group`, username, (SELECT COUNT(*) FROM comments WHERE users.id = comments.user) AS num_comm FROM users ORDER BY num_comm DESC LIMIT 3" ) or sqlerr ( __FILE__, __LINE__ );
	$num = 0;
	while ( $comm2 = mysql_fetch_array ( $comm ) ) {
		++ $num;
		$id = $comm2 ["id"];
		$comm3 = $comm2 ["num_comm"];
		if ($comm3 >= 1)
			$content .= "<tr><td>$num.</td><td class=\"row3\" width=100%>" . WriteCurgroup ( "<a href=\"userdetails.php?id=$id\">", "\$CURGROUP['can_viewprof']" ) . get_user_group_color ( $comm2 ["group"], $comm2 ["username"] ) . WriteCurgroup ( "</a>", "\$CURGROUP['can_viewprof']" ) . "</td><td align=\"center\" class=\"row3\">$comm3</td></tr>";
	}
	
	$content .= "</table></td>";
	$content .= "<td width=\"33%\" align=\"center\" valign=\"top\" style=\"border: none;\"><table class=main border=1 cellspacing=0 cellpadding=5><tr><td class=colhead colspan=3 align=\"center\">" . $tracker_lang ['torrents'] . "</td></tr><tr><td align=\"center\">¹</td><td align=\"left\">" . $tracker_lang ['user'] . "</td><td align=\"center\">" . $tracker_lang ['amount'] . "</td></tr>";
	$torrents = sql_query ( "SELECT id, `group`, username, (SELECT COUNT(*) FROM torrents WHERE users.id = torrents.owner) AS num_torrents FROM users ORDER BY num_torrents DESC LIMIT 3" ) or sqlerr ( __FILE__, __LINE__ );
	$num = 0;
	while ( $torrents2 = mysql_fetch_array ( $torrents ) ) {
		++ $num;
		$id = $torrents2 ["id"];
		$torrents3 = $torrents2 ["num_torrents"];
		if ($torrents3 >= 1)
			$content .= "<tr><td>$num.</td><td class=\"row3\" width=100%>" . WriteCurgroup ( "<a href=\"userdetails.php?id=$id\">", "\$CURGROUP['can_viewprof']" ) . get_user_group_color ( $torrents2 ["group"], $torrents2 ["username"] ) . WriteCurgroup ( "</a>", "\$CURGROUP['can_viewprof']" ) . "</td><td align=\"center\" class=\"row3\">$torrents3</td></tr>";
	}
	$content .= "</table></td></tr>";
	$content .= "</table>
</td></tr></table>";
	$content = WriteCache ( $content );
}
?>