<?php
if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $tracker_lang, $CURUSER, $CURGROUP, $pic_base_url, $ALLGROUPS;
$blocktitle = "Поледние комментарии";
$content = ReadCache ( 'lastcomm', true );
if (! $content) {
	//Параметры для гостей и юзеров (высота блока и скорость прокрутки) 
	if ($CURUSER) {
		$x = 150; //высота 
		$amount = 1; //скорость 
	} else {
		$x = 250; //высота 
		$amount = 2; //скорость 
	}
	$content .= "<MARQUEE behavior= \"scroll\" direction= \"up\" height=\"" . $x . "\" scrollamount= \"" . $amount . "\" scrolldelay= \"90\" onmouseover= \"this.stop()\"  onmouseout='this.start()'>";
	$res = sql_query ( "SELECT comments.user, comments.id AS cid, comments.torrent, comments.text, users.username, users.id, users.group FROM comments LEFT JOIN users ON users.id = comments.user WHERE comments.request=0 AND comments.touid=0 AND comments.offer=0 ORDER BY comments.added DESC LIMIT 10" ) or sqlerr ( __FILE__, __LINE__ );
	while ( $row = mysql_fetch_array ( $res ) ) {
		$content .= "<div style='padding:3px;' align='center'>";
		$content .= "" . WriteCurgroup ( "<a href=details.php?id=$row[torrent]>", '$CURGROUP["can_details"]' ) . "--- " . format_comment ( $row ["text"], true, $ALLGROUPS [$row ["group"]] ['can_usepsmile'] ) . " ---" . WriteCurgroup ( "</a>", '$CURGROUP["can_details"]' ) . "<br />";
		$content .= "Добавил(а): " . WriteCurgroup ( "<a href=userdetails.php?id=$row[id]>", "\$CURGROUP['can_viewprof']" ) . get_user_group_color ( $row ["group"], $row ["username"] ) . WriteCurgroup ( "</a>", "\$CURGROUP['can_viewprof']" ) . " " . WriteCurgroup ( "<a href=comment.php?action=quote&cid=$row[cid]><img src=" . $pic_base_url . "minipost.gif alt=" . $tracker_lang ["quote"] . " title=" . $tracker_lang ["quote"] . "></a>", "\$CURGROUP['can_addcom']" ) . WriteCurgroup ( "<a href=comment.php?action=edit&cid=$row[cid]><img src=" . $pic_base_url . "pen.gif alt=" . $tracker_lang ["edit"] . " title=" . $tracker_lang ["edit"] . "></a>", "(\$CURUSER['id']==" . $row ["user"] . " && \$CURGROUP['can_editcom']) || \$CURGROUP['can_editlcom']" ) . WriteCurgroup ( "<a href=comment.php?action=delete&cid=$row[cid]><img src=" . $pic_base_url . "warned2.gif alt=" . $tracker_lang ["delete"] . " title=" . $tracker_lang ["delete"] . "></a>", "(\$CURUSER['id']==" . $row ["user"] . " && \$CURGROUP['can_delcom']) || \$CURGROUP['can_dellcom']" ) . "";
		$content .= "</div>";
	}
	$content .= "</marquee>";
	$content = WriteCurgroup ( $content, '$CURGROUP["can_comment"]' );
	$content = WriteCache ( $content );
}
?>