Файл: moduls/forum/new.php
Строк: 82
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
check_auth();
switch ($_GET['select']) {
default:
head('O`qilmagan mavzular');
$array = array('Forum');
nav($array);
break;
case 'new_themes':
head('Yangi mavzular');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_THEME."");
if (empty($all)) {
echo DIV_BLOCK . 'Mavzular hali ochilmagan' . 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 . '<img src="/style/ico/boshqalar/sts.png"> <a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Forum');
nav($array);
break;
case 'activ_themes':
head('Faol mavzular');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_THEME."");
if (empty($all)) {
echo DIV_BLOCK . 'Mavzular hali ochilmagan' . 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 . '<img src="/style/ico/boshqalar/sts.png"> <a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Forum');
nav($array);
break;
case 'new_posts':
head('Yangi sharhlar');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_POST."");
if (empty($all)) {
echo DIV_BLOCK . 'Sharhlar yo`q' . 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'].'">[Jav.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?ctpost='.$post['id'].'">[Sit.]</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'].'/">[O`chr.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/edit/'.$post['id'].'/">[O`zg.]</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>Sitata:</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 />Fayl biriktirilgan: <a href="'.HOME.'/files/forum/'.$post['file'].'"><b>[Yuklash]</b></a> ['.$path_info['extension'].'] ['.$size.']<br />';
}
echo '<br /><img src="/style/ico/boshqalar/comment.png"> <a href="'.HOME.'/forum/'.$post['forum_id'].'/'.$post['forumc_id'].'/'.$post['theme_id'].'/">Mavzuga o`tish</a>';
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Forum');
nav($array);
break;
case 'my_posts':
head('Mening sharhlarim');
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_POST." WHERE `user_id` = ?", array($user['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Sharhlar yo`q' . 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'].'">[Jav.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/new_post/?ctpost='.$post['id'].'">[Sit.]</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'].'/">[O`chr.]</a> <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/edit/'.$post['id'].'/">[O`zg.]</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>Sitata:</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 />Fayl biriktirilgan: <a href="'.HOME.'/files/forum/'.$post['file'].'"><b>[Yuklash]</b></a> ['.$path_info['extension'].'] ['.$size.']<br />';
}
echo '<br /><img src="/style/ico/boshqalar/comment.png"> <a href="'.HOME.'/forum/'.$post['forum_id'].'/'.$post['forumc_id'].'/'.$post['theme_id'].'/">Mavzuga o`tish</a>';
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Forum');
nav($array);
break;
}
require_once('../../core/stop.php');
?>