Location: PHPKode > projects > Gnew > Gnew-2013.1/admin/index.php
<?php
// -----------------------------------------------------------------------------
// $Id: index.php 573 2013-03-12 08:05:00Z raoul $
//
// Copyright (C) 2013 Raoul Proença
// License: GNU GPL version 3 (see copying.txt file)
// Website: http://www.gnew.fr/
// -----------------------------------------------------------------------------
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------

include('./../includes/common.php');

page_header($lang['ADMIN_INDEX']);

// Moderator?
if ($users['user_level'] < 2)
{
    error_template($lang['ERROR_ADMIN_ACCESS']);
}
else
{
    $sql->query('SELECT news_id
                 FROM ' . TABLE_NEWS . '
                 WHERE news_active = \'0\'');
    $num_news = $sql->num_rows();
    // Moderator?
    if ($users['user_level'] > 1)
    {
        $news_links = '<a href="./../admin/news.php" title="' . $lang['ADD_NEWS'] . '">' . $lang['ADD_NEWS'] . '</a> | <a href="./../admin/news.php?action=view_news" title="' . $lang['EDIT_NEWS'] . '">' . $lang['EDIT_NEWS'] . '</a>';
        if ($num_news > 0)
        {
            $news_links .= ' | <a href="./../admin/news.php?action=view_submitted_news" title="' . $lang['ADD_SUBMITTED'] . '">' . $lang['ADD_SUBMITTED'] . '</a> (' . $num_news . ')';
        }
    }
    // Advanced moderator?
    if ($users['user_level'] > 2)
    {
        $articles_links = '<a href="./../admin/articles.php" title="' . $lang['ADD_ARTICLES'] . '">' . $lang['ADD_ARTICLES'] . '</a> | <a href="./../admin/articles.php?action=view_articles" title="' . $lang['EDIT_ARTICLES'] . '">' . $lang['EDIT_ARTICLES'] . '</a>';
        $categories_links = '<a href="./../admin/categories.php" title="' . $lang['ADD_CATEGORIES'] . '">' . $lang['ADD_CATEGORIES'] . '</a> | <a href="./../admin/categories.php?action=view_categories" title="' . $lang['EDIT_CATEGORIES'] . '">' . $lang['EDIT_CATEGORIES'] . '</a>';
    }
    else
    {
        $articles_links = $lang['ERROR_LEVEL_ARTICLES'];
        $categories_links = $lang['ERROR_LEVEL_CATEGORIES'];
    }
    // Administrator?
    if ($users['user_level'] > 3)
    {
        $advanced_link = '<a href="./../admin/advanced.php" title="' . $lang['ADVANCED_ADMIN'] . '">' . $lang['ADVANCED_ADMIN'] . '</a>';
    }
    else
    {
        $advanced_link = $lang['ERROR_ADVANCED_ACCESS'];
    }
    $template->set_file('admin', 'admin/index.htpl');
    $template->set_var(array('ADVANCED_LINK' => $advanced_link,
                             'ARTICLES_LINKS' => $articles_links,
                             'CATEGORIES_LINKS' => $categories_links,
                             'CHECK_VERSION' => check_version(),
                             'NEWS_LINKS' => $news_links));
    $template->parse('admin');
}

page_footer();

?>
Return current item: Gnew