Example #1
0
 public static function GetPage($dinfo)
 {
     $pagedef = DPageDef::GetInstance();
     $type = $dinfo->Get(DInfo::FLD_View);
     $pid = $dinfo->Get(DInfo::FLD_PID);
     return $pagedef->_pageDef[$type][$pid];
 }
Example #2
0
 private function migrate_allconf2xml()
 {
     if (($vhosts = $this->_root->GetChildren('virtualhost')) != NULL) {
         if (!is_array($vhosts)) {
             $vhosts = array($vhosts);
         }
         $filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_VH);
         foreach ($vhosts as $vh) {
             $vhname = $vh->Get(CNode::FLD_VAL);
             $vhroot = $vh->GetChildVal('vhRoot');
             $vhconf = $vh->GetChildVal('configFile');
             $conffile = PathTool::GetAbsFile($vhconf, 'VR', $vhname, $vhroot);
             $vhdata = new CData(DInfo::CT_VH, $conffile);
             $this->save_xml_file($vhdata->_root, $filemap, $vhdata->_xmlpath);
             $this->copy_permission($vhdata->_path, $vhdata->_xmlpath);
             error_log("  converted {$vhdata->_path} to {$vhdata->_xmlpath}\n");
         }
     }
     if (($tps = $this->_root->GetChildren('vhTemplate')) != NULL) {
         if (!is_array($tps)) {
             $tps = array($tps);
         }
         $filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_TP);
         foreach ($tps as $tp) {
             $tpconf = $tp->GetChildVal('templateFile');
             $conffile = PathTool::GetAbsFile($tpconf, 'SR');
             $tpdata = new CData(DInfo::CT_TP, $conffile);
             $this->save_xml_file($tpdata->_root, $filemap, $tpdata->_xmlpath);
             $this->copy_permission($tpdata->_path, $tpdata->_xmlpath);
             error_log("  converted {$tpdata->_path} to {$tpdata->_xmlpath}\n");
         }
     }
     $filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_SERV);
     $this->save_xml_file($this->_root, $filemap, $this->_xmlpath);
     $this->copy_permission($this->_path, $this->_xmlpath);
     error_log("  converted {$this->_path} to {$this->_xmlpath}\n");
 }
Example #3
0
 public function InitConf()
 {
     $has_pid = FALSE;
     $mid = UIBase::GrabGoodInput("request", 'm');
     if ($mid != NULL) {
         $this->_mid = $mid;
         $pid = UIBase::GrabGoodInput("request", 'p');
         if ($pid != NULL) {
             $this->_pid = $pid;
             $has_pid = TRUE;
         }
     }
     if (($pos = strpos($this->_mid, '_')) > 0) {
         $this->_view = substr($this->_mid, 0, $pos + 1);
         $this->_viewName = substr($this->_mid, $pos + 1);
         if ($this->_pid == '' || $this->_view == 'sl' || $this->_view == 'sl_' || $this->_view == 'al' || $this->_view == 'al_' || $this->_pid == 'base' || $this->_pid == 'mbr') {
             $this->_ref = $this->_viewName;
         }
         // still in serv conf
     } else {
         $this->_view = $this->_mid;
     }
     $this->_confType = $this->_mid[0] == 'a' ? self::CT_ADMIN : self::CT_SERV;
     $this->_tabs = DPageDef::GetInstance()->GetTabDef($this->_view);
     if ($has_pid) {
         if (!array_key_exists($this->_pid, $this->_tabs)) {
             die("Invalid pid - {$this->_pid} \n");
         }
     } else {
         $this->_pid = key($this->_tabs);
         // default
     }
     if ($has_pid && !isset($_REQUEST['t0']) && isset($_REQUEST['t'])) {
         $t = UIBase::GrabGoodInput('request', 't');
         if ($t != NULL) {
             $this->_tid = $t;
             $t1 = UIBase::GrabGoodInputWithReset('request', 't1');
             if ($t1 != NULL && $this->GetLast(self::FLD_TID) != $t1) {
                 $this->_tid .= '`' . $t1;
             }
             if (($r = UIBase::GrabGoodInputWithReset('request', 'r')) != NULL) {
                 $this->_ref = $r;
             }
             if (($r1 = UIBase::GrabGoodInputWithReset('request', 'r1')) != NULL) {
                 $this->_ref .= '`' . $r1;
             }
         }
     }
     $this->_act = UIBase::GrabGoodInput("request", 'a');
     if ($this->_act == NULL) {
         $this->_act = 'v';
     }
     $tokenInput = UIBase::GrabGoodInput("request", 'tk');
     $this->_token = $_SESSION['token'];
     if ($this->_act != 'v' && $this->_token != $tokenInput) {
         die('Illegal entry point!');
     }
     if ($this->_act == 'B') {
         $this->TrimLastId();
         $this->_act = 'v';
     }
     $this->_sort = UIBase::GrabGoodInput("request", 'sort');
     $this->_allActions = array('a' => array(DMsg::UIStr('btn_add'), 'fa-indent'), 'v' => array(DMsg::UIStr('btn_view'), 'fa-search-plus'), 'E' => array(DMsg::UIStr('btn_edit'), 'fa-edit'), 's' => array(DMsg::UIStr('btn_save'), 'fa-save'), 'B' => array(DMsg::UIStr('btn_back'), 'fa-reply'), 'n' => array(DMsg::UIStr('btn_next'), 'fa-step-forward'), 'd' => array(DMsg::UIStr('btn_delete'), 'fa-trash-o'), 'D' => array(DMsg::UIStr('btn_delete'), 'fa-trash-o'), 'C' => array(DMsg::UIStr('btn_cancel'), 'fa-angle-double-left'), 'i' => array(DMsg::UIStr('btn_instantiate'), 'fa-cube'), 'I' => array(DMsg::UIStr('btn_instantiate'), 'fa-cube'), 'X' => array(DMsg::UIStr('btn_view'), 'fa-search-plus'));
 }