<?php
if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}

global $tracker_lang, $CURGROUP;
$blocktitle = "" . $tracker_lang ['last'] . " 10";
$content = ReadCache ( 'last', true );
if (! $content) {
	$res = sql_query ( "SELECT id, name, banned, hide FROM torrents ORDER BY added DESC LIMIT 10" ) or sqlerr ( __FILE__, __LINE__ );
	$num = mysql_num_rows ( $res );
	
	If (! $num) {
		$content .= "<center>" . $tracker_lang ['no_torrents'] . "</center>";
	} else {
		while ( $row = mysql_fetch_assoc ( $res ) ) {
			
			//Проверяем, не забанена ли раздача или не является скрытой
			if ($row ["banned"] == "yes" && ! $CURGROUP ['can_viewbanned']) {
				$content .= "";
			} elseif ($row ["hide"] == "yes" && ! $CURGROUP ['can_viewhidden']) {
				$content .= "";
			} else {
				$content .= '<li>' . WriteCurgroup ( '<a class=online href="details.php?id=' . $row ['id'] . '">', "\$CURGROUP['can_details']" ) . htmlspecialchars_uni ( $row ['name'] ) . WriteCurgroup ( '</a>', "\$CURGROUP['can_details']" ) . '</li>';
			}
		}
	}
	$content = WriteCache ( $content );
}
?>