Файл: Arhmobi_esdcms/theme/index.php
Строк: 30
<?php
include_once '../sys/inc/start.php';
$doc = new document();
$doc->title = __('Все темы');
$pages = new pages;
$res = $db->query("SELECT COUNT(*) FROM `theme`");
$pages->posts = $res->fetchColumn(); // количество сообщений
$q = $db->query("SELECT * FROM `theme` ORDER BY `id` DESC LIMIT ".$pages->limit);
$listing = new listing();
if ($arr = $q->fetchAll()) {
foreach ($arr AS $theme) {
$post = $listing->post();
$ank = new user((int) $theme['id_user']);
$post->icon('themy');
$post->content = text::toOutput($theme['text']);
$post->title = text::toValue($theme['title']);
$post->url = 'comments.php?id=' . $theme['id'];
$post->time = misc::when($theme['time']);
$post->bottom = '<a href="/profile.view.php?id=' . $theme['id_user'] . '">' . $ank->nick() . '</a>';
if ($user->group >= max($ank->group, 4)) {
if (!$theme['sended']) {
$post->action('send', "theme.send.php?id=$theme[id]");
}
$post->action('edit', "theme.edit.php?id=$theme[id]"); // редактирование
$post->action('delete', "theme.delete.php?id=$theme[id]"); // удаление
}
}
}
$listing->display(__('Темы отсутствуют'));
$pages->display('?'); // вывод страниц
if ($user->group >= 4) {
$doc->act(__('Добавить тему дня'), 'theme.add.php');
}