Файл: modules/padmin/ads.php
Строк: 128
<?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_padmin';
if(isset($user) && $user['level'] >= 6) {
$title = _t('padmin_ads');
include_header($title);
if(isset($_GET['type']) && $_GET['type'] == 'header') {
$tpl->div('title', _t('padmin_ads_header'));
$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '1'")->rowCount();
if($adh_r == 0) {
$tpl->div('menu', _t('no_links'));
}
else
{
$adh_q = $db->query("SELECT * FROM `ads` WHERE `type` = '1'");
while($adh = $adh_q->fetch()) {
echo '<div class="post">
» <a href="/padmin/edit_link?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/delete_link?link_id='.$adh['id'].'">x</a>]
</div>';
}
}
$tpl->div('block', NAV.' <a href="/padmin/add_link?">'. _t('add_link').'</a><br/>'
. img('ads.png') .'<a href="/padmin/ads/">'. _t('padmin_ads') .'</a><br/>'
. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'
. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
} elseif(isset($_GET['type']) && $_GET['type'] == 'footer') {
$tpl->div('title', _t('padmin_ads_footer'));
$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '2'")->rowCount();
if($adh_r == 0) {
$tpl->div('menu', _t('no_links'));
}
else
{
$adh_q = $db->query("SELECT * FROM `ads` WHERE `type` = '2'");
while($adh = $adh_q->fetch()) {
echo '<div class="post">
» <a href="/padmin/edit_link?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/delete_link?link_id='.$adh['id'].'">x</a>]
</div>';
}
}
$tpl->div('block', NAV.' <a href="/padmin/add_link?">'. _t('add_link').'</a><br/>'
. img('ads.png') .'<a href="/padmin/ads/">'. _t('padmin_ads') .'</a><br/>'
. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'
. HICO .'<a href="/">'. _t('home') .'</a>');include_footer();
exit;
} elseif(isset($_GET['type']) && $_GET['type'] == 'banner') {
$tpl->div('title', _t('padmin_ads_banner'));
$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '3'")->rowCount();
if($adh_r == 0) {
$tpl->div('menu', _t('no_links'));
}
else
{
$adh_q = $db->query("SELECT * FROM `ads` WHERE `type` = '3'");
while($adh = $adh_q->fetch()) {
echo '<div class="post">
» <a href="/padmin/edit_link?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/delete_link?link_id='.$adh['id'].'">x</a>]
</div>';
}
}
$tpl->div('block', NAV.' <a href="/padmin/add_link?">'. _t('add_link').'</a><br/>'
. img('ads.png') .'<a href="/padmin/ads/">'. _t('padmin_ads') .'</a><br/>'
. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'
. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
}
$tpl->div('title', _t('padmin_ads'));
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=header">'._t('padmin_ads_header') .'</a>');
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=footer">'._t('padmin_ads_footer') .'</a>');
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=banner">'._t('padmin_ads_banner') .'</a>');
$tpl->div('block', img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
} else { header('Location: /'); exit;}
?>