Файл: clan_forum/post/topic/index.php
Строк: 236
<?
require_once '../../../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic_clan` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$topic = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id` = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Топик не найден";
header('Location: /');
exit();
}
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".intval($_GET['clan'])."'"));
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel_clan` WHERE `id` = '$topic[id_razdel]' and `clan` = ".intval($_GET['clan']).""));
if(($razd['razdel']==2 && $user['clan']!=$clan['id'])&& $user['prava']<2 ){
$_SESSION['err'] = "Топик закрыт для общего просмотра"; header("Location: /clan_forum/?id=".intval($_GET['clan']).""); exit();}
if(($user['prava'] >2 or ($user['dolz']=='основатель' and $user['clan']==$clan['id']) )){
if(isset($_GET['postd']) && ($user['prava']>=2 || $user['dolz']=='основатель')){
mysql_query("DELETE FROM `forum_comm_clan` where `id` = '".abs(intval($_GET['postd']))."' limit 1");
}
}
$header = $topic['name'];
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$topic[id_user]'"));
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id` = ".intval($_GET['id'])." and `clan` = ".intval($_GET['clan']).""));
if($topic['id']!=$razd['id']){
$_SESSION['err'] = "Ошибка"; header("Location: /"); exit();}
require_once '../../../core/head.php';
echo"<div class='player'>";
if($ank['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";$color="#F7990D";}
if($ank['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";$color="EBC621";}
if($ank['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($ank['prava']=="2"){$status="<font color='ffc22b'>[m]</font>";}
echo" <div class='empty2'></div> "; online($ank['id']);
echo'<a href="/user/'.$topic['id_user'].'/"> <font color='.$ank['font'].'>'.$ank[nick].'</font></a>';
if($ank['prava']>"1"){echo" $status ";}
echo'<font color="grey"> '.vremja($topic[time]).'</font>';
if((($user['id']==$topic['id_user'] or ($user['dolz']=='заместитель' || $user['dolz']='основатель')) && $user['clan']==$topic['clan']) or $user['prava'] > 4){
echo " <a href='/clan_forum/post/topic/topic_red.php?id=$topic[id]&clan=".intval($_GET['clan'])."'> Изменить </a>";
echo" <a href='/clan_forum/post/topic/close.php?id=$topic[id]&clan=".intval($_GET['clan'])."'>| Удалить </a>";
if($topic['close'] == 0){
echo " | <a href='/clan_forum/post/topic/topic_close.php?id=$topic[id]&clan=".intval($_GET['clan'])."'>Закрыть </a>";
}else{
echo " | <a href='/clan_forum/post/topic/topic_no_close.php?id=$topic[id]&clan=".intval($_GET['clan'])."'>Открыть </a>";
}
}
if($ank['prava']>="4"){
echo "<div class='empty'></div><font color='$color'>".smiles(antimat($topic['msg']))."</font><div class='empty'></div><div class='empty'></div>";
}else{echo "<div class='empty'></div>".smiles(antimat($topic['msg']))."<div class='empty'></div><div class='empty'></div>";
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_comm_clan` WHERE `id_topic` = '$topic[id]'"),0);
echo'<div class="empty"></div><font color="DFD137">
Всего комментариев (<span>'.$k_post.'</span>)
</font></div></div><hr>';
$k_page = k_page($k_post,10);
$page = page($k_page);
$start = 10*$page-10;
if(isset($_POST['msg'])){
$msg = check($_POST['msg']);
$elfilox = mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_comm_clan` WHERE `id_user` = '".$user['id']."' and `id_topic` = '".$topic['id']."'"),0);
if($elfilox > 50 ) {
header('Location: /clan_forum/');
$err = 'Можно оставить максимум 50 комментариев!';
exit();
}
$lelfi = $_SERVER['REQUEST_TIME'] - 15;
$elfilox = mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_comm_clan` WHERE `msg` = '".$msg."' and `id_user` = '".$user['id']."' and `time`>".$lelfi.""),0);
if($elfilox > 0 ) {
$err = 'Сообщение повторяет предыдущее!';
header('Location: /clan_forum/ ');
}
if($user['level'] < 10){$err = 'Оставлять комментарии можно только с 10 уровня!';}
if(strlen($msg) < 1 or strlen($msg) > 3000) $err = 'Длина сообщения должна быть в пределах от 1 до 3000 символов';
if(!isset($err)) {
mysql_query("INSERT INTO `forum_comm_clan` SET `id_user` = '$user[id]', `id_topic` = '$topic[id]', `msg` = '$msg', `time` = '".time()."'");
header("Location: /clan_forum/post/topic/$topic[id]/?page=end&clan=".intval($_GET['clan'])."");
exit();
}else{
header("Location: /clan_forum/post/topic/$topic[id]/?page=end&clan=".intval($_GET['clan'])."");
$_SESSION['err'] = $err;
exit();
}
}
$q = mysql_query("SELECT * FROM `forum_comm_clan` WHERE `id_topic` = '$topic[id]' ORDER BY `id` ASC LIMIT $start, 10");
while($post = mysql_fetch_array($q)) {
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]' LIMIT 1"));
$req = mysql_query("SELECT * from `ban` where `id_us` = '$ank[id]' and `time`>'".time()."'");
$ban = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto > 0){
echo"<div class='player'>";
echo online($ank['id']);
echo " <a href='/user/$ank[id]/'><font color='$ank[font]'>$ank[nick]</font></a>";
if($ank['nick']!="$user[nick]"){echo "<a href='?comm=$ank[id]&page=end&clan=".intval($_GET['clan'])."'> (+)</a>";}
echo '<span class="mit">'.vremja($post['time']).'</span>';
if ($user['prava'] >= 4 || $user['dolz']=='основатель'){echo' <a href="?id='.$topic['id'].'&postd='.$post['id'].'&clan='.intval($_GET['clan']).'">[X]</a>';}
echo'</br><font color="'.$color.'"> </font>';
echo"</div>";echo "<hr>";
echo "</div>";
}else{
if($ank['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";$color="#F7990D";}
if($ank['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";$color="EBC621";}
if($ank['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($ank['prava']=="2"){$status="<font color='ffc22b'>[m]</font>";}
echo"<div class='player'>";
echo online($ank['id']);
echo " <a href='/user/$ank[id]/'><font color='$ank[font]'>$ank[nick]</font></a>";
if($ank['prava']>"1"){echo" $status";}
if($ank['nick']!="$user[nick]"){echo "<a href='?comm=$ank[id]&page=end&clan=".intval($_GET['clan'])."'> (+)</a>";}
echo '<span class="mit">'.vremja($post[time]).'</span>';
if ($user['prava'] >= 4|| $user['dolz']=='основатель'){echo' <a href="?id='.$topic['id'].'&postd='.$post['id'].'&clan='.intval($_GET['clan']).'">[X]</a>';}
if ( preg_match('/'.$user['nick'].'/i', $post['msg']) )
{
$to = ["".$user['nick']."," =>'<font color="#EBCA46">'.$user['nick'].', </font>'];
$post['msg'] = strtr($post['msg'], $to);
}
if($ank['prava']> 3){
echo'</br><font color="'.$color.'">'.smiles(antimat($post['msg'])).'</font> ';
} else {
echo'</br>'.smiles(antimat($post['msg'])).' ';
}
echo"</div>";echo "<hr>";}
echo "</div>";
}
if($topic[close] == 0){
$req = mysql_query("SELECT * from `ban` where `id_us` = '$user[id]' and `time`>'".time()."'");
$ban = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto == 0){
if(isset($_GET['comm'])) {
$ank2 = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` ='".abs(intval($_GET['comm']))."' "));
echo '<div class="head"><div class="empty2"></div>Введите комментарий: <div class="empty2"></div><form method="post" action="/clan_forum/post/topic/'.$topic['id'].'/?clan='.intval($_GET['clan']).'">
<input class="chat-area" value="'.$ank2['nick'].', " name="msg" /></textarea>
<input type="submit" class="inpc-ar form-submit" value="Отправить"></span>
</form></div>';
}else{
echo '<div class="head"><div class="empty2"></div>Введите комментарий: <div class="empty2"></div><form method="post"action="/clan_forum/post/topic/'.$topic[id].'/?&clan='.intval($_GET['clan']).'">
<textarea rows="3" class="chat-area" name="msg"></textarea>
<input type="submit" class="inpc-ar form-submit" value="Отправить"></span>
</form></div>';
}
}
}else{echo"<div class='mli grey'><div class='empty2'></div>Вы не можете оставить комментарий. Топик закрыт!<div class='empty2'></div></div>";}
if ($k_page>1){echo "<hr>"; str('?clan='.intval($_GET['clan']).'&',$k_page,$page);
}
echo "<hr><div class='foot'><a href='/clan_forum/post/$topic[id_razdel]/?clan=".intval($_GET['clan'])."'><img src='/images/icon/section.png'> Вернуться в раздел</a>
<span class='float-right'><a href='/moduls/smiles'><img src='/images/icon/smiley.png'> Смайлики</a></span>";
echo "</div>";
require_once '../../../core/foot.php';
?>