Файл: soo/forum/inc/razdel.php
Строк: 38
<?
$uchas = mysql_result(mysql_query("SELECT COUNT(uid) FROM `community_user_incomm` where `uid` = '$user[id]' AND `activate` = 1 AND `cid` = '$soo'"),0);
if($comm['status']==2 or $comm['status']==1 && $uchas){
$que = @$db->sql_query("select * from `comm_forum_f` where comm_id = '$soo' and id='$fid';" );
$dtm = @$db->sql_fetchrow( @$que );
$f_name = $dtm['name'];
if (mysql_affected_rows() == 0){
echo '<b>Такого форума не существует!</b>';
echo '<br />';
echo gb.'<a href="/soo/forum/?soo='.$soo.'">Форум</a>'.div;
foot();
}
echo '<a href="/soo/forum/?soo='.$soo.'">Форумы</a>|<b>'.$f_name.'</b><br /><dl><dt></dt></dl>';
echo '<b>Разделы форума:</b>';
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post=$db->sql_fetchfield($db->sql_query("select COUNT(*) from `comm_forum_r` WHERE comm_id = '$soo' and f_id = '".$fid."';"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
if ($k_post == 0)echo '<br />Здесь разделов пока нет :)<br />';
$r = $db->sql_query("SELECT * from `comm_forum_r` WHERE comm_id = '$soo' and f_id = '".$fid."' order by pos limit $start,$max;" );
while ($raz = @$db->sql_fetchrow($r))
{
$rid = $raz['id'];
$r_name = $raz['name'];
$num = $db->sql_numrows($db->sql_query("select * from `comm_forum_msg` WHERE comm_id = '$soo' and f_id = '$fid' and r_id = '$rid';"));
$kol = $db->sql_numrows($db->sql_query("select * from `comm_forum_t` WHERE comm_id = '$soo' and f_id = '$fid' and r_id = '$rid';"));
$tem = @$db->sql_fetchrow($db->sql_query("select * from `comm_forum_t` WHERE comm_id = '$soo' and f_id = '$fid' and r_id = '$rid' order by time desc limit 1;"));
echo '<dl></dl>';
echo links;
if ($admin['priv']>=1) {
echo '<a href="admin_editr_'.$rid.'?soo='.$soo.'"><img src="'.H.'img/p2.png" alt="*"/></a> <b><a href="temes_'.$rid.'?soo='.$soo.'">'.$r_name.'</a></b> ('.$kol.'/'.$num.') <a href="temes_'.$rid.'_end?soo='.$soo.'">>></a>';
} else{
echo '<img src="'.H.'img/p2.png" alt="*"/> <b><a href="temes_'.$rid.'?soo='.$soo.'">'.$r_name.'</a></b> ('.$kol.'/'.$num.') <a href="temes_'.$rid.'_end?soo='.$soo.'">>></a>';
}
echo div;
echo '<small>';
echo 'Тема: <a href="tema_'.$tem['id'].'_end?soo='.$soo.'">'.$tem['name'].'</a><br />';
$post = @$db->sql_fetchrow($db->sql_query("select * from `comm_forum_msg` WHERE comm_id = '$soo' and t_id = '".$tem['id']."' order by time desc limit 1;"));
echo 'Сообщение: <a href="'.H.user_inf($post['user_id']).'">'.user($post['user_id']).'</a>';
echo '('.times($post['time']).')';
echo '</small>';
}
if ($k_page>1){
echo '<br/><dl><dt></dt></dl>';
str2("".$mod."_$fid",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
}
if ($admin['priv']>=1){echo '<br /><dl><dt></dt></dl>';
echo '<a href="admin_addr_'.$fid.'?soo='.$soo.'"><b>Создать</b></a>';
}
$who = $db->sql_numrows($db->sql_query("SELECT * FROM `who` WHERE `room` = '$mod'"));
echo '<br /><dl><dt></dt></dl>
<a href="who_'.$mod.'?soo='.$soo.'">Кто тут?('.$who.')</a> | ';
}
?>