rights =isset($_SESSION['user_info']['permissions'][RIGHT_STATICS])?(int)($_SESSION['user_info']['permissions'][RIGHT_STATICS]):0; $this->is_admin=($this->rights&RIGHT_ADMIN)>0; $this->is_edit =($this->is_admin && isset($_REQUEST['_edit'])); //--- $page=$this->GetPageName($PAGE_URL_LIST); //--- if(!empty($_REQUEST['return'])) $_SESSION['return_statcis']=$_REQUEST['return']; //--- if(!(isset($_REQUEST['a']) && $page=='edit')) { //--- если урл не верный то 404 if(empty($CURRENT_MENU) && $PAGE_NAME!='home') { C404::Show404(); } } //--- $class_name='CStaticpages_'; //--- if($page=='edit') { $this->IS_ADM_CLASS=true; $this->NOT_SHOW_LEFTMENU=false; } //--- $page_name=$class_name.$page; //--- $this->page =new $page_name(); $this->template=(!empty($this->page->template)?$this->page->template:''); //--- if(!empty($this->page) && !empty($this->page->title)) $this->title=$this->page->title; if(!empty($this->page) && !empty($this->page->keywords)) $this->keywords=$this->page->keywords; if(!empty($this->page) && !empty($this->page->description)) $this->description=$this->page->description; if(!empty($this->page) && !empty($this->page->crumbs)) $this->crumbs=$this->page->crumbs; //--- if(!empty($this->page) && isset($this->page->IS_ADM_CLASS)) $this->IS_ADM_CLASS=$this->page->IS_ADM_CLASS; if(!empty($this->page) && isset($this->page->NOT_SHOW_LEFTMENU)) $this->NOT_SHOW_LEFTMENU=$this->page->NOT_SHOW_LEFTMENU; //--- if(!empty($this->page) && isset($this->page->left_image_title)) $this->left_image_title=$this->page->left_image_title; if(!empty($this->page) && isset($this->page->left_image)) $this->left_image=$this->page->left_image; } public function GetCrumbs() { return "Главная".$this->crumbs; } public function Action($url,$action) { global $LNG; //--- if(!$this->is_admin) { C404::Show404(); } $method_name='on'.$action; //--- if(!empty($action) && method_exists($this->page,$method_name)) $this->page->$method_name($url); else $this->$method_name($url); } public function Show($url=array()) { $this->page->Show($url); } public function OnSave($url,$page=null) { global $BASE,$CACHE,$GLOBAL_CACHE_NAME; //--- if(!$this->is_admin) { CLog::write('Save','','DENIED '.$this->path); return; } //--- $model=new CModel_staticpages(); //--- CLog::write('Save','',$this->path); //--- if($this->Prepare()==false) return; //--- $body=""; if(isset($_REQUEST["subject"])) $body.="SUBJECT:".$_REQUEST["subject"]."\r\n"; //--- $body.=$_REQUEST['mbody']; //--- if($_REQUEST['module']!='emails') { $page_name='C'.$_REQUEST['module']; $page=new $page_name; //--- if(isset($page->global_cache_key) && CModel_cache::is_set($page->global_cache_key)) { CModel_cache::store($page->global_cache_key,time()); } //--- $info =$model->Get($PAGE_URL_LIST[1], "/".($this->path=="_index"?"":$this->path)); if(isset($GLOBAL_CACHE_NAME[$_REQUEST['module']])) { CModel_cache::store($GLOBAL_CACHE_NAME[$_REQUEST['module']], time()); } } file_put_contents($this->path, CModel_tools::CheckTags($body, $this->is_admin)); //--- if(empty($_SESSION['return_statcis'])) header("Location: /{$BASE}staticpages/{$PAGE_URL}"); else header("Location: ".$_SESSION['return_statcis']); unset($_SESSION['return_statcis']); exit; } public function GetPageName($url) { global $LNG; //--- $ret =null; $id =reset($url); $size_url=sizeof($url); //--- if($this->is_edit || $id=='edit') $ret='edit'; else $ret='index'; //--- if(is_null($ret)) { C404::Show404(); } //--- return $ret; } public function ShowLeftMenu($url=array()) { global $LNG,$PAGE_NAME,$MENU,$BASE; //--- include('./inc/pages/admin/versions/leftmenu.'.$LNG.'.phtml'); } public function GetTitle() { return $this->title; } } ?>