Файл: forum/inc/new.php
Строк: 32
<?php
$a=isset($_GET['f']) ? $_GET['f'] : null;
switch($a){
case 'n':
$set['title']='Новые темы';
include_once '../sys/inc/thead.php';
title();
aut();
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" /> <a href="/forum/">Форум</a> | <b>Новые темы</b>';
echo '</div>';
$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, $set[p_str]");
// Если список пуст
if ($k_post == 0)
{
echo '<div class="mess">';
echo 'Ваших тем нет в форуме';
echo '</div>';
}else{
while ($them = mysql_fetch_assoc($q))
{
echo '<div class="' . ($num % 2 ? "nav1" : "nav2") . '">';
$num++;
echo '<img src="/style/themes/' . $set['set_them'] . '/forum/14/them_' . $them['up'] . $them['close'] . '.png" alt="" /> ';
echo '<a href="/forum/' . $them['id_forum'] . '/' . $them['id_razdel'] . '/' . $them['id'] . '/">' . text($them['name']) . '</a>
<a href="/forum/' . $them['id_forum'] . '/' . $them['id_razdel'] . '/' . $them['id'] . '/?page=' . $pageEnd . '">
(' . mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_p` WHERE `id_forum` = '$them[id_forum]' AND `id_razdel` = '$them[id_razdel]' AND `id_them` = '$them[id]'"),0) . ')</a><br/>';
echo user::nick($them['id_user']);
$post = mysql_fetch_array(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$them[id_razdel]' AND `id_forum` = '$them[id_forum]' ORDER BY `time` DESC LIMIT 1"));
if ($post['id_user'])echo ' / '.user::nick($post['id_user']).' (' . vremja($post['time']) . ')<br />';
echo '</div>';
}
echo '</table>';
// Вывод cтраниц
if ($k_page>1)str("?f=n&",$k_page,$page);
}
// Меню возврата
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" /> <a href="/forum/">Форум</a> | <b>Новые темы</b>';
echo '</div>';
break;
case 'p':
$set['title']='Новые комментарии';
include_once '../sys/inc/thead.php';
title();
aut();
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" /> <a href="/forum/">Форум</a> | <b>Новые посты</b>';
echo '</div>';
$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(`id`) 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` DESC LIMIT $start, $set[p_str]");
// Если список пуст
if ($k_post == 0)
{
echo '<div class="mess">';
echo 'Ваших тем нет в форуме';
echo '</div>';
}
while ($them = mysql_fetch_assoc($q))
{
echo '<div class="' . ($num % 2 ? "nav1" : "nav2") . '">';
$num++;
echo '<img src="/style/themes/' . $set['set_them'] . '/forum/14/them_' . $them['up'] . $them['close'] . '.png" alt="" /> ';
echo '<a href="/forum/' . $them['id_forum'] . '/' . $them['id_razdel'] . '/' . $them['id'] . '/">' . text($them['name']) . '</a>
<a href="/forum/' . $them['id_forum'] . '/' . $them['id_razdel'] . '/' . $them['id'] . '/?page=' . $pageEnd . '">
(' . mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_p` WHERE `id_forum` = '$them[id_forum]' AND `id_razdel` = '$them[id_razdel]' AND `id_them` = '$them[id]'"),0) . ')</a><br/>';
echo user::nick($them['id_user']);
$post = mysql_fetch_array(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$them[id_razdel]' AND `id_forum` = '$them[id_forum]' ORDER BY `time` DESC LIMIT 1"));
if ($post['id_user'])echo ' / '.user::nick($post['id_user']).' (' . vremja($post['time']) . ')<br />';
echo '</div>';
}
echo '</table>';
// Вывод cтраниц
if ($k_page>1)str("?f=p&",$k_page,$page);
// Меню возврата
echo '<div class="foot">';
echo '<img src="/style/icons/str2.gif" /> <a href="/forum/">Форум</a> | <b>Новые посты</b>';
echo '</div>';
break;
}
?>