Файл: vsime.com/comm/inc/inc_forum/include_topic.php
Строк: 409
<?
if(isset($_GET['mdelete']) && ($ank['id']==$user['id'] || $uinc['access']=='adm'))$mdelete=1;
if(isset($mdelete) && isset($_POST['m_d_okey']))
{
if (hsc(@$_POST['mdp'])==$mdp)
{
foreach ($_POST as $key => $value)
{
if (preg_match('#^mdelelte_komm_([0-9]*)$#',$key,$kid) && $value==1)
{
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$kid[1]' LIMIT 1"))!=0)
{
$komm=mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$kid[1]' LIMIT 1"));
mysqli_query($dbi, "DELETE FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$komm[id]'");
}
}
}
} else hacked_by_Killer();
}
if(isset($mdelete) && isset($_POST['m_sk_okey']))
{
if (hsc(@$_POST['mdp'])==$mdp)
{
foreach ($_POST as $key => $value)
{
if (preg_match('#^mdelelte_komm_([0-9]*)$#',$key,$kid) && $value='1')
{
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$kid[1]' LIMIT 1"))!=0)
{
$komm=mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$kid[1]' LIMIT 1"));
mysqli_query($dbi, "UPDATE `forum_komm` SET `sk` = '".($komm['sk']==0?1:0)."', `sk_user` = '$user[id]' WHERE `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$komm[id]'");
}
}
}
} else hacked_by_Killer();
}
if(isset($_GET['reply']) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '".intval($_GET['reply'])."'"))!=0)
{
$komm=mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '".intval($_GET['reply'])."'"));
$ank2=profile($komm['id_user']);
echo "<div class='list'>n";
echo "<div class='left'>n";
echo show_avatar($ank2['id'], 'small');
if ($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user' && $ank2['id']!=$user['id'])
{
echo "<br />n";
echo "<center><a href='?act=comm_users_ban&id=$comm[id]&add=$ank2[id]&type=forum&object=$komm[id]'>Бан</a></center>n";
}
echo "</div>n";
echo "<div class='overfl_hid'>n";
echo profile_icon($ank2['id']).profile_nick($ank2['id'], 1).profile_medal($ank2['id']);
echo "<br />n";
echo output_text($komm['msg'], $ank2['id'])."n";
echo "</div>n";
echo "<div class='clear'></div>n";
echo "</div>n";
if (isset($user))
{
if ($comm['write_rule']==2 && !in_comm($user['id']))
{
echo "<div class='main'>n";
echo "Чтобы писать в форуме сообщества <b>".hsc($comm['name'])."</b>, Вам нужно быть участником данного сообщества.<br />n";
echo "<a href='/index/comm?act=comm&id=$comm[id]&in&mdp=$mdp'>Вступить в сообщество</a>n";
echo "</div>";
} else {
if (banned('comm_forum', $user['id'], 1))
{
banned('comm_forum', $user['id']);
} else {
if ($topic['locked']==0 || $topic['locked']==1 && ($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user')) {
input_bbs();
echo "<form method='post' action='?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]'>n";
echo "<textarea name='msg' id='textarea' rows='5' cols='17' style='width: 95%' placeholder='Введите свой ответ...'></textarea><br />n";
echo "<input type='hidden' name='mdp' value='$mdp'>n";
echo "<input type='hidden' name='reply' value='$ank2[id]'>";
echo "<input type='hidden' name='komm_reply' value='$komm[id]'>";
echo "<br/><input value="Отправить" type="submit" />n";
echo "</form>n";
echo "<div class='foot'>n";
echo image_back()." <a href='?act=forum&id=$comm[id]&topic_show=$topic[id]'>Назад</a>n";
echo "</div>n";
}
else show_errors("Тема закрыта для обсуждения!");
}
}
}
ex_foot();
}
if(isset($_GET['edit']) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '".intval($_GET['edit'])."'"))!=0) {
$komm=mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '".intval($_GET['edit'])."'"));
$ank2=profile($komm['id_user']);
if(isset($user) && ($user['id']==$ank2['id'] && $komm['time']>time()-600)) {
if(isset($_POST['submited'])) {
if (hsc(@$_POST['mdp']) == $mdp) {
$msg = $_POST['msg'];
if (strlen2($msg)>10000){$error[]='Сообщение слишком длинное';}
elseif (strlen2(trim($msg))<1){$error[]='Короткое сообщение';}
if(!isset($error)) {
mysqli_query($dbi, "UPDATE `forum_komm` SET `msg` = '".my_esc($msg)."' WHERE `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id` = '$komm[id]'");
locon(" ?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]");
}
} else hacked_by_Killer();
}
show_errors();
input_bbs();
echo "<form method='post' name='form' action=''>n";
echo "<textarea name='msg' id='textarea' rows='5' cols='17' style='width: 95%' placeholder='Введите комментарий...'>".input_value($komm['msg'])."</textarea><br />n";
echo "<input type='hidden' name='mdp' value='$mdp'>n";
echo "<input type="submit" name='submited' value="Сохранить" />n";
echo "</form>n";
echo "<div class='foot'>n";
echo image_back()." <a href='?act=forum&id=$comm[id]&topic_show=$topic[id]'>Назад</a>n";
echo "</div>n";
ex_foot();
}
}
if (isset($_POST['msg']) && isset($user) && ($comm['write_rule']==1 || $comm['write_rule']==2 && in_comm($user['id'])) && !banned('comm_forum', $user['id'], 1) && ($topic['locked']==0 || $topic['locked']==1 && ($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user'))) {
if (hsc(@$_POST['mdp'])==$mdp) {
$msg = $_POST['msg'];
if (strlen2($msg)>10000){$error[]='Сообщение слишком длинное';}
elseif (strlen2(trim($msg))<1){$error[]='Короткое сообщение';}
elseif (@$creator_last_komm['id']==$user['id'] && my_esc($msg)==@$last_komm['msg']){$error[]='Ваше сообщение повторяет предыдущее';}
if(!isset($error)){
if(isset($_POST['reply']) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '".intval($_POST['reply'])."'"))!=0) {
$reply_user=profile(intval($_POST['reply']));
$komm_reply=mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' AND `id_user` = '$reply_user[id]' AND `id` = '".intval($_POST['komm_reply'])."'"));
$reply=1;
}
// journal
$array_journal = array();
$query_komm = mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE `id_topic` = '$topic[id]' ORDER BY `time` ASC");
while ($post_komm = mysqli_fetch_array($query_komm)) {
if ($post_komm['id_user'] != $creator['id'] && $post_komm['id_user'] != $user['id'])$array_journal["$post_komm[id_user]"] = $post_komm['id'];
}
foreach ($array_journal as $key => $value) {
$ank_journal = profile($key);
$komm_journal = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE `id` = '$value'"));
if (mysqli_result("SELECT COUNT(*) FROM `journal` WHERE `id_kont` = '$ank_journal[id]' AND `cat` = 'forum' AND `type` = 'komm' AND `id_object2` = '$topic[id]'")==0)mysqli_query($dbi, "INSERT INTO `journal` (`id_kont`, `time`, `cat`, `type`, `id_object`, `id_object2`) values('$ank_journal[id]', '$time', 'forum', 'komm', '$komm_journal[id]', '$topic[id]')");
else mysqli_query($dbi, "UPDATE `journal` SET `time` = '$time', `read` = '0', `id_object` = '$komm_journal[id]' WHERE `id_kont` = '$ank_journal[id]' AND `cat` = 'forum' AND `type` = 'komm' AND `id_object2` = '$topic[id]'");
}
if($user['id'] != $creator['id']) {
if(mysqli_result("SELECT COUNT(*) FROM `journal` WHERE `id_kont` = '$creator[id]' AND `cat` = 'forum' AND `type` = 'object' AND `id_object` = '$topic[id]'")==0)mysqli_query($dbi, "INSERT INTO `journal` (`id_kont`, `time`, `cat`, `type`, `id_object`, `id_object2`) values('$creator[id]', '$time', 'forum', 'object', '$topic[id]', '$topic[id]')");
else mysqli_query($dbi, "UPDATE `journal` SET `time` = '$time', `read` = '0' WHERE `id_kont` = '$creator[id]' AND `cat` = 'forum' AND `type` = 'object' AND `id_object` = '$topic[id]'");
}
mysqli_query($dbi, "INSERT INTO `forum_komm` (`id_comm`, `id_user`, `id_topic`, `time`, `msg`".(isset($reply)?", `id_reply`, `reply_msg`":null).") values('$comm[id]', '$user[id]', '$topic[id]', '$time', '".my_esc($msg)."'".(isset($reply)?", '$reply_user[id]', '$komm_reply[msg]'":null).")");
locon("?act=forum&id=$comm[id]&topic_show=$topic[id]");
}
} else hacked_by_Killer();
}
if (($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user') && isset($_GET['delete']) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id` = '".intval($_GET['delete'])."' AND `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' LIMIT 1"))!=0) {
if (hsc($_GET['mdp'])==$mdp)
{
mysqli_query($dbi, "DELETE FROM `forum_komm` WHERE$skp `id` = '".intval($_GET['delete'])."' AND `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' LIMIT 1");
locon(" ?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]");
exit();
} else hacked_by_Killer();
}
if(isset($_POST['voTe_ok']) && $_POST['mdp']==$mdp && $topic['poll_check'] == 0)
{
if (hsc(@$_POST['mdp']) == $mdp) {
if_user('is_reg');
if (!in_comm($user['id'])) {
show_errors("Что бы голосовать, нужно быть усчатник сообщества!");
ex_foot();
}
if ($topic['poll']==0)
{
$error[]='К данной теме опрос не прикреплён!';
}
elseif($time > $topic['poll_time'])$error[]='Время голосования истекло';
$my_vote = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' AND `id_user` = '$user[id]'"));
if ($my_vote != 0)
{
$error[]='Вы уже принимали участие в данном опросе!';
}
if ($topic['locked']==1)$error[] = 'Опрос уже закрыт!';
if(!isset($error))
{
$count_checked_vars = 0;
foreach ($_POST as $key => $value)
{
if (str_replace("voTe", "x", $key) != $key && is_numeric($value))
{
$golos = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_poll` WHERE `id` = '$value' AND `id_topic` = '$topic[id]' LIMIT 1"));
if($golos != NULL)
{
$count_checked_vars++;
mysqli_query($dbi, "INSERT INTO `forum_pollen` (`id_user`, `id_var`, `id_topic`, `time`) values('$user[id]', '$golos[id]', '$topic[id]', '$time')");
break;
}
}
}
if ($count_checked_vars == 0)$error[] = 'Выберите хоть один вариант.';
else msg("Ваш голос принят");
}
} else hacked_by_Killer();
}
if(isset($_POST['voTe_ok']) && $_POST['mdp']==$mdp && $topic['poll_check'] == 1)
{
if (hsc(@$_POST['mdp']) == $mdp) {
if_user('is_reg');
if (!in_comm($user['id'])) {
show_errors("Что бы голосовать, нужно быть усчатник сообщества!");
ex_foot();
}
if ($topic['poll']==0)
{
$error[]='К данному дневнику опрос не прикреплён!';
}
elseif($time > $topic['poll_time'])$error[]='Время голосования истекло!';
$my_vote = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' AND `id_user` = '$user[id]'"));
if ($my_vote != 0)
{
$error[]='Вы уже принимали участие в данном опросе.';
}
if ($topic['locked']==1)$error[] = 'Опрос уже закрыт!';
if(!isset($error))
{
$count_checked_vars = 0;
foreach ($_POST as $key => $value)
{
if (preg_match('#^voTe_([0-9]*)$#',$key,$gid) && $value==1)
{
$golos = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `forum_poll` WHERE `id` = '$gid[1]' AND `id_topic` = '$topic[id]' LIMIT 1"));
if($golos != NULL)
{
$count_checked_vars++;
mysqli_query($dbi, "INSERT INTO `forum_pollen` (`id_user`, `id_var`, `id_topic`, `time`) values('$user[id]', '$golos[id]', '$topic[id]', '$time')");
}
}
}
if ($count_checked_vars == 0)$error[] = 'Выберите хоть один вариант.';
else msg("Ваш голос принят!");
}
} else hacked_by_Killer();
}
show_errors();
echo "<div class='list'>n";
echo profile_icon($creator['id']).profile_nick($creator['id'], 1).profile_medal($creator['id']);
echo " (".vremja($topic['time']).")n";
echo "</div>n";
echo "<div class='list'>n";
echo "<b class='none'>".hsc($topic['name'])."</b>n";
if (isset($user) && ($ank['id']==$user['id'] || $uinc && $uinc['access']!='user' || $user['id']==$creator['id'] && $topic['time']>time()-600))echo "<span class='right'>".($ank['id']==$user['id'] || $uinc['access']!='user'?" <a href='/polls/?act=edit&case=comm_topic&comm_id=$comm[id]&id_object=$topic[id]'>$config[code_poll]</a> ":NULL)."<a href='?act=forum&id=$comm[id]&cat_show=$fcat[id]&moderate=edit_topic&topic=$topic[id]'>$config[code_edit]</a>".($ank['id']==$user['id'] || $uinc['access']=='adm'?" <a href='?act=forum&id=$comm[id]&cat_show=$fcat[id]&moderate=delete_topic&topic=$topic[id]'>$config[code_delete]</a>":NULL)."</span>n";
echo "<br />n";
echo "<div class='freespace'>n";
echo output_text($topic['msg'], $creator['id']);
echo "</div>n";
if ($topic['poll']==1)
{
echo "<div class='list' style='background: #ffffff; border: 1px solid #cccccc; border-radius: 4px;'>n";
echo "<span class='rad_row right' style='margin-bottom: 0; margin-top: -5px; margin-right: -5px;'>n";
echo "Опросn";
echo "</span>n";
echo output_text($topic['poll_text'], $ank['id'], array('fon' => 0, 'quote' => 0, 'url' => 0))."<br />n";
$query_var = mysqli_query($dbi, "SELECT * FROM `forum_poll` WHERE `id_topic` = '$topic[id]' ORDER BY `num` ASC");
if (mysqli_num_rows($query_var)==0)
{
echo "<div class='err'>Ошибка, не найдено ни одного варианта!</div>n";
}
$query_leader = mysqli_query($dbi, "SELECT * FROM `forum_poll` WHERE `id_topic` = '$topic[id]' ORDER BY `num` ASC");
$leader = array();
while ($post_leader = mysqli_fetch_array($query_leader))
{
$count_votes = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' AND `id_var` = '$post_leader[id]' "));
if (!isset($leader[0]) || $count_votes > $leader[0])
{
$leader[0] = $count_votes;
$leader[1] = $post_leader['id'];
}
}
$my_vote = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' AND `id_user` = '$user[id]'"));
if(isset($user) && $my_vote == 0 && $topic['poll_time']>$time && $topic['locked']==0)
{
echo "<form method='post' action='' class='multi'>n";
}
while ($post_var = mysqli_fetch_array($query_var))
{
$all_votes = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' "));
$this_votes = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_pollen` WHERE `id_topic` = '$topic[id]' AND `id_var` = '$post_var[id]' "));
if($all_votes == 0)$p = 0;
elseif($this_votes == 0)$p = 0;
else
{
$p = ($this_votes/$all_votes)*100;
$p = round($p, 2);
}
echo "<div class='freespace'>n";
echo (isset($user) && $my_vote==0 && $topic['poll_time']>$time && $topic['locked']==0 && $uinc?($topic['poll_check'] == 1?"<input type='checkbox' id='voTe_$post_var[id]' name='voTe_$post_var[id]' value='1'>":"<input type='radio' name='voTe' id='voTe_$post_var[id]' value='$post_var[id]'>")." <label for='voTe_$post_var[id]'>":null).hsc($post_var['var']).(isset($user) && $my_vote==0 && $topic['poll_time']>$time && $topic['locked']==0 && $uinc?"</label>":NULL).($my_vote != 0 || $topic['locked']==1 || $topic['poll_time']<=$time || !$uinc?"<span class='right' style='font-size:0.7em;'>$p% ($this_votes)</span>":null)."n";
if ($my_vote != 0 || $topic['locked']==1 || $topic['poll_time']<=$time || !$uinc)echo "<div style='".(isset($leader[0]) && $leader[1] == $post_var['id']?" background: green; ":"background: grey; ")."height:4px; width: $p%; min-width: 5px'></div>n";
echo "</div>n";
}
if(isset($user) && !$my_vote && $topic['poll_time']>$time && $topic['locked']==0)
{
echo "<input type='hidden' name='mdp' value='$mdp'>n";
echo "<input type='submit' name='voTe_ok' value='Проголосовать!'>n";
echo "</form>n";
}
echo "<div class='freespace'>n";
echo "<span class='alert'>n";
echo "<small>n";
echo "Опрос начался ".vremja($topic['poll_time_start'])."n";
if ($topic['poll_timee']!='infin')
{
if ($topic['poll_time']>$time)echo " и закончится ".vremja($topic['poll_time'])."n";
else echo " и закончился ".vremja($topic['poll_time'])."n";
}
echo "</small>n";
echo "</span>n";
echo "</div>n";
echo "</div>n";
}
echo "</div>n";
echo "<div class='mod_grad count_komm'>n";
echo "<img src='/i/site/message.png' /> Комментариев: $count_kommn";
echo "</div>n";
$count_results=mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]'"));
$count_pages=count_pages($count_results);
$page=page();
$start=start_pages();
if(mysqli_result("SELECT COUNT(*) FROM `journal` WHERE `id_kont` = '$user[id]' AND `cat` = 'forum' AND `type` = 'komm' AND `id_object2` = '$topic[id]' AND `read` = '0'")!=0)
{
mysqli_query($dbi, "UPDATE `journal` SET `read` = '1' WHERE `id_kont` = '$user[id]' AND `cat` = 'forum' AND `type` = 'komm' AND `id_object2` = '$topic[id]' AND `read` = '0'");
locon(" /index/comm?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]&page=$page");
}
if(isset($user) && $user['id']==$creator['id'])
{
if(mysqli_result("SELECT COUNT(*) FROM `journal` WHERE `id_kont` = '$user[id]' AND `cat` = 'forum' AND `type` = 'object' AND `id_object` = '$topic[id]' AND `read` = '0'")!=0)
{
mysqli_query($dbi, "UPDATE `journal` SET `read` = '1' WHERE `id_kont` = '$user[id]' AND `cat` = 'forum' AND `type` = 'object' AND `id_object` = '$topic[id]'");
locon(" /index/comm?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]&page=$page");
}
mysqli_query($dbi, "UPDATE `forum` SET `a_time` = '$time' WHERE `id` = '$topic[id]'");
if (mysqli_result("SELECT COUNT(*) FROM `forum_komm` WHERE `id_topic` = '$topic[id]' AND `id_user` != '$user[id]' AND `time` > '$topic[a_time]'")!=0)locon(" /comm/?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]&page=$page");
}
if(isset($mdelete))
{
echo "<form method='post' class='multi'>n";
}
if (!$count_results)
{
echo "<div class='list'>n";
echo "Нет комментариев.n";
echo "</div>n";
}
?>
<script>
function toggle(id) {
var quote = document.getElementById('quote-' + id);
var state = quote.style.display;
if(state == 'none') {
quote.style.display = 'block';
} else {
quote.style.display = 'none';
}
}
</script>
<?
$query = mysqli_query($dbi, "SELECT * FROM `forum_komm` WHERE$skp `id_comm` = '$comm[id]' AND `id_topic` = '$topic[id]' ORDER BY `time` DESC LIMIT $start, $config[rop]");
while ($post = mysqli_fetch_array($query))
{
$ank2=profile($post['id_user']);
echo "<div class='list'>n";
echo "<div class='left'>n";
show_avatar($ank2['id'], 'small');
echo "</div>n";
echo "<div class='overfl_hid'>n";
echo profile_icon($ank2['id']).profile_nick($ank2['id'], 1).profile_medal($ank2['id']);
echo " (".vremja($post['time']).")n";
if ($ank2['id']==$creator['id'])echo "<b class='none'>Автор</b>n";
echo "<span class='right'>n";
if(isset($mdelete))
{
echo "<input type='checkbox' name='mdelelte_komm_$post[id]' value='1'>n";
} else {
if ($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user')echo " <a href='?act=forum&id=$comm[id]&topic_show=$topic[id]&delete=$post[id]&mdp=$mdp'>$config[code_delete]</a>n";
if(isset($user) && $user['id']==$ank2['id'] && $post['time']>time()-600)
{
echo " <a href='?act=forum&id=$comm[id]&topic_show=$topic[id]&edit=$post[id]'>$config[code_edit]</a>n";
}
}
echo "</span>n";
echo "<br />n";
if($post['id_reply']!=0 && mysqli_result("SELECT COUNT(*) FROM `user` WHERE `id` = '$post[id_reply]'"))
{
echo "<div id='quote-$post[id]' class='quote' style='display:none;'>n";
echo output_text($post['reply_msg'], $post['id_reply'])."n";
echo "</div>n";
}
if($post['sk']==1 && $post['sk_user']!=0 && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '$post[sk_user]'"))) {
$sku=profile($post['sk_user']);
echo "<span class='spared'>Скрыл".($sku['pol']==0?'a':null)." $sku[nick]</span><br/>";
}
if($post['id_reply']!=0 && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '$post[id_reply]'")))
{
$ru = profile($post['id_reply']);
echo "<a href='?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]' onclick='javascript:toggle("$post[id]"); return false;'>$ru[nick]</a>, ";
}
echo output_text($post['msg'], $ank2['id']);
echo "<br />n";
if ($ank2['id']!=0)echo "<a href='?act=forum&id=$comm[id]&topic_show=$topic[id]&reply=$post[id]'>Ответить</a>n";
echo "</div>n";
echo "<div class='clear'></div>n";
echo "</div>n";
}
if(isset($mdelete))
{
echo "<div class='mod_grad'>n";
echo "<input type='hidden' name='mdp' value='$mdp'>n";
echo "Выбранные: <input type='submit' name='m_d_okey' value='Удалить'> <input type='submit' name='m_sk_okey' value='Скрыть/Показать'> <a href='?act=forum&id=$comm[id]&cat_show=$fcat[id]&topic_show=$topic[id]&page=$page'>Отмена</a>n";
echo "</div>n";
echo "</form>n";
}
pages_show("?act=forum&id=$comm[id]&topic_show=$topic[id]".(isset($mdelete)?"&mdelete=1":null)."&"); // Вывод страниц
if (isset($user)) {
if ($comm['write_rule']==2 && !in_comm($user['id'])) {
echo "<div class='main'>n";
echo "Чтобы писать в форуме сообщества <b>".hsc($comm['name'])."</b>, Вам нужно быть участником данного сообщества.<br />n";
echo "<a href='/index/comm?act=comm&id=$comm[id]&in&mdp=$mdp'>Вступить в сообщество</a>n";
echo "</div>";
} else {
if (banned('comm_forum', $user['id'], 1)) {
banned('comm_forum', $user['id']);
} else {
if ($topic['locked']==0 || $topic['locked']==1 && ($ank['id']==$user['id'] && isset($user) || $uinc && $uinc['access']!='user')) {
input_bbs();
echo "<form method='POST' name='form1'>n";
echo "<textarea name='msg' id='textarea' rows='5' cols='17' style='width: 95%' placeholder='Введите комментарий...'></textarea><br />n";
echo "<input type='hidden' name='mdp' value='$mdp'>n";
echo "<input type='submit' name='submited' value='Добавить' />n";
echo "</form>n";
} else echo "<div class='main'>Тема закрыта для обсуждения!</div>n";
}
}
} else echo "<div class='main'>$config[code_add] <a href='/login/index'>Добавить комментарий</a></div>n";
if($ank['id']==$user['id'] || $uinc['access']=='adm')echo "<div class='mod_grad'>$config[code_move] <a href='?act=forum&id=$comm[id]&topic_show=$topic[id]&page=$page&mdelete=start'>Выбрать комментарии</a><br /></div>n";
echo "<div class='foot'>n";
echo image_back()." <a href='?act=forum&id=$comm[id]&cat_show=$fcat[id]'>Список тем</a> / <a href='?act=comm&id=$comm[id]'>В сообщество</a>n";
echo "</div>n";
ex_foot();
?>