<?php

if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $CURUSER, $CURGROUP, $ss_uri, $tracker_lang, $pic_base_url;
if ($CURUSER) {
	
	$datum = getdate ();
	
	$datum [hours] = sprintf ( "%02.0f", $datum [hours] );
	
	$datum [minutes] = sprintf ( "%02.0f", $datum [minutes] );
	
	$datum [seconds] = sprintf ( "%02.0f", $datum [seconds] );
	
	$uped = mksize ( $CURUSER ['uploaded'] );
	
	$downed = mksize ( $CURUSER ['downloaded'] );
	
	if ($CURUSER ["downloaded"] > 0) 

	{
		
		$ratio = $CURUSER ['uploaded'] / $CURUSER ['downloaded'];
		
		$ratio = number_format ( $ratio, 3 );
		
		$color = get_ratio_color ( $ratio );
		
		if ($color)
			
			$ratio = "<font color=$color>$ratio</font>";
	
	} 

	else 

	if ($CURUSER ["uploaded"] > 0)
		
		$ratio = "Inf.";
	
	else
		
		$ratio = "---";
	
	if ($CURUSER ['donor'] == "yes")
		$medaldon = "<img src=\"" . $pic_base_url . "star.gif\" alt=\"Донор\" title=\"Донор\">";
	if ($CURUSER ['warned'] == "yes")
		$warn = "<img src=\"" . $pic_base_url . "warned.gif\" alt=\"Предупрежден\" title=\"Предупрежден\">";
		
	/// MOD KUBOK ///
	if ($CURUSER ['kubok1'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/kubok1.gif\" alt=\"Кубок за лучшую раздачу\" title=\"Кубок за лучшую раздачу\">";
	if ($CURUSER ['kubok2'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/kubok2.gif\" alt=\"Кубок за популярную раздачу\" title=\"Кубок за популярную раздачу\">";
	if ($CURUSER ['kubok3'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/kubok3.gif\" alt=\"Кубок самому активному раздающему\" title=\"Кубок самому активному раздающему\">";
	if ($CURUSER ['kubok4'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "/kubkinagrady/kubok4.gif\" alt=\"Кубок за самую обсуждаемую раздачу\" title=\"Кубок за самую обсуждаемую раздачу\">";
	if ($CURUSER ['kubok5'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/kubok5.gif\" alt=\"Кубок лучшему комментатору\" title=\"Кубок лучшему комментатору\">";
	if ($CURUSER ['kubok6'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/kubok6.gif\" alt=\"Кубок лучшему Меценату\" title=\"Кубок лучшему Меценату\">";
	if ($CURUSER ['nagrada1'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/nagrada1.gif\" alt=\"Коро(ль,лева) - За высокую скорость отдач на трекере\" title=\"Коро(ль,лева) - За высокую скорость отдач на трекере\">";
	if ($CURUSER ['nagrada2'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/nagrada2.gif\" alt=\"Верный сид - Не оставляет раздачи, помогают другим\" title=\"Верный сид - Не оставляет раздачи, помогают другим\">";
	if ($CURUSER ['nagrada3'] == "yes")
		$kubok .= "<img src=\"" . $pic_base_url . "kubkinagrady/nagrada3.gif\" alt=\"Риторик - За объективные комментарии к раздаваемому материалу\" title=\"Риторик - За объективные комментарии к раздаваемому материалу\">";
		/// MOD AJAX Msgs ///
	//// check for messages //////////////////
	?>
<SCRIPT LANGUAGE="JAVASCRIPT">
function getMsgs() {

    var ajax = new engine_ajax();
    ajax.onShow = function() { };
    var varsString = "";
    ajax.requestFile = "aj_msgs.php";
    ajax.method = 'GET';
    ajax.element = 'ajax_msgs';
    ajax.setVar('readmsgs', 1);
    ajax.sendAJAX(varsString);
	setTimeout("getMsgs();", 6000); 
    return false

}
getMsgs();
</script><?
	/// MOD AJAX MESSAGESS ///
	/// MOD KUBOK ///
	//// end
	

	$fn = substr ( $_SERVER ['PHP_SELF'], strrpos ( $_SERVER ['PHP_SELF'], "/" ) + 1 );
	$stylesheets = ReadCache ( 'styles', true );
	if (! $stylesheets)
		if ($CURGROUP ['can_chsthemes']) {
			$ss_r = sql_query ( "SELECT id, name FROM stylesheets ORDER BY id ASC" ) or die ();
			while ( $ss_row = mysql_fetch_array ( $ss_r ) )
				$stylesheets .= "<option value='" . $ss_row ["id"] . "'>" . $ss_row ["name"] . "</option>\n";
			WriteCache ( $stylesheets );
		}
	$stylesheets = str_replace ( "value='" . $CURUSER ['stylesheet'] . "'", "value='" . $CURUSER ['stylesheet'] . "' selected", $stylesheets );
	$datum = getdate ();
	$month = $datum ["month"];
	if ($month == "May") {
		$content .= <<<BLOCKHTML
<layer name="lenta" top=0 left=0 >
<nolayer>
 <div id="lenta" style="position:absolute;  top:0; left:0;">
</nolayer>
<img border="0" src="
BLOCKHTML;
		$content .= $pic_base_url;
		$content .= <<<BLOCKHTML
lenta.gif" align="left">
<nolayer>
 </div>
</nolayer>
</layer>
BLOCKHTML;
	}
	$userbar = "<center>" . ($CURGROUP ['can_usecp'] ? "<a href=\"my.php\">" : "") . "<img src=\"" . ($CURUSER ["avatar"] ? $CURUSER ["avatar"] : "./themes/$ss_uri/images/default_avatar.gif") . "\" width=\"100\" alt=\"" . $tracker_lang ['avatar'] . "\" title=\"" . $tracker_lang ['avatar'] . "\" border=\"0\" />" . ($CURGROUP ['can_usecp'] ? "</a>" : "") . "</center>
	<br />";
	
	if ($kubok)
		$userbar .= "<font color=\"FF6600\">" . $tracker_lang ['cups'] . ":</font>&nbsp;$kubok<br />";
	$userbar .= "<font color=\"1900D1\">" . $tracker_lang ['ratio'] . ":</font>&nbsp;$ratio<br />
	<font color=\"green\">" . $tracker_lang ['uploaded'] . ":</font>&nbsp;$uped<br />
	<font color=\"red\">" . $tracker_lang ['downloaded'] . ":</font>&nbsp;$downed<br />
	<font color=\"darkblue\">" . $tracker_lang ['bonus'] . ":</font>&nbsp;<a href=\"mybonus.php\" class=\"online\"><font color=black>$CURUSER[bonus]</font></a><br />
	<div id='ajax_msgs'>" . $tracker_lang ["loading"] . "</div>
	" . $tracker_lang ['clock'] . ":&nbsp;<span id=\"clock2\">" . $tracker_lang ['loading'] . "...</span>

<!-- clock hack -->
<script type=\"text/javascript\">
function refrClock2()
{
var d=new Date();
var s=d.getSeconds();
var m=d.getMinutes();
var h=d.getHours();
var day=d.getDay();
var date=d.getDate();
var month=d.getMonth();
var year=d.getFullYear();
var am_pm;
if (s<10) {s=\"0\" + s}
if (m<10) {m=\"0\" + m}
if (h>12) {h-=12;am_pm = \"PM\"}
else {am_pm=\"AM\"}
if (h<10) {h=\"0\" + h}
document.getElementById(\"clock2\").innerHTML=h + \":\" + m + \":\" + s + \" \" + am_pm;
setTimeout(\"refrClock2()\",1000);
}
refrClock2();
</script>
<!-- / clock hack -->
<br />
	<font color=\"#FF6600\">" . $tracker_lang ['your_ip'] . ": " . $_SERVER ["REMOTE_ADDR"] . "</font><br />
        " . ($CURGROUP ['can_chsthemes'] ? $tracker_lang ['design'] . ": <select name=stylesheet onchange=\"window.location='?styleid='+this.options[this.selectedIndex].value\">\n$stylesheets\n</select>" : "") . "
	<br />
	<center><img src=\"" . $pic_base_url . "disabled.gif\" border=\"0\" />&nbsp;[<a href=\"logout.php\">" . $tracker_lang ['logout'] . "</a>]</center>
	";
	if ($CURUSER ['override_group'] != 255)
		$usrgroup = "&nbsp;<img src=\"" . $pic_base_url . "warned3.gif\" title=" . get_user_group_name ( $CURUSER ['group'] ) . " alt=" . get_user_group_name ( $CURUSER ['group'] ) . ">&nbsp;";
	
	elseif ($CURGROUP ['can_setgroup'])
		$usrgroup = "&nbsp;<a href=\"setgroup.php\"><img src=\"" . $pic_base_url . "setclass.gif\" title=\"" . get_user_group_name ( $CURUSER ['group'] ) . "\" alt=\"" . get_user_group_name ( $CURUSER ['group'] ) . "\" border=\"0\"></a>&nbsp;";

} else {
	$userbar = '<form method="post" action="takelogin.php">
<table border="0"><tr valign="top"><td style="border: none;">
<img src="' . $pic_base_url . 'affiliate-login.jpg"></td><td style="border: none;">
<input type="text" size=18 name="username" class="login"/><br />
<input type="password" size=18 name="password" class="pass"/><br />
<input type="submit" value="' . $tracker_lang ['login'] . '"><br /><br />
</td></tr></table>
</form>
<a class="menu" href="signup.php"><img src=./themes/' . $ss_uri . '/images/disk.gif border=\"0\">&nbsp;' . $tracker_lang ['signup'] . '</a>
<a class="menu" href="recover.php"><img src=./themes/' . $ss_uri . '/images/disk.gif border=\"0\">&nbsp;Забыл пароль?</a>';
}
if ($CURGROUP ['can_admin'] || $CURGROUP ['can_massemail'] || $CURGROUP ['can_masspm']) {
	$adminmenu = ($CURGROUP ['can_admin'] ? "<a class=\"menu\" href=\"admincp.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['staff'] . "</a>" . "<a class=\"menu\" href=\"freezeratio.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;Глобальная заморозка рейтинга</a>" : "") . ($CURGROUP ['can_masspm'] ? "<a class=\"menu\" href=\"staffmess.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['mass_pm'] . "</a>" : "") . ($CURGROUP ['can_massemail'] ? "<a class=\"menu\" href=\"email.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['email_spaming'] . "</a>" : "") . ($CURGROUP ['can_admin'] ? "<a class=\"menu\" href=\"lottery_config.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['set_lot'] . "</a>" . "<a class=\"menu\" href=\"ipcheck.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['two_ip'] . "</a>" : "");
	
	blok_menu ( $tracker_lang ['staff'], $adminmenu );
}
blok_menu ( $tracker_lang ['welcome_back'] . ($CURUSER ? "<a href=\"./userdetails.php?id=" . $CURUSER ["id"] . "\">" . get_user_group_color ( $CURUSER ["group"], $CURUSER ["username"] ) . "</a>&nbsp;" . $usrgroup . "&nbsp;" : "гость") . $medaldon . $warn, $userbar );

$usermenu = "<a class=\"menu\" href=\"donate.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['donate'] . "</a>" . ($CURUSER ? "<a class=\"menu\" href=\"donated.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['donate_report'] . "</a>" : "") . (! $CURGROUP ['can_dtforsell'] && $CURUSER ? "<a class=\"menu\" href=\"rbin.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['basket'] . "</a>" : "") . 

($CURUSER ? "<a class=\"menu\" href=\"my.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['my'] . "</a>" . ($CURGROUP ['can_addlol'] && $CURUSER ? "<a class=\"menu\" href=\"lol.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;Улыбка</a>" : "") . "<a class=\"menu\" href=\"userdetails.php?id=" . $CURUSER ["id"] . "\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['profile'] . "</a>" : "") . "<a class=\"menu\" href=\"staff.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['staff'] . "</a>" . ($CURGROUP ['can_browsetr'] ? "<a class=\"menu\" href=\"browse.php?trailer=yes\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['trailers'] . "</a>" : "") . ($CURGROUP ['can_uploadtr'] && $CURUSER ? "<a class=\"menu\" href=\"trailerupload.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['trailer_upload'] . "</a>" : "");
if ($CURGROUP ['can_uploadtor'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"upload.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['uploadtor'] . "</a>" . "<a class=\"menu\" href=\"mytorrents.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['my_torrents'] . "</a>";
if (! $CURGROUP ['can_uploadtor'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"uploadapp.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['requests_for_seeding'] . "</a>";
if ($CURGROUP ['can_editprof'])
	$usermenu .= "<a class=\"menu\" href=\"uploadapp.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['requests_for_seeding'] . "</a>";
if ($CURGROUP ['can_downloadtor'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"downloaded.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;Скачанные торренты</a>";
if ($CURGROUP ['can_bookmarks'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"bookmarks.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['bookmarks'] . "</a>";
if ($CURGROUP ['can_req'])
	$usermenu .= "<a class=\"menu\" href=\"viewrequests.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['requests'] . "</a>";
if ($CURGROUP ['can_off'])
	$usermenu .= "<a class=\"menu\" href=\"viewoffers.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['offers'] . "</a>";
if ($CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"mybonus.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['my_bonus'] . "</a>";
if ($CURGROUP ['can_inv'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"invite.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['invites'] . "</a>";
if ($CURGROUP ['can_friends'] && $CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"friends.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['personal_lists'] . "</a>";
if ($CURUSER)
	$usermenu .= "<a class=\"menu\" href=\"logout.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['logout'] . "</a>";

blok_menu ( $tracker_lang ['user_menu'], $usermenu );

$infomenu = "<a class=\"menu\" href=\"rules.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['rules'] . "</a>" . "<a class=\"menu\" href=\"faq.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['faq'] . "</a>" . "<a class=\"menu\" href=\"topten.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['topten'] . "</a>" . "<a class=\"menu\" href=\"formats.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['formats'] . "</a>";

blok_menu ( $tracker_lang ['info_menu'], $infomenu );

$bt_clients = '&nbsp;&nbsp;<a href="http://download.bittorrent.com/dl/BitTorrent-6.0.3.exe" target="_blank"><img src=' . $pic_base_url . 'btlogo.gif border=/"1/" width="170" height="40"></a><br />' . '&nbsp;&nbsp;<a href="http://download.utorrent.com/1.7.7/utorrent.exe" target="_blank"><img src=' . $pic_base_url . 'utorrent.jpg border=/"1/" width="170" height="40"></a><br />' . '<hr width=100% color=#ffc58c size=1>' . '<font class=small color=red>&nbsp;&nbsp;' . $tracker_lang ['clients_recomened_by_us'] . '</font>';

blok_menu ( "<center>" . $tracker_lang ['torrent_clients'] . "</center>", $bt_clients );
if ($CURGROUP ['can_playgames']) {
	$recreationmenu = "<a class=\"menu\" href=\"tickets.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['lottery'] . "</a>" . "<a class=\"menu\" href=\"blackjack.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['blackjack'] . "</a>" . "<a class=\"menu\" href=\"arcade.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['flashgames'] . "</a>" . "<a class=\"menu\" href=\"sp.php\"><img src=./themes/" . $ss_uri . "/images/disk.gif border=\"0\">&nbsp;" . $tracker_lang ['southpark'] . "</a>";
	blok_menu ( "<center>" . $tracker_lang ['recreation_menu'] . "</center>", $recreationmenu );
}
?>