View file modules/padmin/ads.php

File size: 3.72Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.ru	  *
**********************************/
$locate = 'in_padmin';
if(isset($user) && $user['level'] >= 6) {
$title = $lang->word('padmin_ads');
require_once(SYS.'/view/header.php');
if(isset($_GET['type']) && $_GET['type'] == 'header') {
	$tpl->div('title', $lang->word('padmin_ads_header'));
	$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '1'")->rowCount();
	if($adh_r == 0) {
		$tpl->div('menu', $lang->word('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/ads/edit?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/ads/delete?link_id='.$adh['id'].'">x</a>]
				</div>';
		}
	}
	$tpl->div('block', NAV.' <a href="/padmin/ads/add?">'. $lang->word('add_link').'</a><br/>' 
			. img('ads.png') .'<a href="/padmin/ads/">'. $lang->word('padmin_ads') .'</a><br/>'
			. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'
			. HICO .'<a href="/">'. $lang->word('home') .'</a>');
	require_once(SYS.'/view/footer.php');
	exit;
} elseif(isset($_GET['type']) && $_GET['type'] == 'footer') {
	$tpl->div('title', $lang->word('padmin_ads_footer'));
	$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '2'")->rowCount();
	if($adh_r == 0) {
		$tpl->div('menu', $lang->word('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/ads/edit?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/ads/delete?link_id='.$adh['id'].'">x</a>]
				</div>';
		}
	}
	$tpl->div('block', NAV.' <a href="/padmin/ads/add?">'. $lang->word('add_link').'</a><br/>' 
			. img('ads.png') .'<a href="/padmin/ads/">'. $lang->word('padmin_ads') .'</a><br/>'
			. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'
			. HICO .'<a href="/">'. $lang->word('home') .'</a>');require_once(SYS.'/view/footer.php');
	exit;
} elseif(isset($_GET['type']) && $_GET['type'] == 'banner') {
	$tpl->div('title', $lang->word('padmin_ads_banner'));
	$adh_r = $db->query("SELECT * FROM `ads` WHERE `type` = '3'")->rowCount();
	if($adh_r == 0) {
		$tpl->div('menu', $lang->word('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/ads/edit?link_id='.$adh['id'].'">'.output($adh['name']).'</a> [<a href="/padmin/ads/delete?link_id='.$adh['id'].'">x</a>]
				</div>';
		}
	}
	$tpl->div('block', NAV.' <a href="/padmin/ads/add?">'. $lang->word('add_link').'</a><br/>' 
			. img('ads.png') .'<a href="/padmin/ads/">'. $lang->word('padmin_ads') .'</a><br/>'
			. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'
			. HICO .'<a href="/">'. $lang->word('home') .'</a>');
	require_once(SYS.'/view/footer.php');
	exit;
}
$tpl->div('title',  $lang->word('padmin_ads'));
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=header">'.$lang->word('padmin_ads_header') .'</a>');
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=footer">'.$lang->word('padmin_ads_footer') .'</a>');
$tpl->div('menu', img('nav.png') . '<a href="/padmin/ads/?type=banner">'.$lang->word('padmin_ads_banner') .'</a>');
$tpl->div('block', img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
} else { header('Location: /'); exit;}
?>