Файл: sys/inc/forum_new.php
Строк: 7
<?
//Вывод тем форума
$adm_add = NULL;
$adm_add2 = NULL;
if (!isset($user) || $user['level']==0)
{
$q222 = mysql_query("SELECT * FROM `forum_f` WHERE `adm` = '1'");
while ($adm_f = mysql_fetch_assoc($q222))
{
$adm_add[] = "`id_forum` <> '$adm_f[id]'";
}
if (sizeof($adm_add) != 0)
$adm_add2 = ' WHERE'.implode(' AND ', $adm_add);
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t`$adm_add2"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
echo '<table class="post">';
$q=mysql_query("SELECT * FROM `forum_t`$adm_add2 ORDER BY `time_create` DESC LIMIT $start, 3");
// Если список пуст
if ($k_post == 0)
{
echo '<div class="mess">';
echo 'Нет активных тем';
echo '</div>';
}
while ($them = mysql_fetch_assoc($q))
{
// Определение подфорума
$forum = mysql_fetch_array(mysql_query("SELECT * FROM `forum_f` WHERE `id` = '$them[id_forum]' LIMIT 1"));
// Определение раздела
$razdel = mysql_fetch_array(mysql_query("SELECT * FROM `forum_r` WHERE `id` = '$them[id_razdel]' LIMIT 1"));
// Иконка темы
//echo '<img src="/style/themes/' . $set['set_them'] . '/forum/14/them_' . $them['up'] . $them['close'] . '.png" alt="" /> ';
// Ссылка на тему
echo '<a class="link" href="/forum/' . $forum['id'] . '/' . $razdel['id'] . '/' . $them['id'] . '/"><img src="/style/themes/' . $set['set_them'] . '/forum/14/them_' . $them['up'] . $them['close'] . '.png" alt="" /> ' . text($them['name']) . '
<span class="c">' . mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]'"),0) . '</span></a>';
// Последний пост
$post = mysql_fetch_array(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' ORDER BY `time` DESC LIMIT 1"));
}
echo '</table>';
?>