<?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 = $tracker_lang ['news'] . ($CURGROUP ['can_addnews'] ? "<font class=\"small\"> - [<a class=\"altlink\" href=\"news.php\"><b>" . $tracker_lang ['create'] . "</b></a>]</font>" : "");
$content = ReadCache ( 'news', true );
if (! $content) {
	/// MOD GOLDENNEWS ///
	$resource = sql_query ( "SELECT n.*, u.group FROM news AS n LEFT JOIN users AS u ON u.id=n.userid WHERE ADDDATE(n.added, INTERVAL 360 DAY) > NOW() ORDER BY n.gold DESC, n.added DESC LIMIT 10" ) or sqlerr ( __FILE__, __LINE__ );
	/// MOD GOLDENNEWS ///
	//<a href=\"javascript: show_hide('s1')\"><img border=\"0\" src=\"pic/plus.gif\" id=\"pics1\" title=\"Показать\"></a>
	if (mysql_num_rows ( $resource )) {
		$content .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\"><tr><td class=\"text\">\n<ul>";
		while ( $array = mysql_fetch_array ( $resource ) ) {
			if ($news_flag == 0) {
				$content .= "<span style=\"cursor: pointer;\" onclick=\"javascript: show_hide('s" . $array ["id"] . "')\"><img border=\"0\" src=\"" . $pic_base_url . "minus.gif\" id=\"pics" . $array ["id"] . "\" title=\"Скрыть\"></span>&nbsp;" . "<span style=\"cursor: pointer;\" onclick=\"javascript: show_hide('s" . $array ["id"] . "')\">" . date ( "d.m.Y", strtotime ( $array ['added'] ) ) . " - \n" . "<b>" . htmlspecialchars_uni ( $array ['subject'] ) . "</b></span>\n";
				$content .= WriteCurgroup ( " <font size=\"-2\">[<a class=\"altlink\" href=\"news.php?action=edit&newsid=" . $array ['id'] . "&returnto=" . urlencode ( $_SERVER ['PHP_SELF'] ) . "\"><b>E</b></a>]</font>", '$CURGROUP["can_editlnews"] || ($CURGROUP["can_editnews"] && $CURUSER["id"]==' . $array ['userid'] . ')' );
				$content .= WriteCurgroup ( " <font size=\"-2\">[<a class=\"altlink\" href=\"news.php?action=delete&newsid=" . $array ['id'] . "&returnto=" . urlencode ( $_SERVER ['PHP_SELF'] ) . "\"><b>D</b></a>]</font>", '$CURGROUP["can_dellnews"] || ($CURGROUP["can_delnews"] && $CURUSER["id"]==' . $array ['userid'] . ')' );
				$content .= " <span id=\"ss" . $array ["id"] . "\" style=\"display: block;\">" . format_comment ( $array ['body'], true, $ALLGROUPS [$row ['group']] ['can_usepsmile'] ) . "</span>";
				$content .= "<br />";
				$news_flag = 1;
			} else {
				$content .= "<span style=\"cursor: pointer;\" onclick=\"javascript: show_hide('s" . $array ["id"] . "')\"><img border=\"0\" src=\"" . $pic_base_url . "plus.gif\" id=\"picn" . $array ["id"] . "\" title=\"Показать\"></span>&nbsp;" . "<span style=\"cursor: pointer;\" onclick=\"javascript: show_hide('s" . $array ["id"] . "')\">" . date ( "d.m.Y", strtotime ( $array ['added'] ) ) . " - \n" . "<b>" . htmlspecialchars_uni ( $array ['subject'] ) . "</b></span>\n";
				$content .= WriteCurgroup ( " <font size=\"-2\">[<a class=\"altlink\" href=\"news.php?action=edit&newsid=" . $array ['id'] . "&returnto=" . urlencode ( $_SERVER ['PHP_SELF'] ) . "\"><b>E</b></a>]</font>", '$CURGROUP["can_editlnews"] || ($CURGROUP["can_editnews"] && $CURUSER["id"]==' . $array ['userid'] . ')' );
				$content .= WriteCurgroup ( " <font size=\"-2\">[<a class=\"altlink\" href=\"news.php?action=delete&newsid=" . $array ['id'] . "&returnto=" . urlencode ( $_SERVER ['PHP_SELF'] ) . "\"><b>D</b></a>]</font>", '$CURGROUP["can_dellnews"] || ($CURGROUP["can_delnews"] && $CURUSER["id"]==' . $array ['userid'] . ')' );
				$content .= " <span id=\"ss" . $array ["id"] . "\" style=\"display: none;\">" . format_comment ( $array ['body'], true, $ALLGROUPS [$row ['group']] ['can_usepsmile'] ) . "</span>";
				$content .= "<br />";
			}
		}
		$content .= "</ul></td></tr></table>\n";
		$content = WriteCurgroup ( $content, '$CURGROUP["can_viewnews"]' );
	} else {
		$content .= "<table class=\"main\" align=\"center\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\"><tr><td class=\"text\">";
		$content .= "<div align=\"center\"><h3>" . $tracker_lang ['no_news'] . "</h3></div>\n";
		$content .= "</td></tr></table>";
	}
	$content = WriteCache ( $content );
}
?>