Файл: soo/forum/inc/temes.php
Строк: 25
<?
$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_r` where comm_id = '$soo' and id='$fid';" );
$raz = @$db->sql_fetchrow( @$que );
if (mysql_affected_rows() == 0){
echo '<b>Такого раздела не существует!</b>';
echo '<br />';
echo gb.'<a href="./">Форум</a>'.div;
foot();
}
$for = @$db->sql_fetchrow( $db->sql_query( "select * from `comm_forum_f` where comm_id = '$soo' and id='".$raz['f_id']."';" ));
echo '<a href="/soo/forum/?soo='.$soo.'">Форумы</a>|<a href="razdel_'.$raz['f_id'].'?soo='.$soo.'">'.$for['name'].'</a>|<b>'.$raz['name'].'</b><br />';
echo '<dl><dt></dt></dl><img src="'.H.'img/k.gif" alt="*"/> <a href="addtem_'.$fid.'?soo='.$soo.'"><b>Новая тема</b></a><br /><dl><dt></dt></dl>';
echo '<b>Темы раздела:</b><br />';
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post=$db->sql_fetchfield($db->sql_query("select COUNT(*) from `comm_forum_t` WHERE comm_id = '$soo' and r_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 />';
$q1 = $db->sql_query( "SELECT * from `comm_forum_t` WHERE comm_id = '$soo' and r_id = '$fid' order by zak desc,time desc limit $start,$max;" );
while ($tem = @$db->sql_fetchrow(@$q1))
{
$time = $tem['time'];
$t = $tem['id'];
$num = $db->sql_numrows($db->sql_query( "select id from comm_forum_msg where comm_id = '$soo' and t_id = '$t' and r_id = '$fid'" ));
if ($tem['close'] == 1) $gif = 'zakr';
else if ($tem['zak'] == 1) $gif = 'lock';
else $gif = 'tem';
echo '<dl></dl>';
echo links;
if ($group['level']==3) {
echo '<a href="admin_editt_'.$t.'?soo='.$soo.'"><img src="'.H.'img/'.$gif.'.gif" alt="*"/></a> ';
}else{
echo '<img src="'.H.'img/'.$gif.'.gif" alt="*"/> ';
}
echo '<b><a href="tema_'.$t.'?soo='.$soo.'">'.$tem['name'].'</a></b> ('.$num.') <a href="tema_'.$t.'_end?soo='.$soo.'">>></a>';
echo div;
echo '<small>';
echo 'Автор: <a href="'.H.user_inf($tem['user_id']).'">'.user($tem['user_id']).'</a><br />';
$files=$db->sql_fetchfield($db->sql_query("select COUNT(*) from `comm_forum_msg` WHERE comm_id = '$soo' and t_id = '$t' and file != '';"),0);
if ($files>0)echo 'Вложений: <a href="files_'.$t.'?soo='.$soo.'">'.$files.'</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>';
echo '<br/>';
}
if ($k_page>1){
echo '<br/><dl><dt></dt></dl>';
str2("temes_$fid",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
}
$who = $db->sql_numrows($db->sql_query("SELECT * FROM `who` WHERE `room` = '$mod'"));
echo '<br /><dl><dt></dt></dl>
<a href="who_'.$mod.'">Кто тут?('.$who.')</a> | ';
}
else
{
print'ErOrr';
}
?>