<?php
	if( !$this->user->is_logged ) {
		$this->redirect('home');
	}

	$D->codpage = '';
	if ($this->param('p')) $D->codpage = $this->param('p');

	if (empty($D->codpage)) $this->redirect($C->SITE_URL.'dashboard/pages');	
	
	/*************************************************************************/
	// needed before proceeding
	require_once('_all-required-language.php');
	
	$this->load_langfile('global/global.php');	
	$this->load_langfile('inside/dashboard.php');

	/*************************************************************************/
	
	
	require_once('_all-required-dashboard.php');
	

	/*************************************************************************/
	
	$r = $this->db2->query("SELECT * FROM pages WHERE code='".$D->codpage."' AND idowner=".$this->user->id." LIMIT 1");
	
	if (!$obj = $this->db2->fetch_object($r)) {
		$this->redirect($C->SITE_URL.'dashboard/pages');
	} else {
		$D->idpage = $obj->idpage;
		$D->titlepage = stripslashes($obj->title);
		$D->description = stripslashes($obj->description);
		$D->avatar_page = $obj->avatar_page;
		$D->cover_page = $obj->cover_page;
		$D->idcategory = $obj->idcategory;
		$D->idsubcategory = $obj->idsubcategory;
	}
	
	/*************************************************************************/

	$D->optionactive = 11;
	$D->tab_active = 1;
	$this->load_template('dashboard-pages-edit.php');
?>