Файл: modules/forum/category.php
Строк: 55
<?php
/**
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
 * @link          http://perf-engine.net
 * @package       PerfEngine
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
$locate    = 'in_forum';
// if does not active forum id go back
if(!isset($_GET['id'])) { redirect('/forum/'); }
$f_id = abs(intval($_GET['id']));
// if forum do not exists show alert
if($db->query("SELECT * FROM `forum` WHERE `id` = '". $f_id ."'")->rowCount() == 0) 
{
    $title = _t('forum');
    include_header($title);
    $tpl->div('menu', _t('forum_not_exists'));
    $tpl->div('block', NAV.' <a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .' <a href="/">'. _t('home') .'</a>');
    include_footer();
    exit;
}
// forum array
$forumf = $db->query("SELECT * FROM `forum` WHERE `id` = '". $f_id ."'")->fetch();
//title of forum
$title = $forumf['name'] .' | '._t('forum');
// showing header
include_header($title);
$tpl->div('title', $forumf['name'] .' | '._t('forum'));
// count categories
$forum_r = $db->query("SELECT * FROM `forum_c` WHERE `f_id` = '". $f_id ."'")->rowCount();
// if no categories showing alert
if($forum_r == 0) 
{
    echo $tpl->div('menu', _t('no_subforums'));
} 
else // else showing categories 
{
    $forum_q = $db->query("SELECT * FROM `forum_c` WHERE `f_id` = '". $f_id ."' ORDER BY pos");
    while($forum = $forum_q->fetch()) 
    {
        $tpl->div('menu', NAV . ' <a href="/forum/section/'. $forum['id'] .'/">'. $forum['name'] .'</a> ('. $db->query("SELECT * FROM `forum_t` WHERE `cat_id` = '". $forum['id'] ."'")->rowCount() .') ' . (User::level() >= 6 ? ' [<a href="/forum/delete_cat/'.$forum['id'].'/">'.img('delete.png').'</a> | <a href="/forum/edit_cat/'.$forum['id'].'/">'.img('edit.png').'</a>]' : NULL) .' <br/>
        <small>'. $forum['desc'] .'</small>');
    }
}
// navigation and footer
$tpl->div('block', (User::level() >=6 ? NAV.' <a href="/forum/add_subforum/'. $f_id .'/">'. _t('create_subforum') .'</a><br/>' : NULL) . NAV . ' <a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .' <a href="/">'. _t('home') .'</a>');
include_footer();
?>