File size: 7.54Kb
<?
require_once '../../../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$topic = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topic` WHERE `id` = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Топик не найден";
header('Location: /forum/');
exit();
}
if($user['prava'] >= 2){
if(isset($_GET['postd'])){
mysql_query("DELETE FROM `forum_comm` 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']."'"));
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> "; echo 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['prava'] >= 2){
echo " <a href='/forum/post/topic/topic_red.php?id=".$topic['id']."'> Изменить </a>";
}
if($user['prava'] > 1){
echo" <a href='/forum/post/topic/close.php?id=".$topic['id']."'>| Удалить </a>";
if($topic['close'] == 0){
echo " | <a href='/forum/post/topic/topic_close.php?id=".$topic['id']."'>Закрыть </a>";
}else{
echo " | <a href='/forum/post/topic/topic_no_close.php?id=".$topic['id']."'>Открыть </a>";
}
if($topic['verh'] == 0){
echo " | <a href='/forum/post/topic/topic_verh.php?id=".$topic['id']."'>Прикрепить </a>";
}else{
echo " | <a href='/forum/post/topic/topic_no_verh.php?id=".$topic['id']."'>Открепить </a>";
}
}
if($ank['prava']>="4"){
echo "<div class='empty'></div>
<font color='".$color."'>".smiles(($topic['msg']))."</font>
<div class='empty2'></div>";
}else{echo "<div class='empty'></div>".smiles(antimat($topic['msg']))."
<div class='empty2'></div>";
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_comm` 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` WHERE `id_user` = '".$user['id']."' and `id_topic` = '".$topic['id']."'"),0);
if($elfilox > 50 && $user['prava'] < 2) {
header('Location: /forum/');
$_SESSION['err'] = 'Можно оставить максимум 50 комментариев!';
exit();
}
$lelfi = $_SERVER['REQUEST_TIME'] - 15;
$elfilox = mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_comm` WHERE `msg` = '".$msg."' and `id_user` = '".$user['id']."' and `time`>".$lelfi.""),0);
if($elfilox > 0 ) {
$err = 'Сообщение повторяет предыдущее!';
header('Location: /forum/ ');
}
if($user['level'] < 10){$err = 'Оставлять комментарии можно только с 10 уровня!';}
if(strlen($msg) < 2 or strlen($msg) > 3000) $err = 'Длина сообщения должна быть в пределах от 2 до 3000 символов';
if(!isset($err)) {
mysql_query("INSERT INTO `forum_comm` SET `id_user` = '".$user['id']."', `id_topic` = '".$topic['id']."', `msg` = '".$msg."', `time` = '".$tm."'");
header("Location: /forum/post/topic/".$topic['id']."/?page=end");
exit();
}else{
header("Location: /forum/post/topic/".$topic['id']."/?page=end");
$_SESSION['err'] = $err;
exit();
}
}
$q = mysql_query("SELECT * FROM `forum_comm` 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'> (+)</a>";}
echo '<span class="mit">'.vremja($post['time']).'</span>';
if ($user['prava'] >= 2){echo' <a href="?id='.$topic['id'].'&postd='.$post['id'].'">[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'> (+)</a>";
}
echo '<span class="mit">'.vremja($post['time']).'</span>';
if($user['prava'] >= 2){
echo' <a href="?id='.$topic['id'].'&postd='.$post['id'].'">[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>
<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="/forum/post/topic/'.$topic['id'].'/">
<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="/forum/post/topic/'.$topic['id'].'/">
<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='head grey center'>
<div class='empty2'></div>
Вы не можете оставить комментарий. Топик закрыт!
<div class='empty2'></div>
</div>";
}
if ($k_page>1){
echo"<hr>";
str('?',$k_page,$page);
}
echo "<hr><div class='foot'><a href='/forum/post/".$topic['id_razdel']."/'><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';
?>