Файл: soc-set/moduls/forum/new.php
Строк: 80
<?php
require_once('../../core/start.php');
check_auth();
head('Непрочитанные темы');
switch ($_GET['select']) {
default:
panel();
echo DIV_BLOCK . 'Непрочитанные темы' . CLOSE_DIV;
/*$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_NEW_POST." WHERE `user_id` = ? && `status` = ? ", array($user['user_id'], 1));
if ($all == 0) {
echo DIV_LI . 'Не прочитанных тем нет' . CLOSE_DIV;
} else {
$n = new Navigator($all,5,'');
$sql = DB::$dbs->query("SELECT * FROM ".FORUM_NEW_POST." WHERE `user_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, 5 ", array($user['user_id']));
while($th = $sql -> fetch()) {
$theme = DB::$dbs->queryFetch("SELECT `id`, `name`, `forum_id`, `forumc_id` FROM ".FORUMS_THEME." WHERE `id` = ? ", array($th['theme_id']));
$posts = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `theme_id` = ? ", array($theme['id']));
echo DIV_LI . '<a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
}*/
$array = array('Форум');
nav($array);
break;
case 'new_themes':
panel();
echo DIV_BLOCK . 'Новые темы' . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_THEME."");
if (empty($all)) {
echo DIV_BLOCK . 'Темы не созданы' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_post'],'select=new_themes');
$sql = DB::$dbs->query("SELECT * FROM ".FORUMS_THEME." ORDER BY `time` DESC LIMIT {$n->start()}, ".$config['write']['forum_post']."");
while($theme = $sql -> fetch()) {
$posts = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `theme_id` = ? ", array($theme['id']));
echo DIV_LI . '<a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Форум');
nav($array);
break;
case 'activ_themes':
panel();
echo DIV_BLOCK . 'Активные темы' . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_THEME."");
if (empty($all)) {
echo DIV_BLOCK . 'Темы не созданы' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_post'],'select=new_themes');
$sql = DB::$dbs->query("SELECT * FROM ".FORUMS_THEME." ORDER BY `activ` DESC LIMIT {$n->start()}, ".$config['write']['forum_post']."");
while($theme = $sql -> fetch()) {
$posts = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `theme_id` = ? ", array($theme['id']));
echo DIV_LI . '<a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Форум');
nav($array);
break;
case 'new_posts':
panel();
echo DIV_BLOCK . 'Новые посты' . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_POST."");
if (empty($all)) {
echo DIV_BLOCK . 'Сообщений нет' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_post'],'select=new_posts');
$sql = DB::$dbs->query("SELECT * FROM ".FORUM_POST." ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['forum_post']."");
while($post = $sql -> fetch()) {
echo DIV_BLOCK;
echo '<b>' . userLink($post['user_id']) . '</b> [' . vrem($post['time']) . '] ' . ($user['user_id'] != $post['user_id'] && $theme['status'] == 0 ? '<a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?post='.$post['id'].'">[Отв.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?ctpost='.$post['id'].'">[Цит.]</a>' : NULL) . ( (privilegy('forum_moder') || $post['user_id'] == $user['user_id']) && $theme['status'] == 0 ? '<a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/delete/'.$post['id'].'/">[Удал.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/edit/'.$post['id'].'/">[Ред.]</a>' : NULL) . '<br />';
if (!empty($post['ct'])) {
$ct = DB::$dbs->queryFetch("SELECT `msg` FROM ".FORUMS_POST." WHERE `id` = ? ", array($post['ct']));
echo DIV_CT . '<small><b>Цитата:</b></small><br />' . text($ct['msg']) . CLOSE_DIV;
}
echo text($post['msg']);
if (!empty($post['file'])) {
$path = '../../files/forum/'.$post['file'];
$size = get_size(filesize($path));
$path_info = pathinfo($path);
echo '<br /><br />Прикреплен файл: <a href="'.HOME.'/files/forum/'.$post['file'].'"><b>[Скачать]</b></a> ['.$path_info['extension'].'] ['.$size.']<br />';
}
echo '<br /><br /><a href="'.HOME.'/forum/'.$post['forum_id'].'/'.$post['forumc_id'].'/'.$post['theme_id'].'/"><b>Перейти в тему</b></a>';
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Форум');
nav($array);
break;
case 'my_posts':
panel();
echo DIV_BLOCK . 'Мои посты' . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_POST." WHERE `user_id` = ?", array($user['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Сообщений нет' . CLOSE_DIV;
} else {
$n = new Navigator($all,$config['write']['forum_post'],'select=new_posts');
$sql = DB::$dbs->query("SELECT * FROM ".FORUM_POST." WHERE `user_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['forum_post']."", array($user['user_id']));
while($post = $sql -> fetch()) {
echo DIV_BLOCK;
echo '<b>' . userLink($post['user_id']) . '</b> [' . vrem($post['time']) . '] ' . ($user['user_id'] != $post['user_id'] && $theme['status'] == 0 ? '<a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?post='.$post['id'].'">[Отв.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?ctpost='.$post['id'].'">[Цит.]</a>' : NULL) . ( (privilegy('forum_moder') || $post['user_id'] == $user['user_id']) && $theme['status'] == 0 ? '<a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/delete/'.$post['id'].'/">[Удал.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/edit/'.$post['id'].'/">[Ред.]</a>' : NULL) . '<br />';
if (!empty($post['ct'])) {
$ct = DB::$dbs->queryFetch("SELECT `msg` FROM ".FORUMS_POST." WHERE `id` = ? ", array($post['ct']));
echo DIV_CT . '<small><b>Цитата:</b></small><br />' . text($ct['msg']) . CLOSE_DIV;
}
echo text($post['msg']);
if (!empty($post['file'])) {
$path = '../../files/forum/'.$post['file'];
$size = get_size(filesize($path));
$path_info = pathinfo($path);
echo '<br /><br />Прикреплен файл: <a href="'.HOME.'/files/forum/'.$post['file'].'"><b>[Скачать]</b></a> ['.$path_info['extension'].'] ['.$size.']<br />';
}
echo '<br /><br /><a href="'.HOME.'/forum/'.$post['forum_id'].'/'.$post['forumc_id'].'/'.$post['theme_id'].'/"><b>Перейти в тему</b></a>';
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Форум');
nav($array);
break;
}
require_once('../../core/stop.php');
?>