|
<?php
/*
-----------------------------------------
Автор: -=КотЭ=-(-=MTV=-) и Shot(Robber)
Бесплатный WAP движок: Strongcms
Контакты: 0664452670(МТС) ибо ICQ(7296000)
Файл: index.php
-------------------------------------------
*/
require_once ('../system/function.php');
//-----Подключаем вверх-----//
$id = abs(intval($_GET['id']));
$forum_t = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_tema` WHERE `id` = '".$id."'"));
$forum_r = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_razdel` WHERE `id` = '".$forum_t['razdel']."'"));
$forum_k = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_kat` WHERE `id` = '".$forum_t['kat']."'"));
$forum_zaklad = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_zaklad` WHERE `tema` = '".$id."' and `us` = '".$user['id']."' "));
$title=''.$forum_t['name'].'';
if(!isset($user['id'])) {
echo err($title, '
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
');
require_once ('../system/footer.php');
exit;
}
require_once ('../system/header.php');
if ($user['id'])
{
$viz = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as count FROM `forum_visited` WHERE `tema` = '".$id."' AND `user_id` = '".$user['id']."'"));
if (!$viz['count'])
{
mysql_query("INSERT INTO `forum_visited` SET
`tema` = '".$id."',
`user_id` = '".$user['id']."',
`time` = '".time()."'");
} else
{
mysql_query("UPDATE `forum_visited` SET
`time`='".time()."' WHERE `user_id` = '".$user['id']."' AND `tema` = '".$id."' LIMIT 1");
}
}
if($forum_t == 0) {
echo '<div class="title">Форум | Ошибка</div><div class="podmenu"><center><b>Такой темы не существует!</b></center></div>';
require_once ('../system/footer.php');
exit();
}
echo '<div class="title"><a href="'.$HOME.'/forum/">Форум</a> | <a href="'.$HOME.'/forum/razdel'.$forum_r['id'].'">'.$forum_r['name'].'</a> | <a href="'.$HOME.'/forum/kat'.$forum_k['id'].'">'.$forum_k['name'].'</a> | '.$forum_t['name'].'</div>';
if(isset($_REQUEST['submit'])) {
$text = strong($_POST['msg']);
if(empty($text)) {
echo '<div class="podmenu"><center><b>Введите текст сообщения!</b></center></div>';
require_once ('../system/footer.php');
exit();
}
if(mb_strlen($text,'UTF-8') < 3) {
echo '<div class="podmenu"><center><b>Минимум для ввода 3 символа!</b></center></div>';
require_once ('../system/footer.php');
exit();
}
$time = mysql_query("SELECT * FROM `forum_post` WHERE `us` = '".$user['id']."' ORDER BY `time` DESC");
while($t = mysql_fetch_assoc($time)){
$forum_antispam = mysql_fetch_assoc(mysql_query("SELECT * FROM `antispam` WHERE `forum_post` "));
$timeout = $t['time'];
if((time()-$timeout) < $forum_antispam['forum_post']) {
echo '<div class="podmenu"><center><b>Пишите не чаще чем раз в '.$forum_antispam['forum_post'].' секунд!</b></center></div>';
require_once ('../system/footer.php');
exit();
}
}
mysql_query("UPDATE `forum_tema` SET `up` = '".time()."' WHERE `id` = '".$id."'");
mysql_query("INSERT INTO `forum_post` SET `kat` = '".$forum_k['id']."',`text` = '".$text."',`us` = '".$user['id']."',`time` = '".time()."',`tema` = '".$id."',`razdel` = '".$forum_r['id']."'");
##добавляем юзеру стронгов и рейтинг
$settings = mysql_fetch_assoc(mysql_query("SELECT * FROM `settings` WHERE `id` = '1'"));
mysql_query("UPDATE `users` SET `money` = '".($user['money']+$settings['forum_tem_m'])."', `rating` = '".($user['rating']+0)."' WHERE `id` = '$user[id]' LIMIT 1");
##оповещание
if($user['id'] != $forum_t['us']) {
mysql_query("INSERT INTO `lenta` SET `readlen` = '0', `time` = '".time()."', `komy` = '".$forum_t['us']."', `kto` = '".$user['id']."', `text` = 'написал в вашей [url=".$HOME."/forum/tema".$id."?selection=top]теме[/url]'");
}
header('Location: /forum/tema'.$id.'?selection=top');
exit();
}
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_post` WHERE `tema` = '".$id."' and `kat` = '".$forum_t['kat']."' and `razdel` = '".$forum_t['razdel']."'"),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
$k_post = $start+1;
$post = mysql_query("SELECT * FROM `forum_post` WHERE `tema`='".$id."' ORDER BY `id` LIMIT $start,$max");
echo '<div class="podmenu"><a href="/forum/tema'.$id.'?selection=top">Обновить</a> ';
if($forum_zaklad == 0) {
echo ' | <a href="/forum/zaklad'.$id.'">В закладки</a>';
} else {
echo ' | <a href="/forum/zaklad'.$id.'">Удалить из закладок</a>';
}
if($forum_t['status'] == 0 or $forum_t['status'] == 2 ) {
if($user['id'] == $forum_t['us'] or $user['level'] >= 1) {
echo ' | <a href="/forum/tema_close'.$id.'">Закрыть</a>';
}
}
elseif ($forum_t['status'] == 1)
{
if($user['level'] >= 1) echo ' | <a href="/forum/tema_close'.$id.'">Открыть</a>';
}
{
if($user['level'] >= 1) echo ' | <a href="/forum/red_tem'.$id.'">Перемеименовать</a>';
}
if($user['level'] >= 1) echo ' | <a href="/forum/index.php?act=move&id='.$id.'">Переместить</a>';
if($forum_t['status'] != 2) {
if($user['level'] >= 2) echo ' | <a href="/forum/tema_top'.$id.'">Закрепить</a>';
} else {
if($user['level'] >= 2) echo ' | <a href="/forum/tema_top'.$id.'">Открепить</a>';
}
if($user['level'] >= 2) echo ' | <a href="/forum/tema_del'.$id.'">Удалить</a>';
echo '</div>';
if($forum_t['status'] == 1) {
echo '<div class="podmenu">Тема закрыта для обсуждения!</div>';
}
while($a = mysql_fetch_assoc($post))
{
echo '<div class="links">'.$k_post++.'. '.nick($a['us']).'';
if($forum_t['us'] == $a['us']) echo ' <font color="green">[автор]</b></font> ';
echo ' ['.times($a['time']).']';
$reit_a = mysql_fetch_array(mysql_query('select * from `post_reit` where `post` = '.intval($a['id']).' and `kto` = "'.$user['id'].'"'));
$reit = mysql_result(mysql_query('select count(`id`) from `post_reit` where `post`= '.intval($a['id']).' and `r` = "1"'),0)
-
mysql_result(mysql_query('select count(`id`) from `post_reit` where `post`= '.intval($a['id']).' and `r` = "2"'),0);
if($forum_t['status'] != 1){
if($reit_a == 0 and $user['id'] != $a['us'])
{
$forum_vs = mysql_fetch_array(mysql_query('select * from `post_reit` where `post` = "'.$a['id'].'" and `kto` = "'.$user['id'].'" limit 1'));
$forum_vss = mysql_fetch_array(mysql_query('select * from `post_reit` where `komy` = '.$a['us'].' and `kto` = "'.$user['id'].'" ORDER BY `id` DESC limit 1'));
$antispam = mysql_fetch_assoc(mysql_query("SELECT * FROM `antispam` WHERE `like`"));
$timeoute = $forum_vss['time'];
if((time()-$timeoute) < $antispam['like']) {
echo '';
}
else
{
echo '<small>[<a href="'.$HOME.'/forum/plus_p'.intval($a['id']).'?selection='.$page.'">+1</a>] [<a href="'.$HOME.'/forum/minus_p'.intval($a['id']).'?selection='.$page.'">-1</a>]</small> /';
}
}
echo '<small>[<font color="green"><b>+'.mysql_result(mysql_query("SELECT COUNT(id) FROM `post_reit` WHERE `r` = '1' and `post` = '".$a['id']."'"),0).'</b></font>] [<font color="red"><b>-'.mysql_result(mysql_query("SELECT COUNT(id) FROM `post_reit` WHERE `r` = '2' and `post` = '".$a['id']."' "),0).'</b></font>]</small></br>';
/*** Действия ***/
if($user['level'] >= 2) echo ' [<a href="/forum/post_del'.$a['id'].'">уд</a>] ';
if($user['id'] == $a['us'] or $user['level'] >= 1) echo ' [<a href="/forum/post_red'.$a['id'].'">ред</a>] ';
if($user['id'] != $a['us']) echo ' [<a href="/forum/post_otvet'.$a['id'].'">отв</a>] ';
if($user['id'] != $a['us']) echo ' [<a href="/forum/post_citata'.$a['id'].'">цит</a>] ';
/*** Действия ***/
}
echo '</div> <div class="podmenu">';
if(!$a['citata'] == NULL) echo 'Цитата:
<div class="cit">'.nick($a['citata_us']).': '.nl2br(smile(bb($a['citata']))).'</div>';
echo ''.nl2br(smile(bb($a['text']))).'</div>';
echo ''.stati($a['us']).'';
if($a['chislo_red'] > 0){
echo '<div class="links"><small>Пост отредактировал ('.$a['chislo_red'].' раз.) '.nick($a['us_red']).', '.times($a['time_red']).'</small></div>';
}
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_file` WHERE `post_id` = '".$a['id']."'"),0);
if($count) {
$load_s = mysql_query("SELECT * FROM `forum_file` WHERE `post_id`='".$a['id']."'");
echo '<div class="podmenu"><b>Прикрепленные файлы:</b>
';
while($a = mysql_fetch_array($load_s)){
echo '<a href="../files/forum/'.$a['name_file'].'">'.$a['name_file'].'</a> ['.fsize('../files/forum/'.$a['name_file']).']
';
}
echo '</div>';
}
}
if($forum_t['status'] != 1) {
echo '<div class="podmenu"><form action="" name="message" method="POST"> ';
if($user['bb_panel'] == 1) {
require_once ('../system/bbcode.php');
}
echo '<textarea name="msg" placeholder="Введите сообщение..."></textarea>
<input type="submit" name="submit" value="Написать" />
</form></div>';
}
$gde = '/forum/tema'.$id.'';
$visited = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) as count FROM `forum_visited` WHERE `tema` = '".$id."'"));
echo '<div class="podmenu">
<a href="'.$HOME.'/forum/tema'.$id.'/txt">Скачать тему в txt</a></br>
<a href="'.$HOME.'/forum/rules.php">Правила</a> |
<a href="'.$HOME.'/smile/">Смайлы</a> | <a href="'.$HOME.'/bb.php">BB коды</a> |
<a href="'.$HOME.'/forum/tema'.$id.'/who">Кто в теме</a> ('.mysql_result(mysql_query('select count(`id`) from `users` where `gde` LIKE "%'.$gde.'%" and `viz` > "'.(time()-60).'"'),0).')
| <a href="'.$HOME.'/forum/visited'.$id.'">Посетили</a> ('.$visited['count'].')</div>';
if ($k_page>1) echo str(''.$HOME.'/forum/tema'.$id.'?',$k_page,$page); // Вывод страниц
require_once ('../system/footer.php');
?>