|
<?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 `admforum_tema` WHERE `id` = '".$id."'"));
$forum_r = mysql_fetch_assoc(mysql_query("SELECT * FROM `admforum_razdel` WHERE `id` = '".$forum_t['razdel']."'"));
$forum_k = mysql_fetch_assoc(mysql_query("SELECT * FROM `admforum_kat` WHERE `id` = '".$forum_t['kat']."'"));
$forum_zaklad = mysql_fetch_assoc(mysql_query("SELECT * FROM `admforum_zaklad` WHERE `tema` = '".$id."' and `us` = '".$user['id']."' "));
$title=''.$forum_t['name'].'';
require_once ('../system/header.php');
if(!$user['id'] or $user['level'] < 1) {
echo err($title, 'У вас не достаточно прав для просмотра данной страницы!');
require_once ('../system/footer.php'); exit;
}
if ($user['id'])
{
$viz = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as count FROM `admforum_visited` WHERE `tema` = '".$id."' AND `user_id` = '".$user['id']."'"));
if (!$viz['count'])
{
mysql_query("INSERT INTO `admforum_visited` SET
`tema` = '".$id."',
`user_id` = '".$user['id']."',
`time` = '".time()."'");
} else
{
mysql_query("UPDATE `admforum_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.'/admforum/">Форум</a> | <a href="'.$HOME.'/admforum/razdel'.$forum_r['id'].'">'.$forum_r['name'].'</a> | <a href="'.$HOME.'/admforum/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 `admforum_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 `admforum_tema` SET `up` = '".time()."' WHERE `id` = '".$id."'");
mysql_query("INSERT INTO `admforum_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'"));
##оповещание
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."/admforum/tema".$id."?selection=top]теме в адмфоруме[/url]'");
}
header('Location: /admforum/tema'.$id.'?selection=top');
exit();
}
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `admforum_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 `admforum_post` WHERE `tema`='".$id."' ORDER BY `id` LIMIT $start,$max");
echo '<div class="podmenu"><a href="/admforum/tema'.$id.'?selection=top">Обновить</a> ';
if($admforum_zaklad == 0) {
echo ' | <a href="/admforum/zaklad'.$id.'">В закладки</a>';
} else {
echo ' | <a href="/admforum/zaklad'.$id.'">Удалить из закладок</a>';
}
if( $forum_t['status'] == 0 or $forum_t['status'] == 2 ) {
if($user['level'] >= 1) echo ' | <a href="/admforum/tema_close'.$id.'">Закрыть</a>';
}
elseif ($forum_t['status'] == 1)
{
if($user['level'] >= 1) echo ' | <a href="/admforum/tema_close'.$id.'">Открыть</a>';
}
if($user['level'] >= 1) echo ' | <a href="/admforum/index.php?act=move&id='.$id.'">Переместить</a>';
if($forum_t['status'] != 2) {
if($user['level'] >= 2) echo ' | <a href="/admforum/tema_top'.$id.'">Закрепить</a>';
} else {
if($user['level'] >= 2) echo ' | <a href="/admforum/tema_top'.$id.'">Открепить</a>';
}
if($user['level'] >= 2) echo ' | <a href="/admforum/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']).' ['.vremja($a['time']).']';
/*** Действия ***/
if($user['level'] >= 2) echo ' [<a href="/admforum/post_del'.$a['id'].'">уд</a>] ';
if($user['id'] == $a['us'] or $user['level'] >= 1) echo ' [<a href="/admforum/post_red'.$a['id'].'">ред</a>] ';
if($user['id'] != $a['us']) echo ' [<a href="/admforum/post_otvet'.$a['id'].'">отв</a>] ';
if($user['id'] != $a['us']) echo ' [<a href="/admforum/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']).', '.vremja($a['time_red']).'</small></div>';
}
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `admforum_file` WHERE `post_id` = '".$a['id']."'"),0);
if($count) {
$load_s = mysql_query("SELECT * FROM `admforum_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 = '/admforum/tema'.$id.'';
$visited = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) as count FROM `forum_visited` WHERE `tema` = '".$id."'"));
if ($k_page>1) echo str(''.$HOME.'/admforum/tema'.$id.'?',$k_page,$page); // Вывод страниц
require_once ('../system/footer.php');
?>