Файл: forumm/index.php
Строк: 657
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/shif.php';
include_once '../sys/inc/user.php';
$set['title']='Форум';
include_once '../sys/inc/thead.php';
title();
aut();
err();
echo "<style type='text/css'>
.block_hr {border-bottom:1px dotted #abbefb}
div.row3{padding:1px;background-color:#e1e1e1}
div.row4{padding:1px;background-color:#ffffff}
div.backlink{background-color:#EFF3F6;padding:2px}
div.blueline{padding:1px;background-color:#e7f1fe;border-top:1px solid #99ccff;border-bottom:1px solid #AFCDDC}
div.even{padding:1px;background-color:#fff;border-top:1px dotted #CCC}
div.block{margin:2px;padding:1px;border-top:1px dotted gray;border-bottom:1px dotted gray}
div.busi{padding:2px;background-color:#fff9d7;border-top:1px solid #e2c822;border-bottom:1px solid #e2c822}
div.header_path{border-left:1px solid #abbefb;border-right:1px solid #abbefb;border-bottom:1px solid #abbefb;border-left: 1px solid #999999;border-right: 1px solid #999999;background:#e8e8e8;margin:0px;padding:3px}
div.odd{padding:1px;background-color:#edeff4;border-top:1px dotted #CCC}
a:link,a:visited{color:#006699}
a:visited{color:#666666;}
a:hover{color: #ff0000;text-decoration: underline}</style>n";
if(isset($_GET['cmpl_komm'])){
if($user['group_access']==3 || $user['group_access']==7 || $user['group_access']==8 || $user['group_access']==9 || $user['group_access']==15)include_once 'cmpl_komm.php';
else header("location: /forumm/");}elseif(isset($_GET['cmpl_them'])){if($user['group_access']!=3 || $user['group_access']!=7 || $user['group_access']!=8 || $user['group_access']!=9 || $user['group_access']!=15)include_once 'cmpl_them.php';else header("location: /forumm/");}
elseif(isset($_GET['cmpl'])){if($user['group_access']!=3 || $user['group_access']!=7 || $user['group_access']!=8 || $user['group_access']!=9 || $user['group_access']!=15)include_once 'cmpl.php';else header("location: /forumm/");}elseif(isset($_GET['last']))include_once 'last_komm.php';
elseif(isset($_GET['search']))include_once 'search.php';
elseif(isset($_GET['new']))include_once 'new_them.php';
elseif(isset($_GET['my_themes']))include_once 'my_them.php';
elseif(isset($_GET['rating']))include_once 'rating.php';
elseif(isset($_GET['my_komms']))include_once 'my_komm.php';
elseif(isset($_GET['bookmarks']) && isset($user))include_once 'bookmarks.php';
else
{
if(isset($_GET['id']))$id=$_GET[id];
else $id=0;
$forum=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $id LIMIT 1"));
$mother=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $forum[mother] LIMIT 1"));
///////КТО ЗДЕСЬ?////////
if(isset($_GET['who_here']))
{
include_once 'who_here.php';
}
///////МОДЕРАТОРЫ////////
elseif(isset($_GET['moders']))
{
include_once 'moders.php';
}
////СОЗДАНИЕ ПОДФОРУМА/////
elseif(isset($_GET['s_f_ok']) && user_access('forum_for_create'))
{
include_once 's_f_ok.php';
}
///////СОЗДАНИЕ ТЕМЫ////////
elseif(isset($_GET['s_t_ok']) && isset($_GET['id']) && isset($user))
{
include_once 's_t_ok.php';
}
///////СОЗДАНИЕ ОПРОСА////////
elseif(isset($_GET['s_o_ok']) && isset($_GET['id']) && isset($user))
{
include_once 's_o_ok.php';
}
///////СОЗДАНИЕ РАЗДЕЛА////////
elseif(isset($_GET['s_r_ok']) && isset($_GET['id']) && user_access('forum_razd_create'))
{
include_once 's_r_ok.php';
}
///////ЖАЛОБА НА КОММ///////
elseif(isset($_GET['new_cmpl_komm_ok']) && isset($_GET['id']) && isset($user))
{
include_once 'new_cmpl_komm_ok.php';
}
///////ЖАЛОБА НА ТЕМУ///////
elseif(isset($_GET['new_cmpl_them_ok']) && isset($_GET['id']) && isset($user))
{
include_once 'new_cmpl_them_ok.php';
}
///////ОТВЕТ///////
elseif(isset($_GET['o_k']) && isset($_GET['id']) && isset($user))
{
include_once 'otvet_komm.php';
}
///////СКРЫТИЕ КОММА////////
elseif(isset($_GET['skrit_komm_ok']) && $forum['type']==tema && user_access('forum_post_ed'))
{
include_once 'skrit_komm_ok.php';
}
///////ОТКРЫТИЕ КОММА////////
elseif(isset($_GET['unskrit_komm_ok']) && $forum['type']==tema && user_access('forum_post_ed'))
{
include_once 'unskrit_komm_ok.php';
}
///////ЗАКРЫТИЕ ТЕМЫ////////
elseif(isset($_GET['close_them_ok']) && $forum['type']==tema && user_access('forum_them_edit'))
{
include_once 'close_them_ok.php';
}
///////OTКРЫТИЕ ТЕМЫ////////
elseif(isset($_GET['open_them_ok']) && $forum['type']==tema && user_access('forum_them_edit'))
{
mysql_query("UPDATE `forum` SET `close` = '0' WHERE `id` = '$forum[id]' LIMIT 1");
header("Location:/forumm/?id=$forum[id]");
}
///////РЕД.ТЕМЫ////////
elseif(isset($_GET['edit_them_ok']) && $forum['type']==tema && isset($user))
{
include_once 'edit_them_ok.php';
}
///////РЕД.РАЗДЕЛА////////
elseif(isset($_GET['edit_razdel_ok']) && $forum['type']==razdel && user_access('forum_razd_edit'))
{
include_once 'edit_razdel_ok.php';
}
///////РЕД.ПОДФОРУМА////////
elseif(isset($_GET['edit_forum_ok']) && $forum['type']==forum && user_access('forum_for_edit'))
{
include_once 'edit_forum_ok.php';
}
///////РЕД.KOMMA////////
elseif(isset($_GET['edit_komm_ok']) && $forum['type']==tema && isset($user))
{
include_once 'edit_komm_ok.php';
}
///////УДАЛЕНИЕ ПОДФОРУМА////////
elseif(isset($_GET['del_forum_ok']) && user_access('forum_for_delete'))
{
include_once 'del_forum_ok.php';
}
////УДАЛЕНИЕ РАЗДЕЛА////////
elseif(isset($_GET['del_razdel_ok']) && user_access('forum_razd_edit'))
{
include_once 'del_razdel_ok.php';
}
///////УДАЛЕНИЕ ТЕМЫ////////
elseif(isset($_GET['del_them_ok']) && user_access('forum_them_del'))
{
include_once 'del_them_ok.php';
}
///////УДАЛЕНИЕ KOMMA////////
elseif(isset($_GET['del_komm_ok']) && user_access('forum_post_ed'))
{
include_once 'del_komm_ok.php';
}
///////ФОРМА УДАЛЕНИЯ ТЕМЫ////////
elseif(isset($_GET['del_them']) && $forum['type']==tema && isset($_GET['id']) && user_access('forum_them_del'))
{
include_once 'del_them.php';
}
///////ФОРМА УДАЛЕНИЯ РАЗДЕЛА////////
elseif(isset($_GET['del_razdel']) && $forum['type']==razdel && isset($_GET['id']) && user_access('forum_razd_edit'))
{
include_once 'del_razdel.php';
}
///////ФОРМА УДАЛЕНИЯ ПОДФОРУМА////////
elseif(isset($_GET['del_forum']) && $forum['type']==forum && isset($_GET['id']) && user_access('forum_for_delete'))
{
include_once 'del_forum.php';
}
///////ФОРМА СОЗДАНИЯ ПОДФОРУМА////////
elseif(isset($_GET['s_f']) && user_access('forum_for_create'))
{
include_once 's_f.php';
}
///////ФОРМА СОЗДАНИЯ РАЗДЕЛА////////
elseif(isset($_GET['s_r']) && isset($_GET['id']) && user_access('forum_razd_create'))
{
include_once 's_r.php';
}
///////ФОРМА СОЗДАНИЯ ТЕМЫ////////
elseif(isset($_GET['s_t']) && isset($_GET['id']) && isset($user))
{
include_once 's_t.php';
}
///////ФОРМА СОЗДАНИЯ ОПРОСА////////
elseif(isset($_GET['s_o']) && isset($_GET['id']))
{
include_once 's_o.php';
}
///////ФОРМА РЕД.ТЕМЫ////////
elseif(isset($_GET['edit_them']) && $forum['type']==tema && isset($_GET['id']) && isset($user))
{
include_once 'edit_them.php';
}
///////ФОРМА РЕД.РАЗДЕЛА////////
elseif(isset($_GET['edit_razdel']) && $forum['type']==razdel && isset($_GET['id']) && user_access('forum_razd_edit'))
{
include_once 'edit_razdel.php';
}
///////ФОРМА РЕД.ПОДФОРУМА////////
elseif(isset($_GET['edit_forum']) && $forum['type']==forum && isset($_GET['id']) && user_access('forum_for_edit'))
{
include_once 'edit_forum.php';
}
///////ФОРМА РЕД.КОММА////////
elseif(isset($_GET['edit_komm']) && $forum['type']==tema && isset($_GET['id']) && isset($user))
{
include_once 'edit_komm.php';
}
///////ФОРМА ЖАЛОБЫ НА КОММ////////
elseif(isset($_GET['new_cmpl_komm']) && isset($_GET['id']) && isset($user))
{
include_once 'new_cmpl_komm.php';
}
///////ФОРМА ЖАЛОБЫ НА ТЕМУ////////
elseif(isset($_GET['new_cmpl_them']) && isset($_GET['id']) && isset($user))
{
include_once 'new_cmpl_them.php';
}
///////ПЕРЕМЕЩЕНИЕ Темы////////
elseif(isset($_GET['move_ok']) && user_access('forum_them_edit') && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id` = '$_GET[move_ok]' AND `type` = 'tema' LIMIT 1"),0)!=0)
{
include_once 'move_ok.php';
}
///////ПРОГОЛОСОВАТЬ////////
elseif(isset($_GET['golos']) && isset($_GET['id']) && isset($user))
{
include_once 'golos.php';
}
///////ФОРМА ТЕМЫ////////
elseif($forum['type']==tema)
{
///////ДОБАВЛЕНИЕ КОММЕНТАРИЯ////////
if (isset($_POST['msg']) && isset($user))
{
$msg=esc(stripcslashes(htmlspecialchars($_POST['msg'])));
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>1024){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<2){$err='Короткое сообщение';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]' AND `id_user` = '$user[id]' AND `msg` = '".mysql_real_escape_string($msg)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
else
{
mysql_query("INSERT INTO `forum_komm` (`id_them`, `id_user`, `time`, `msg`) values('$forum[id]', '$user[id]', '$time', '".my_esc($msg)."')");
mysql_query("UPDATE `forum` SET `time_obnov` = '$time' WHERE `id` = '$forum[id]' LIMIT 1");
mysql_query("UPDATE `forum` SET `c_k_for_moder`='".($forum['c_k_for_moder']+1)."' WHERE `id`='$forum[id]' LIMIT 1");
mysql_query("UPDATE `forum` SET `c_k_for_user`='".($forum['c_k_for_user']+1)."' WHERE `id`='$forum[id]' LIMIT 1");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them_komm` WHERE `id_user` = '$user[id]' AND `id_them` = '$forum[id]' LIMIT 1"),0)==0 && isset($user))
{
mysql_query("INSERT INTO `forum_them_komm` (`id_user`, `id_them`) values ('$user[id]', '$forum[id]')");
}
//// Рейтинг активности
include '../akt_rat.php';
$post_them=array('30','50','100','250', '500', '750', '1000', '1250');
for ($i=0; $i < count($post_them); $i++){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '".intval($_GET['id'])."'"),0) >=$times[$i])
{
$ank_aut=get_user($forum['id_user']);
mysql_query("UPDATE `user` SET `akt_rating` = '".($ank_aut['akt_rating']+0.003)."' WHERE `id` = '$ank_aut[id]' LIMIT 1");
}
}
/////////////////////
$q = mysql_query("SELECT * FROM `forum_them_komm` WHERE `id_them` = '$forum[id]' AND `sled` = '1'");
while ($f = mysql_fetch_array($q))
{
$a=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[id_user]' LIMIT 1"));
if($a['id']!=$user['id'])
{
if($user['pol']==1)$pol='оставил'; else $pol='оставила';
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$f[id_user]', '[url=/info.php?id=$a[id]]$a[nick][/url] $pol комментарий в теме [url=/forumm/?id=$forum[id]]$forum[name][/url]', '$time')");
}
}
if($user['id']!=$forum['id_user'])
{
if($user['pol']==1)$pol='оставил'; else $pol='оставила';
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$forum[id_user]', '[url=/info.php?id=$user[id]]$user[nick][/url] $pol комментарий к вашей теме [url=/forumm/?id=$forum[id]]$forum[name][/url]', '$time')");
}
header("Location:/forumm/?id=$forum[id]");
}
}
elseif(isset($_GET['who_oprosen']))
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_bookmarks` WHERE `id_them` = '$forum[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `forum_oprosen` WHERE `id_them` = '$forum[id]' ORDER BY `id` ASC LIMIT $start, $set[p_str]");
if (mysql_num_rows($q)==0)
{
echo "Никто ещо отдал своего голоса!n";
}
while ($post = mysql_fetch_assoc($q))
{
if($num==1){
echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";
$num=0;
}else{
echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";
$num=1;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo "<a href='/info.php?id=$ank[id]'><span style='color:#79358c'><b>$ank[nick]</b></span></a> ".online($ank['id'])." <font color='green'>[".vremja($post['time'])."]</font><br/>n";
echo "</div>";
}
if ($k_page>1)str("/forumm/?id=$forum[id]&who_oprosen&",$k_page,$page); // Вывод страниц
echo "<div class='backlink'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='?id=$forum[id]'>Назад</a></div><div class='row4'>n";
}
elseif(isset($_GET['user_bm']))
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_bookmarks` WHERE `id_them` = '$forum[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `forum_bookmarks` WHERE `id_them` = '$forum[id]' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
if (mysql_num_rows($q)==0)
{
echo "Никто ещо не добавлял тему в закладки!n";
}
while ($post = mysql_fetch_assoc($q))
{
if($num==1){
echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";
$num=0;
}else{
echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";
$num=1;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo "<a href='/info.php?id=$ank[id]'><span style='color:#79358c'><b>$ank[nick]</b></span></a> ".online($ank['id'])." <font color='green'>[".vremja($post['time'])."]</font><br/>n";
echo "</div>";
}
if ($k_page>1)str("/forumm/?id=$forum[id]&user_bm&",$k_page,$page); // Вывод страниц
echo "<div class='backlink'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='?id=$forum[id]'>Назад</a></div><div class='row4'>n";
}
else
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them_visited` WHERE `id_user` = '$user[id]' AND `id_them` = '$forum[id]' LIMIT 1"),0)==0 && isset($user))
{
mysql_query("INSERT INTO `forum_them_visited` (`id_user`, `id_them`, `time`) values ('$user[id]', '$forum[id]', '$time')");
}
else mysql_query("UPDATE `forum_them_visited` SET `time` = '$time' WHERE `id_them` = '$forum[id]' AND `id_user` = '$user[id]' LIMIT 1");
echo "<div class='header_path'><a href='/'>$_SERVER[HTTP_HOST]</a>/<a href='/forumm'>Форум</a>/<a href='?id=$forum[id]'>$forum[name]</a></div><div class='main'><div class='backlink'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='?id=$mother[id]'>$mother[name]</a></div><div class='row4'>n";
$avtor=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $forum[id_user] LIMIT 1"));
echo "<a href='/info.php?id=$avtor[id]'><span style='color:#79358c'><b>$avtor[nick]</b></span></a> ".online($avtor['id'])." <span style='color: #209143; font-size: small'>".vremja($forum['time'])."</span><br/>n";
echo "<b>n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($forum['name']))))))))."</b>n";
if($forum['close']==1)echo " <img src='http://i.spaces.ru//topic_locked.gif' alt='loced' /><br/>n";
else echo "<br/>n";
if ($forum['opros']==1)
{
echo '<b>';
echo output_text($forum['text'])."<br />n";
echo '</b>';
$q2=mysql_query("SELECT * FROM `forum_opros` WHERE `id_them` = '$forum[id]' ORDER BY `id` ASC");
if (mysql_num_rows($q2)==0)
{
echo "Ошибка,не найдено ни одного варианта n";
}
while ($post2 = mysql_fetch_assoc($q2))
{
$zavse=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_oprosen` WHERE `id_them` = '$forum[id]' ",$db), 0);
$zaet=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_oprosen` WHERE `id_them` = '$forum[id]' AND `id_var` = '$post2[id]' ",$db), 0);
$prov=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_oprosen` WHERE `id_them` = '$forum[id]' AND `id_user` = '$user[id]'",$db), 0);
$p=$zaet/$zavse*100;
$p = (int)$p;
if($post2['var']!=NULL)
{
echo "<a href='?id=$forum[id]&golos=$post2[id]'>$post2[var]</a> - $zaet<span style='color:darkblue;font-size:small'> ($p%)</span><br/>";
if(isset($_GET['grafik']))echo "<img src='/forumm/img.php?p=$p&k=$zaet&a=$zavse&x00=$post2[var]' alt=''/>";
echo "<br />";
}
}
echo "<a href='?id=$forum[id]&who_oprosen'><span style='color:#79358c'>Кто проголосовал?</span></a><br/>";
echo "<a href='?id=$forum[id]&grafik'><span style='color:#79358c'>Показать опрос графично</span></a><br/>";
}
else
{
echo output_text($forum['text'])."<br />n";
}
if(user_access('forum_them_edit'))echo "<a href='?id=$forum[id]&edit_them'>[изм]</a>n";
elseif(isset($user) && $user['id']==$avtor['id'] && $forum['time']>time()-600 && $forum['close']==0)echo "<a href='?id=$forum[id]&edit_them'>[изм (".($forum['time']+600-time())." сек)]</a>n";
echo "</div>n";
$last_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $forum[last_id_user] LIMIT 1"));
$close_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $forum[close_id_user] LIMIT 1"));
if($forum['last_id_user']!=0)echo "<div class='block_hr'></div><div class='row4'><span style='color:darkred;font-size:small'>Последний раз редактировалось <a href='/info.php?id=$last_user[id]'>$last_user[nick]</a> ".vremja($forum['last_time']).".</span></div>n";
if($forum['close_id_user']!=0 && $forum['close']!=0)echo "<div style='color:white;font-size:small;background-color:#999999;margin-top:4px;padding-left:5px;padding-bottom:2px;border:1px dotted darkred'>Тема закрыта модератором $close_user[nick]</a></div>n";
if(isset($user))
{
echo "<div class='busi'>n";
$count_bookmarks = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_bookmarks` WHERE `id_them` = '$forum[id]' AND `private` = '0'"),0);
$bm=mysql_fetch_array(mysql_query("SELECT * FROM `forum_bookmarks` WHERE `id_user` = '$user[id]' AND `id_them` = '$forum[id]' LIMIT 1"));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_bookmarks` WHERE `id_user` = '$user[id]' AND `id_them` = '$forum[id]' LIMIT 1"),0)!=0)echo "<img class='icon' src='http://i.spaces.ru/star_fav_green.gif' alt=''/><a class='icolink' href='?bookmarks&edit=$bm[id]'>В закладках</a>n";
else echo "<img class='icon' src='http://i.spaces.ru/star_fav.gif' alt=''/><a class='icolink' href='?bookmarks&add=$forum[id]'>В закладки</a>n";
if($count_bookmarks>0)echo "<a class='icolink' href='?id=$forum[id]&user_bm'>($count_bookmarks)</a>n";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_bookmarks` WHERE `id_user` = '$user[id]' AND `id_them` = '$forum[id]' LIMIT 1"),0)!=0)echo " <a class='icolink' href='?bookmarks&del=$bm[id]' title='удалить' style='color:red;font-size:small'><b>x</b></a>n";
echo " | <img src='http://spaces.ru/i/com_closed.gif' alt=''>n";
if($user['level']!=0)$count_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]'"),0);
elseif(isset($user))$count_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]' AND `skrit` = '0'"),0);
else $count_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]' AND `skrit` = '0'"),0);
echo "<span style='font-size:small'><a href='?id=$forum[id]&new_cmpl_them'><b>Жалоба</b></a>n";
if(user_access('forum_them_edit'))
{
echo "<div class='row4'><span style='font-size: small'>[<a href='/forumm/?move=$forum[id]'><span style='color: #009966'>перем</span></a>]</span>n";
if($forum['close']==0 && user_access('forum_them_edit'))echo " <span style='font-size: small'>[<a href='?id=$forum[id]&close_them_ok'><span style='color: #009966'>закрыть</span></a>]</span>n";
elseif($forum['close']==1 && user_access('forum_them_edit'))echo " <span style='font-size: small'>[<a href='?id=$forum[id]&open_them_ok'><span style='color: #009966'>открыть</span></a>]</span>n";
echo " <span style='font-size: small'>[<a href='/adm_panel/ban.php?id=$avtor[id]'><span style='color: red'>бан</span></a>]</span> <span style='font-size: small'>[<a href='?id=$forum[id]&del_them'><span style='color: red'>удал</span></a>]</span> </div>n";
}
}
echo "<div style='color: #b40000; font-size: small'>Комментариев: $count_komm</div>n";
if(isset($user))echo "</div>n";
if(user_access('forum_post_ed'))$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]' ORDER BY time"),0);
else $k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$forum[id]' AND `skrit` = '0' ORDER BY time"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if(user_access('forum_post_ed'))$komm_list = mysql_query("SELECT * FROM `forum_komm` WHERE `id_them` = '$forum[id]' ORDER BY time LIMIT $start, $set[p_str]");
else $komm_list = mysql_query("SELECT * FROM `forum_komm` WHERE `id_them` = '$forum[id]' AND `skrit` = '0' ORDER BY time LIMIT $start, $set[p_str]");
if (mysql_num_rows($komm_list)==0) {
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет комментариев в теме "$forum[name]"n";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_array($komm_list))
{
/////////////////
if($post['skrit']==1 && user_access('forum_post_ed'))
{
if($num==1){
echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";
$num=0;
}else{
echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";
$num=1;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$skrit_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[skrit_id_user] LIMIT 1"));
echo "<a href='/info.php?id=$ank[id]'><span style='color:#79358c'><b>$ank[nick]</b></span></a> ".online($ank['id'])." <font color='green'>[".vremja($post['time'])."]</font><br/>n";
echo "<font color='red'>Комментарий скрыт модератором $skrit_user[nick]</font><br/>n";
if($post['sistem']==1)
{
$sistem=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[who_moved] LIMIT 1"));
$razdel_to=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $post[razdel_to] LIMIT 1"));
$razdel_at=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $post[razdel_at] LIMIT 1"));
echo "<span style='color:darkred'>Тема перенесена модератором <a href='/info.php?id=$sistem[id]'><span style='color:#79358c'><b>$sistem[nick]</b></span></a> из <span style='color:darkblue'>$razdel_at[name]</span> в <span style='color:darkblue'>$razdel_to[name]</span></span><br/>n";
}
else
{
$komm_otvet=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_otvet]' LIMIT 1"));
if($post['id_otvet']>0)
echo "Ответ для $komm_otvet[nick]:<br/>n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."<br/>n";
}
}
elseif($post['skrit']==0)
{
if($num==1){
echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";
$num=0;
}else{
echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";
$num=1;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo "<a href='/info.php?id=$ank[id]'><span style='color:#79358c'><b>$ank[nick]</b></span></a> ".online($ank['id'])." <span style='color: #209143;font-size: small'>(".vremja($post['time']).")</span><br/>n";
if($post['sistem']==1)
{
$sistem=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[who_moved] LIMIT 1"));
$razdel_to=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $post[razdel_to] LIMIT 1"));
$razdel_at=mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = $post[razdel_at] LIMIT 1"));
echo "<span style='color:darkred'>Тема перенесена модератором <a href='/info.php?id=$sistem[id]'><span style='color:#79358c'><b>$sistem[nick]</b></span></a> из <span style='color:darkblue'>$razdel_at[name]</span> в <span style='color:darkblue'>$razdel_to[name]</span></span><br/>n";
}
else
{
$komm_otvet=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_otvet]' LIMIT 1"));
if($post['id_otvet']>0)
echo "Ответ для $komm_otvet[nick]:<br/>n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['msg']))))))))."<br/>n";
}
}
if($post['sistem']==0 && $post['skrit']==0 && isset($user))echo " <a href='?id=$forum[id]&o_k=$post[id]'>[oтвет]</a>n";
if(user_access('forum_post_ed') && $post['skrit']==0)echo "<a href='?id=$forum[id]&skrit_komm_ok=$post[id]'>[скрыть]</a>n";
elseif(user_access('forum_post_ed') && $post['skrit']==1)echo "<a href='?id=$forum[id]&unskrit_komm_ok=$post[id]'>[показать]</a>n";
if(user_access('forum_post_ed') && $post['sistem']==0)echo " <a href='?id=$forum[id]&edit_komm=$post[id]'>[ред]</a> <a href='?id=$forum[id]&del_komm_ok=$post[id]'>[удалить]</a>n";
elseif(isset($user) && $user['id']==$ank['id'] && $post['time']>time()-600 && $forum['close']==0 && $post['sistem']==0)echo "<a href='?id=$forum[id]&edit_komm=$post[id]'>[ред (".($post['time']+600-time())." сек)]</a>n";
if($post['sistem']==0 && $post['skrit']==0)echo " <a href='?id=$forum[id]&new_cmpl_komm=$post[id]'>[жалоба]</a>n";
if($post['skrit']==1 && user_access('forum_post_ed'))echo "</div>n";
elseif($post['skrit']==0)echo "</div>n";
}
if (isset($_GET['grafik']) && $k_page>1)str("/forumm/?id=$forum[id]&grafik&",$k_page,$page); // Вывод страниц
elseif ($k_page>1)str("/forumm/?id=$forum[id]&",$k_page,$page); // Вывод страниц
echo "</div>n";
if(isset($user))
{
if($forum['close']==0 || user_access('forum_post_ed'))
{
echo "<form method='post' name='msg' action='?id=$forum[id]'>n";
if ($set['web'] && is_file(H.'style/themes/'.$set['set_them'].'/altername_post_form.php'))
include_once H.'style/themes/'.$set['set_them'].'/altername_post_form.php';
else echo "Сообщение:<br /><textarea name='msg'></textarea><br />n";
if ($user['set_translit']==1)echo'<label><input type="checkbox" name="translit" value="1" /> Транслит</label><br />';
echo "<input value='Отправить' type='submit' />n";
echo "</form>n";
}}
}
}
///////ФОРМА РАЗДЕЛА////////
elseif($forum['type']==razdel)
{
echo "<div class='header_path'><a href='/'>$_SERVER[HTTP_HOST]</a>/<a href='/forumm'>Форум</a>/<a href='?id=$forum[id]'>$forum[name]</a></div><div class='main'>n";
echo "<div class='row4'><b>$forum[name]</b> n";
if(user_access('forum_razd_edit'))echo "<a href='?id=$forum[id]&edit_razdel'>[изм]</a>n";echo "</div>n";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `mother` = '$forum[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$tema_list = mysql_query("SELECT * FROM `forum` WHERE `mother` = '$forum[id]' ORDER BY `up` DESC,`time_obnov` DESC LIMIT $start, $set[p_str]");
if (mysql_num_rows($tema_list)==0) {
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет тем в разделе "$forum[name]"n";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_array($tema_list)){if($num==1){echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";$num=0;}else{echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";$num=1;}
$ftv=mysql_fetch_array(mysql_query("SELECT * FROM `forum_them_visited` WHERE `id_them` = '$post[id]' AND `id_user` = '$user[id]' LIMIT 1"));if($user['level']!=0)$count_komm_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$post[id]' AND `time` > '$ftv[time]'"),0);else $count_komm_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$post[id]' AND `skrit` = '0' AND `time` > '$ftv[time]'"),0);if($user['level']!=0)$count_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$post[id]'"),0);else $count_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$post[id]' AND `skrit` = '0'"),0);if($post['up']>0)echo "<img src='http://i.spaces.ru//stick.gif' alt='' /> n";
echo "<a href='?id=$post[id]'>$post[name]</a> <span style='color: #209143;font-size: small'>(".vremja($post['time']).")</span>
($count_komm)n";
if($count_komm_new>0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them_visited` WHERE `id_user` = '$user[id]' AND `id_them` = '$post[id]' LIMIT 1"),0)!=0)echo " <font color='red'><b>(+$count_komm_new)</b></font>n";
if($post['close']==1)echo " <img src='http://i.spaces.ru//topic_locked.gif' alt='loced' /><br/>n";
else echo "<br/>n";
$last_user_komm = mysql_fetch_array(mysql_query("SELECT * FROM `forum_komm` WHERE `id_them` = '$post[id]' ORDER BY time DESC LIMIT 1"));
$last_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $last_user_komm[id_user] LIMIT 1"));
$avtor=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]' LIMIT 1"));
echo "<span style='color:#79358c'><b>$avtor[nick]</b></span>n";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_komm` WHERE `id_them` = '$post[id]' LIMIT 1"),0)!=0)echo " $last_user[nick] <span style='color: #209143; font-size: small'>(".vremja($last_user_komm['time']).")</span>n";
echo "</div>n";
}
if ($k_page>1)str("/forumm/?id=$forum[id]&",$k_page,$page); // Вывод страниц
if($forum['new_thems']==admods && $user['level']>0 || $forum['new_thems']==all)
{
if (isset($user) && !isset($_SESSION['time_c_t_forum']) || isset($user) && $_SESSION['time_c_t_forum']<$time-600 || $user['level']>0)
{
echo "<div class='busi'><img src='http://i.spaces.ru//lj.gif' alt=''/> <a href='?id=$forum[id]&s_t'>Создать тему</a></div>n";
}
}
if($user['level']>0)echo "<img src='http://i.spaces.ru//lj.gif' alt=''/> <a href='?id=$forum[id]&s_o'>Создать опрос</a>n";
echo "<div style='background-color:#EFF3F6;padding:2px'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='?id=$mother[id]'>$mother[name]</a> | <a href='/forumm'>Форум</a></div></div>n";
}
///////ФОРМА ПОДФОРУМА////////
elseif($forum['type']==forum)
{
echo "<div style='border-left:1px solid #abbefb;border-right:1px solid #abbefb;border-bottom:1px solid #abbefb;border-left: 1px solid #999999;border-right: 1px solid #999999;background:#e8e8e8;margin:0px;padding:3px'><a href='/'>$_SERVER[HTTP_HOST]</a>/<a href='/forumm'>Форум</a>/<a href='?id=$forum[id]'>$forum[name]</a></div><div class='main'><div style='background-color:#EFF3F6;padding:2px'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='/forumm/'>Форум</a></div>n";
echo "<div class='row4'><b>$forum[name]</b> n";
if(user_access('forum_for_edit'))echo "<a href='?id=$forum[id]&edit_forum'>[изм]</a>n";
echo "</div>n";
$razdel_list = mysql_query("SELECT * FROM `forum` WHERE `mother` = '$id' ORDER BY `up` DESC,`id` ASC");
if (mysql_num_rows($razdel_list)==0) {
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет разделов в подфоруме "$forum[name]"n";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_array($razdel_list))
{
if($num==1){echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";$num=0;}else{echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";$num=1;}
$move=$_GET[move];
if(isset($_GET['move']) && user_access('forum_them_edit') && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id` = '$move' AND `type` = 'tema' LIMIT 1"),0)!=0)
{
$move = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '$move' LIMIT 1"));
echo "<span style='color:red'>>></span> <a href='?id=$post[id]&move_ok=$move[id]'>$post[name]</a>n";
}
else
{
echo "<a href='?id=$post[id]'>$post[name]</a>n";
}
$count_them=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `count` like '%$post[id]%' AND `type` = 'tema'"),0);
$count_new_them=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `count` like '%$post[id]%' AND `type` = 'tema' AND `time` > '".(time()-86400)."'"),0);
echo "[$count_them]n";
if($count_new_them!=0)echo " <font color='green'>(+$count_new_them)</font>n";
if(strlen2($post['text'])>0)echo "<br/><span style='font-size:small'>$post[text]</span>n";
echo "</div>n";
}
if(user_access('forum_razd_create'))
{
echo "<div class='busi'><img src='http://i.spaces.ru//lj.gif' alt=''/> <a href='?id=$forum[id]&s_r'>Создать раздел</a></div>n";
}
echo "<div style='background-color:#EFF3F6;padding:2px'><img src='http://i.spaces.ru//Back.gif' alt=''/><a href='/forumm/'>Форум</a></div></div>n";
}
///////ФОРМА ФОРУМА////////
else
{
echo "<div style='border-left:1px solid #abbefb;border-right:1px solid #abbefb;border-bottom:1px solid #abbefb;border-left: 1px solid #999999;border-right: 1px solid #999999;background:#e8e8e8;margin:0px;padding:3px'>n";
echo "<a href='/'>$_SERVER[HTTP_HOST]</a>/<a href='/forumm'>Форум</a>n";
echo "</div>n";
echo "<div class='main'><div style='padding:1px;background-color:#ffffff'>n";
echo "<img src='http://i.spaces.ru//search.gif' alt=''/> <a href='/forumm/?search'><span style='color:#336699'><b>Поиск</b></span></a></div><div style='padding:2px;background-color:#fff9d7;border-top:1px solid #e2c822;border-bottom:1px solid #e2c822'><b>Разделы</b> | <a href='/forumm/?last'>Последние</a> | <a href='/forumm/?new'>Новые</a> | <a href='/forumm/?rating'>Популярные</a> | <a href='/forumm/?my_themes'>Мои темы</a> | <a href='/forumm/?my_komms'>Коммент</a></div>n";
$forum_list = mysql_query("SELECT * FROM `forum` WHERE `mother` = '$id' ORDER BY `up` DESC,`id` ASC");
if (mysql_num_rows($forum_list)==0) {
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Подфорумов ещо никто не создавалn";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_array($forum_list))
{
if($num==1){
echo "<div style='padding:1px;background-color:#edeff4;border-top:1px dotted #CCC'>";
$num=0;
}else{
echo "<div style='padding:1px;background-color:#fff;border-top:1px dotted #CCC'>";
$num=1;}
$move=$_GET[move];
if(isset($_GET['move']) && user_access('forum_them_edit') && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id` = '$move' LIMIT 1"),0)!=0)
{
$move = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '$move' LIMIT 1"));
echo "<span style='color:red'>>></span> <a href='?id=$post[id]&move=$move[id]'>$post[name]</a>n";
}
else
{
echo "<a href='?id=$post[id]'>$post[name]</a>n";
}
$count_them=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `count` like '%$post[id]%' AND `type` = 'tema'"),0);
$count_new_them=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `count` like '%$post[id]%' AND `type` = 'tema' AND `time` > '".(time()-86400)."'"),0);
if(strlen2($post['text'])>0)echo "<br/><span style='font-size:small'>$post[text]</span>n";
echo "</div>n";
}
if(user_access('forum_for_create'))
{
echo "<div class='busi'><img src='http://i.spaces.ru//lj.gif' alt=''/> <a href='?s_f'>Создать подфорум</a></div>n";
}
echo "<div style='padding:2px;background-color:#fff9d7;border-top:1px solid #e2c822;border-bottom:1px solid #e2c822'><a href='/forumm/?who_here'>Кто в Форуме?</a> | <a href='/forumm/?moders'>Модераторы</a>n";
if($user['group_access']==3 || $user['group_access']==7 || $user['group_access']==8 || $user['group_access']==9 || $user['group_access']==15)echo" | <a href='/forumm/?cmpl'>Жалобы</a>n";
echo "</div></div>";
}
}
include_once '../sys/inc/tfoot.php';
?>