<?


/*


	Вы не имеете права распространять этот мод.

	Продажа или выкладывание в "паблик" является нарушением авторских прав.

	(ц) SEfan.RU, DURMAN

	контакты: http://sefan.ru/?contact


*/


echo "<div class=\"title\"><a href=\"forum/new.php\">Последние темы форума</a></div>\n";

$k_them = mysql_result(mysql_query("SELECT COUNT(*) FROM `$mysql[pref]forum_t` ORDER BY time_last DESC;"),0);

if ($k_them > 0){

$k_p_str = 3;

$k_page = k_page($k_them,$k_p_str);

$page = page();

$i = $k_p_str*$page-$k_p_str;

$q = mysql_query("SELECT * FROM `$mysql[pref]forum_t` ORDER BY time_last DESC LIMIT $i, $k_p_str;");

while ($thema = mysql_fetch_array($q)){

echo "<div class=\"img_l\">\n";

$id_forum=$thema['id_f'];

$id_razd=$thema['id_r'];

if(isset($user) && $user['level']>0 && $user['slinks']==0)echo "<a href=\"".BASEDIR."forum/set_t.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$thema[id]\">\n";

//echo "<img src=\"".BASEDIR."SYSTEM/themes/$them/img/forum/them_$thema[close]$thema[crep].gif\" alt=\"&gt;\" />";

echo "<font color=\"#00ff00\">></font><font color=\"#FF0000\">></font>";

if (isset($user) && $user['level']>0 && $user['slinks']==0)echo "</a>\n";


echo " <a href=\"".BASEDIR."forum/index.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$thema[id]\"><b><span style=\"color:$color[forum_theme_name]\">".stripslashes($thema['name'])."</span></b></a>\n";

$k_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id_t` = '$thema[id]';"),0);

if($k_p > 0){

$id_p = mysql_result(mysql_query("SELECT MAX(id) FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id_t` = '$thema[id]';"),0);

$last_post = mysql_fetch_array(mysql_query("SELECT * FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum' AND `id` = '$id_p' AND `id_r` = '$id_razd' AND `id_t` = '$thema[id]';"));

echo "<a href=\"".BASEDIR."forum/index.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$thema[id]&amp;page=end\"> [$k_p]</a><br />\n";

echo "<small>\n<span style=\"color:$color[post_time]\">[".date("d/m/y, H:i",$last_post['time']+$timesdvig);if(isset($user)) echo "/ ".$last_post['nick']; echo "]</span></small>\n";

echo "<br />\n";

}

echo "</div>\n";

}}

else{

echo "Нет тем<br />\n";

}


?>

