<?
//Автор: DjBoBaH 
//Сайт: http://my-perm.net 
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/user.php';
include $_SERVER['DOCUMENT_ROOT']."/anti_ hacker.php"; 
$timediff=mysql_result(mysql_query("SELECT `time` FROM `user` WHERE `id` = '$user[id]' LIMIT 1",$db), 0);
if($timediff < 3600)
{
include_once '../sys/inc/thead.php';
title();
echo "<div class='rekl_main'>\n";
echo 'Извените, но на данный момент Вы не можите просматривать Форум Сообщества !!! <br/>
Что бы просматривать Форум Сообщества, Вам необходимо провести 1 час на нашем сайте.<br/> За это время Вы можете по ближе познакомиться с сайтом и заполнить свою анкету или же поиграть в онлайн Игры!';
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
exit;
}
if(!isset($user))
{
$set['title']='Вы Гость';
include_once '../sys/inc/thead.php';
echo '<div class="main_menu">';
title();echo "</div>\n";
echo '<div class="rekl_main">';
err();

echo"<center>Система определила Вас как Гостя сайта, для полноценного пользования и просмотра сайта WapTu.ru Вам необходимо пройти <a href='/aut.php'>Авторизацию</a> или <br/><a href='/reg.php'>Регистрацию</a><img src='/style/smiles/ops.gif' alt='' class='icon'/></center>";
include_once '../sys/inc/tfoot.php';
exit();
}



if (isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_forum']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_them']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_thems` WHERE `id` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_post']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_mess` WHERE `id` = '".intval($_GET['id_post'])."' AND `id_them` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1
)
{
$soo=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo` WHERE `id` = '".intval($_GET['s'])."' LIMIT 1"));
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));
$them=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_thems` WHERE `id` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_mess` WHERE `id` = '".intval($_GET['id_post'])."' AND `id_them` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));
$post2=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_mess` WHERE `id_them` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' ORDER BY `id` DESC LIMIT 1"));
if (isset($user)){
$ank=get_user($post['id_user']);

if (isset($_GET['act']) && $_GET['act']=='edit' && isset($_POST['msg']) && isset($_POST['post']) &&
 // редактирование поста
(
$user['id']==$soo['admid'] 
// права группы на редактирование
||
(isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 && $user['id']==$post['id_user'] && $post['time']>time()-600 && $post['id_user']==$post2['id_user']) 
// право на редактирование своего поста, если он поседний в теме
)
)
{


$msg=$_POST['msg'];
if($user['rating']<15)$msg = strtr($msg, array('B'=>'.', 'b'=>'.', 'C'=>'.', 'c'=>'.', 'D'=>'.', 'd'=>'.', 'F'=>'.', 'f'=>'.', 'G'=>'.', 'g'=>'.', 'H'=>'.', 'h'=>'.', 'I'=>'.', 'i'=>'.', 'J'=>'.', 'j'=>'.', 'K'=>'.', 'k'=>'.', 'L'=>'.', 'l'=>'.', 'M'=>'.', 'm'=>'.', 'N'=>'...', 'n'=>'.', 'O'=>'.', 'o'=>'.', 'P'=>'.', 'p'=>'.', 'Q'=>'.', 'q'=>'.', 'R'=>'.', 'r'=>'.', 'S'=>'.', 's'=>'.', 'T'=>'.', 't'=>'.', 'U'=>'.',
'u'=>'.', 'V'=>'.', 'v'=>'.', 'W'=>'.', 'w'=>'.', 'X'=>'.', 'x'=>'.', 'Y'=>'.', 'y'=>'.', 'сайт'=>'LaFaC.Ru', '.Р у'=>'насру', '.р у'=>'пойду обосрусь', 'Р У'=>'в рот себе насру', 'Z'=>'.', 'z'=>'.')); 
if($user['rating']<15)$msg = strtr($msg, array('.ru'=>'этот сайт  очень клевый и мне здесь нравится!', '.р у'=>'[реклама]', '.r u'=>'[реклама]', '.net'=>'[реклама]', '.n e t'=>'[реклама]', 'http://'=>'SPAM!!!', '.org'=>'[реклама]', 'ru'=>'SPAM!!!', 'net'=>'[LaFaC.Ru]', 'com'=>'SPAM!!!', 'h2m.ru'=>'SPAM!!!', 'biz'=>'LaFaC.Ru', 'b i z'=>'LaFaC.Ru', 'tk'=>'LaFaC.Ru', 'mobi'=>'LaFaC.Ru', 'in'=>'LaFaC.Ru', 'us'=>'LaFaC.Ru', 'i n'=>'LaFaC.Ru', 'u s'=>'LaFaC.Ru', 'mylovcity'=>'-', 'www'=>'iii', 'wap'=>'LaFaC.Ru', 'kisma'=>'LaFaC.Ru', '.ру'=>'писюн тебе', '.РУ'=>'писюн тебе', '.Ру'=>'писюн тебе', '.рУ'=>'писюн тебе', '.Р У'=>'писюн тебе', '.Р у'=>'писюн тебе', '.р У'=>'писюн тебе', '.р у'=>'LaFaC.Ru', '.нет'=>'LaFaC.Ru', 'Ru'=>'LaFaC.Ru', 'RU'=>'LaFaC.Ru', 'rU'=>'LaFaC.Ru', 'NET'=>'LaFaC.Ru', 'US'=>'LaFaC.Ru', 'IN'=>'LaFaC.Ru', 'su'=>'LaFaC.Ru', 'SU'=>'LaFaC.Ru', 'info'=>'LaFaC.Ru'));
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)<2)$err[]='Короткое сообщение';
if (strlen2($msg)>10000)$err[]='Длина сообщения превышает предел в 10000 символjd';

$mat=antimat($msg);
if ($mat)$err[]='В тексте сообщения обнаружен мат: '.$mat;

if (!isset($err))mysql_query("UPDATE `soo_forum_mess` SET `mess` = '".my_esc($msg)."' WHERE `id` = '$post[id]' LIMIT 1");
}
elseif (isset($_GET['act']) && $_GET['act']=='edit' && isset($user) && ($user['id']==$soo['admid'] || mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 && $post['id']==$post2['id'] && $post['id_user']==$user['id'] && $post['time']>time()-600)){

$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум - редактирование поста"; // заголовок страницы
include_once '../sys/inc/thead.php';
title();


echo "<form method='post' name='message' action='?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&id_post=$post[id]&act=edit'>\n";
$msg2=output_text($post['mess'],false,true,false,false,false);
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 />\n<textarea name=\"msg\">".$msg2."</textarea><br />\n";
if ($user['set_translit']==1)echo "<label><input type=\"checkbox\" name=\"translit\" value=\"1\" /> Транслит</label><br />\n";
echo "<input name='post' value='Изменить' type='submit' /><br />\n";
echo "</form>\n";
echo "&raquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&id_post=$post[id]&act=delete\" title='Удалить пост'>Удалить пост</a><br />\n";
echo "<div class=\"rekl_main\">\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&page=end\" title='Вернуться в тему'>В тему</a><br />\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]\" title='В раздел'>".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "&laquo;<a href=\"forum.php?s=$soo[id]\">К списку форумов</a><br />\n";
echo "&laquo;<a href=\"index.php?s=$soo[id]\" title='В сообщество'>".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
}
elseif (isset($_GET['act']) && $_GET['act']=='delete' && isset($user) && $them['close']==0 && ($user['id']==$soo['admid'] || mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 && $post['id']==$post2['id'] && $post['id_user']==$user['id'] && $post['time']>time()-600)){
mysql_query("DELETE FROM `soo_forum_mess` WHERE `id` = '".intval($_GET['id_post'])."' AND `id_them` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['id_s'])."' LIMIT 1");
}
elseif (isset($_GET['act']) && $_GET['act']=='msg' && $them['close']==0 && isset($user) && (mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || $user['id']==$soo['admid'])){
$ank=get_user($post['id_user']);
$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум - ".filter_var($them['name'], FILTER_SANITIZE_SPECIAL_CHARS).""; // заголовок страницы
include_once '../sys/inc/thead.php';
echo '<div class="rekl_main">';
title();echo "</div>\n";
echo '<div class="rekl_main">';
aut();


echo "<form method='post' name='message' action='?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&act=new'>\n";
echo "<a href='/info.php?id=$ank[id]'>Посмотреть анкету</a><br />\n";
$msg2=$ank['nick'].', ';
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 />\n<textarea name=\"msg\">$ank[nick], </textarea><br />\n";
if ($user['set_translit']==1)echo "<label><input type=\"checkbox\" name=\"translit\" value=\"1\" /> Транслит</label><br />\n";
echo "<input name='post' value='Отправить сообщение' type='submit' /><br />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"rekl_main\">\n";
///echo "&raquo;<a href=\"/smiles.php\">Смайлы</a><br />\n";
echo "&raquo;<a href=\"/rules.php\">Правила</a><br />\n";
echo "</div>\n";

echo "<div class=\"rekl_main\">\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&page=end\" title='Вернуться в тему'>В тему</a><br />\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]\" title='В раздел'>".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "&laquo;<a href=\"forum.php?s=$soo[id]\">К списку форумов</a><br />\n";
echo "&laquo;<a href=\"index.php?s=$soo[id]\" title='В сообщество'>".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";

echo "</div>\n";
include_once '../sys/inc/tfoot.php';
}
elseif (isset($_GET['act']) && $_GET['act']=='cit' && $them['close']==0 && isset($user) && (mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || $user['id']==$soo['admid'])){
//$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$ank=get_user($post['id_user']);
$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум - ".filter_var($them['name'], FILTER_SANITIZE_SPECIAL_CHARS).""; // заголовок страницы
include_once '../sys/inc/thead.php';
echo '<div class="main_menu">';
title();echo "</div>\n";
echo '<div class="rekl_main">';
aut();
echo "Будет процетировано сообщение:<br />\n";

echo "<div class='cit'>\n";
echo output_text($post['mess'])."<br />\n";
echo "</div>\n";
echo "<form method='post' name='message' action='?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&act=new'>\n";
echo "<input name='cit' value='$post[id]' type='hidden' />";
$msg2=$ank['nick'].', ';
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 />\n<textarea name=\"msg\">$ank[nick], </textarea><br />\n";
if ($user['set_translit']==1)echo "<label><input type=\"checkbox\" name=\"translit\" value=\"1\" /> Транслит</label><br />\n";
echo "<input name='post' value='Отправить сообщение' type='submit' /><br />\n";
echo "</form>\n";


echo "<div class=\"rekl_main\">\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]&id_them=$them[id]&page=end\" title='Вернуться в тему'>В тему</a><br />\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]\" title='В раздел'>".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "&laquo;<a href=\"forum.php?s=$soo[id]\">К списку форумов</a><br />\n";
echo "&laquo;<a href=\"index.php?s=$soo[id]\" title='В сообщество'>".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
}

}


}







elseif (isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_forum']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_them']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_thems` WHERE `id` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1 )
{
$soo=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo` WHERE `id` = '".intval($_GET['s'])."' LIMIT 1"));
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));
$them=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_thems` WHERE `id` = '".intval($_GET['id_them'])."' AND `id_forum` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));
$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум - ".filter_var($them['name'], FILTER_SANITIZE_SPECIAL_CHARS).""; // заголовок страницы
include_once '../sys/inc/thead.php';
echo '<div class="main_menu">';
title();echo "</div>\n";
echo '<div class="rekl_main">';
$ank2=get_user($them['id_user']);


include 'inc/set_them_act.php';
if($soo['konf_soo']==0 || isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || isset($user) && $user['id']==$soo['admid'] || isset($user) && $user['level']>0)
{
include 'inc/them.php';
}
else
{
echo'Вы не можете просматривать темы форума данного сообщества<br/>';
}
include 'inc/set_them_form.php';

echo "<div class=\"rekl_main\">\n";


echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]\" title='В раздел'>".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "&laquo;<a href=\"forum.php?s=$soo[id]\">К списку форумов</a><br />\n";
echo "&laquo;<a href=\"index.php?s=$soo[id]\" title='В сообщество'>В сообщество</a><br />\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
}

elseif (isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."'"),0)==1
&& isset($_GET['id_forum']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."'"),0)==1)
{
$soo=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo` WHERE `id` = '".intval($_GET['s'])."' LIMIT 1"));
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forums` WHERE `id` = '".intval($_GET['id_forum'])."' AND `id_soo` = '".intval($_GET['s'])."' LIMIT 1"));

if (isset($user) && isset($_GET['act']) && $_GET['act']=='new' && (mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 && (!isset($_SESSION['time_c_t_forum']) || $_SESSION['time_c_t_forum']<$time-600) || $user['id']==$soo['admid']))
include 'inc/new_t.php'; // создание новой темы
else
{
$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум - ".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS).""; // заголовок страницы
include_once '../sys/inc/thead.php';
echo '<div class="main_menu">';
title();echo "</div>\n";
echo '<div class="rekl_main">';

if (isset($user) && $user['id']==$soo['admid'])include 'inc/set_razdel_act.php';
if($soo['konf_soo']==0 || isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || isset($user) && $user['id']==$soo['admid'] || isset($user) && $user['level']>0)
{
include 'inc/razdel.php';
}
else
{
echo'Вы не можете просматривать форумы данного сообщества<br/>';
}
if (isset($user) && $user['id']==$soo['admid'])include 'inc/set_razdel_form.php';

echo "<div class=\"rekl_main\">\n";
if (isset($user) && (mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 && (!isset($_SESSION['time_c_t_forum']) || $_SESSION['time_c_t_forum']<$time-600) || $user['id']==$soo['admid']))
echo "&raquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]&act=new\" title='Создать новую тему'>Новая тема</a><br />\n";
echo "&laquo;<a href=\"?s=$soo[id]&id_forum=$forum[id]\">".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)."</a><br />\n";
echo "&laquo;<a href=\"forum.php?s=$soo[id]\">Форум</a><br />\n";
echo "&laquo;<a href=\"index.php?s=$soo[id]\">В сообщество</a><br />\n";
echo "</div>\n";
}


include_once '../sys/inc/tfoot.php';
}

else
{
if (isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."'"),0)==1)
{
$soo=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo` WHERE `id` = '".intval($_GET['s'])."' LIMIT 1"));
$set['title']="".filter_var($soo['name'], FILTER_SANITIZE_SPECIAL_CHARS)." - Форум"; // заголовок страницы

include_once '../sys/inc/thead.php';
echo '<div class="main_menu">';
title();echo "</div>\n";
echo '<div class="rekl_main">';


if (isset($user) && $user['id']==$soo['admid'] && isset($_GET['act']) && isset($_GET['ok']) && $_GET['act']=='new' && isset($_POST['name']) && isset($_POST['opis']))
{

$name=esc(stripcslashes(htmlspecialchars($_POST['name'])));
if (isset($_POST['translit1']) && $_POST['translit1']==1)$name=translit($name);
if (ereg("\{|\}|\^|\%|\\$|#|@|!|\~|'|\"|`|<|>",$name))$err='В названии форума присутствуют запрещенные символы';
if (strlen2($name)<3)$err='Слишком короткое название';
if (strlen2($name)>32)$err='Слишком днинное название';
$name=my_esc($name);


$opis=$_POST['opis'];
if($user['rating']<15)$opis = strtr($opis, array('B'=>'.', 'b'=>'.', 'C'=>'.', 'c'=>'.', 'D'=>'.', 'd'=>'.', 'F'=>'.', 'f'=>'.', 'G'=>'.', 'g'=>'.', 'H'=>'.', 'h'=>'.', 'I'=>'.', 'i'=>'.', 'J'=>'.', 'j'=>'.', 'K'=>'.', 'k'=>'.', 'L'=>'.', 'l'=>'.', 'M'=>'.', 'm'=>'.', 'N'=>'...', 'n'=>'.', 'O'=>'.', 'o'=>'.', 'P'=>'.', 'p'=>'.', 'Q'=>'.', 'q'=>'.', 'R'=>'.', 'r'=>'.', 'S'=>'.', 's'=>'.', 'T'=>'.', 't'=>'.', 'U'=>'.',
'u'=>'.', 'V'=>'.', 'v'=>'.', 'W'=>'.', 'w'=>'.', 'X'=>'.', 'x'=>'.', 'Y'=>'.', 'y'=>'.', 'сайт'=>'LaFaC.Ru', '.Р у'=>'насру', '.р у'=>'пойду обосрусь', 'Р У'=>'в рот себе насру', 'Z'=>'.', 'z'=>'.')); 
if($user['rating']<15)$opis = strtr($opis, array('.ru'=>'этот сайт  очень клевый и мне здесь нравится!', '.р у'=>'[реклама]', '.r u'=>'[реклама]', '.net'=>'[реклама]', '.n e t'=>'[реклама]', 'http://'=>'SPAM!!!', '.org'=>'[реклама]', 'ru'=>'SPAM!!!', 'net'=>'[LaFaC.Ru]', 'com'=>'SPAM!!!', 'h2m.ru'=>'SPAM!!!', 'biz'=>'LaFaC.Ru', 'b i z'=>'LaFaC.Ru', 'tk'=>'LaFaC.Ru', 'mobi'=>'LaFaC.Ru', 'in'=>'LaFaC.Ru', 'us'=>'LaFaC.Ru', 'i n'=>'LaFaC.Ru', 'u s'=>'LaFaC.Ru', 'mylovcity'=>'-', 'www'=>'iii', 'wap'=>'LaFaC.Ru', 'kisma'=>'LaFaC.Ru', '.ру'=>'писюн тебе', '.РУ'=>'писюн тебе', '.Ру'=>'писюн тебе', '.рУ'=>'писюн тебе', '.Р У'=>'писюн тебе', '.Р у'=>'писюн тебе', '.р У'=>'писюн тебе', '.р у'=>'LaFaC.Ru', '.нет'=>'LaFaC.Ru', 'Ru'=>'LaFaC.Ru', 'RU'=>'LaFaC.Ru', 'rU'=>'LaFaC.Ru', 'NET'=>'LaFaC.Ru', 'US'=>'LaFaC.Ru', 'IN'=>'LaFaC.Ru', 'su'=>'LaFaC.Ru', 'SU'=>'LaFaC.Ru', 'info'=>'LaFaC.Ru'));
if (isset($_POST['translit2']) && $_POST['translit2']==1)$opis=translit($opis);
//if (strlen2($opis)<10)$err='Короткое описание';
if (strlen2($opis)>512)$err='Слишком длинное описание';
$opis=my_esc($opis);

if (!isset($err)){
mysql_query("INSERT INTO `soo_forums` (`desc`, `name`, `id_soo`) values('$opis', '$name', '$soo[id]')");
msg('Форум успешно создан');
}
}



err();
aut(); // форма авторизации

if($soo['konf_soo']==0 || isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || isset($user) && $user['id']==$soo['admid'] || isset($user) && $user['level']>0)
{
echo "<table class='post'>\n";
echo "<div class='menu_razd'>";
echo "<a href='new_t.php?s=$soo[id]'>Новые темы</a><br/>";
echo "<a href='new_p.php?s=$soo[id]'>Новые сообщения</a>";
echo "</div>";
$q=mysql_query("SELECT * FROM `soo_forums` WHERE `id_soo`='$soo[id]' ORDER BY `id` ASC");
if (mysql_num_rows($q)==0) {
echo "   <tr>\n";
echo "  <td class='main_menu'>\n";
echo "Форумов нет\n";
echo "  </td>\n";
echo "   </tr>\n";
}
while ($forum = mysql_fetch_assoc($q))
{
echo "   <tr>\n";
if ($set['set_show_icon']==2)
{
echo "  <td class='icon48' rowspan='2'>\n";
echo "<img src='/style/themes/$set[set_them]/forum/48/forum.png' />";
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo "  <td class='icon14'>\n";
echo "<img src='/style/themes/$set[set_them]/forum/14/forum.png' alt='' />";
echo "  </td>\n";
}


echo "  <td class='aut'>\n";
echo "<a href='?s=$soo[id]&id_forum=$forum[id]'>".filter_var($forum['name'], FILTER_SANITIZE_SPECIAL_CHARS)." (".mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_mess` WHERE `id_forum` = '$forum[id]' AND `id_soo`='$soo[id]'"),0).'/'.mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_thems` WHERE `id_forum` = '$forum[id]' AND `id_soo`='$soo[id]'"),0).")</a>\n";
echo "  </td>\n";
echo "   </tr>\n";

echo "   <tr>\n";

if ($set['set_show_icon']==1)echo "  <td class='p_m' colspan='2'>\n"; else echo "  <td class='p_m'>\n";
if ($forum['desc']!=NULL)echo output_text($forum['desc'])."<br />\n"; 
echo "  </td>\n";
echo "   </tr>\n";

}
echo "</table>\n";
}
else
{
echo'Вы не можете просматривать форум данного сообщества<br/>';
}
if (isset($user) && $user['id']==$soo['admid'] && (isset($_GET['act']) && $_GET['act']=='new' || mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forums` WHERE `id_soo`='$soo[id]'"),0)==0))
{
echo "<form method=\"post\" action=\"?s=$soo[id]&act=new&amp;ok\">\n";
echo "Название подфорума:<br />\n";
echo "<input name=\"name\" type=\"text\" maxlength='32' value='' /><br />\n";
if ($user['set_translit']==1)echo "<label><input type=\"checkbox\" name=\"translit1\" value=\"1\" /> Транслит</label><br />\n";
echo "Описание:<br />\n";
echo "<textarea name=\"opis\"></textarea><br />\n";
if ($user['set_translit']==1)echo "<label><input type=\"checkbox\" name=\"translit2\" value=\"1\" /> Транслит</label><br />\n";
echo "<input value=\"Создать\" type=\"submit\" /><br />\n";
echo "&laquo;<a href=\"/forum.php\">Отмена</a><br />\n";
echo "</form>\n";
}

if (isset($user) && $user['id']==$soo['admid'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forums` WHERE `id_soo`='$soo[id]'"),0)>0){
echo "<div class=\"foot\">\n";
echo "&raquo;<a href=\"forum.php?s=$soo[id]&act=new\">Новый подфорум</a><br />\n";
echo "</div>\n";
}

echo "<div class=\"foot\">\n";
echo "&raquo;<a href='index.php?s=$soo[id]'>В сообщество</a><br />\n";
echo "</div>\n";
}
elseif(!isset($_GET['s']) || isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."'"),0)==0)
{
header('Location:index.php');
}
}
include_once '../sys/inc/tfoot.php';
?>