<?php

if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $tracker_lang, $CURGROUP;
$blocktitle = "" . $tracker_lang ['last_req_off'] . "";
$content = ReadCache ( 'req_off', true );
if (! $content) {
	$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\">";
	$req = "<td align=\"center\" class=\"embedded\"><table class=\"main\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr valign='top'><td width=\"50%\" class=colhead colspan=0 align=\"center\"><b>" . $tracker_lang ['requests'] . "</b> <a href=\"viewrequests.php\">[" . $tracker_lang ['all'] . "]</a>" . WriteCurgroup ( " <a href=\"requests.php?action=new\"> [" . $tracker_lang ['create'] . " " . $tracker_lang ['request_s'] . "] </a>", '$CURGROUP["can_addreq"] && $CURUSER' ) . "</td></tr>";
	$res = sql_query ( "SELECT * FROM requests LIMIT 5" ) or sqlerr ( __FILE__, __LINE__ );
	while ( $row = mysql_fetch_array ( $res ) ) {
		$id = $row ["id"];
		$request = htmlspecialchars_uni ( $row ["request"] );
		$comments = $row ["comments"];
		$hits = $row ["hits"];
		$filled = $row ["filled"];
		$req .= "<tr valign='top'><td><a href=\"requests.php?id=$id\"><center>$request</center></a>";
		$req .= "<center>[комменты: $comments, нуждающихся: $hits]</center>";
		if ($filled != "")
			$req .= "<center><a href=\"$filled\"><font color=red>[Выполнен]</font></a></center>";
		$req .= "</td></tr>";
	}
	$req .= "</table></td>";
	$content .= WriteCurgroup ( $req, '$CURGROUP["can_req"]' );
	$off = "<td width=\"50%\" align=\"center\" style=\"border: none;\"><table class=main border=0 cellspacing=0 cellpadding=5><tr valign='top'><td width=\"50%\" class=colhead colspan=0 align=\"center\"><b>" . $tracker_lang ['offers'] . "</b> <a href=\"viewoffers.php\">[" . $tracker_lang ['all'] . "]</a>" . WriteCurgroup ( " <a href=\"offers.php?action=new\"> [" . $tracker_lang ['create'] . " " . $tracker_lang ['offer'] . "] </a>", '$CURGROUP["can_addoff"] && $CURUSER' ) . "</td></tr>";
	$res1 = sql_query ( "SELECT * FROM offers LIMIT 5" ) or sqlerr ( __FILE__, __LINE__ );
	while ( $row1 = mysql_fetch_array ( $res1 ) ) {
		$id = $row1 ["id"];
		$offer = htmlspecialchars_uni ( $row1 ["name"] );
		$comments = $row1 ["comments"];
		$votes = $row1 ["votes"];
		$off .= "<tr valign='top'><td><a href=\"offers.php?id=$id\"><center>$offer</center></a>";
		$off .= "<center>[комменты: $comments, нуждающихся: $votes]</center>";
		$off .= "</td></tr>";
	}
	$off .= "</table></td>";
	$content .= WriteCurgroup ( $off, '$CURGROUP["can_off"]' );
	$content .= "</tr></table>";
	$content = WriteCurgroup ( $content, '$CURGROUP["can_req"] || $CURGROUP["can_off"]' );
	$content = WriteCache ( $content );
}
?>