Файл: Arhmobi_esdcms/blog/index.php
Строк: 50
<?php
include_once '../sys/inc/start.php';
$doc = new document();
$doc->title = __('Блоги');
$listing = new listing();
$post = $listing->post();
$post->title = 'Последние записи';
$post->icon('blogg');
$listing->display();
$q = $db->query("SELECT * FROM `blog_blog` ORDER BY `id` DESC LIMIT 5");
$listing = new listing();
while ($blog = $q->fetch()) {
$post = $listing->post();
$ank = new user((int) $blog['autor']);
if($blog['block']==1) {$post->icon('blog.X');}else{
$post->icon('blog.new');}
$post->hightlight = true;
$post->title = text::toValue($blog['name']);
$post->url = 'blog.php?blog=' . $blog['id'];
$post->time = misc::when($blog['time_create']);
$post->post .= '<img src="icons/blog_chat.png"/> Комментариев: '.$blog['comm'].'<br />';
$post->post .= '<img src="icons/blog_eye.png" class="icon"/> Просмотров: '.$blog['view'].'<br />';
}
$listing->display(__('Записи отсутствуют'));
?><br/><?
$listing = new listing();
$post = $listing->post();
$post->title = 'Категории';
$post->icon('blogg');
$listing->display();
$pages = new pages($db->query("SELECT COUNT(*) FROM `blog_cat`")->fetchColumn());
$pages->this_page(); // получаем текущую страницу
$q = $db->prepare("SELECT * FROM `blog_cat` WHERE `group_show` <= ? ORDER BY `position` ASC LIMIT $pages->limit");
$q->execute(Array($user->group));
$listing = new listing();
while ($category = $q->fetch()) {
$post = $listing->post();
$post->url = "cat.php?id=$category[id]";
$post->title = '<b>'.text::toOutput($category['name']).'</b>';
$post->icon('forum.category');
$res = $db->query("SELECT COUNT(*) FROM `blog_blog` WHERE `id_cat` = '$category[id]'");
$post->counter = $res->fetchColumn();
$post->post = text::toOutput($category['description']);
}
$listing->display(__('Доступных Вам категорий нет'));
$pages->display('?'); // вывод страниц
if ($user->group >= 4) {
$doc->act(__('Настройка записей'), 'sys.blog.php');
$doc->act(__('Создать категорию'), 'category.new.php');
}
if ($user->group >0) {
$doc->act(__('Мои записи'), 'my.php');}
?>