<?php
/**
 * @package		Ad Platform
 * @author		Uta Marian - Alexandru ( -uMarian- )
 * @license		http://codecanyon.net/licenses
 * @link		http://www.uta-marian.com
 * @version		Version 1.0
 */

require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/users/session.user.php');

//** CHECK IF PUBLISHER IS ON or OFF **//
if ( PUBLISHER != 'ON' ) { header ( 'Location: '.HTTP_SERVER_WEBSITE.'dashboard' ); exit; }
//** END CHECK **//

$USER_ID	=	$_SESSION[USER_SESSION]['0']['user_id'];
$ID			=	$prepare->sanitize($_GET['id'],'input');

$view->channels = $db->Query("SELECT `pc_id`, `pc_user_id`, `pc_title` FROM publisher_channels where pc_user_id=?","i",$USER_ID);

$view->sizes = $db->Query("SELECT `pas_id`, `pas_name`, `pas_width`, `pas_height` FROM publishers_ads_size");



$view->ad	=	$ad = $db->Query("SELECT `pau_id`, `pau_channel_id`, `pau_user_id`, `pau_language_id`, `pau_name`, `pau_size`, `pau_size_type`, `pau_adult`, `paud_title`, `paud_link`, `paud_text`, `paud_background`, `paud_border` FROM publishers_ad_units left join publishers_ad_units_design on publishers_ad_units_design.paud_ad_unit_id = publishers_ad_units.pau_id where pau_user_id=? and pau_id=?","ii",$USER_ID,$ID);

if ( empty( $ad ) && !empty( $ID ) ) { 
	//header ( 'Location: '.HTTP_SERVER_WEBSITE.'dashboard/publisher/channels' ); exit;
}







/* set page title */
$view->title = $LANG["WBS_DB_NEW_ADV_AD"];
$view->description = $LANG["WBS_DB_NEW_ADV_AD"];
$view->keywords = $LANG["WBS_DB_NEW_ADV_AD"];

//**DEFINE CUSTOM CSS/JS FILLES**//
$view->customCode = '<link href="'.HTTP_SERVER_WEBSITE.'templates/'.WEBSITE_TEMPLATE.'/assets/css/dashboard.css" rel="stylesheet">';

$view->publisher_menu = 'on';
$view->header = $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/header.php');
$view->footer = $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/footer.php');

echo $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/plugins/publisher/ad.php');
?>