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
 protected function validatePostTbl($tbl, $extracted)
 {
     $isValid = 1;
     $tid = $tbl->Get(DTbl::FLD_ID);
     if (($index = $tbl->Get(DTbl::FLD_INDEX)) != NULL) {
         $keynode = $extracted->GetChildren($index);
         if ($keynode != NULL) {
             $holderval = $keynode->Get(CNode::FLD_VAL);
             $extracted->SetVal($holderval);
             if ($holderval != $this->_disp->GetLast(DInfo::FLD_REF)) {
                 // check conflict
                 $ref = $this->_disp->GetParentRef();
                 $location = DPageDef::GetPage($this->_disp)->GetTblMap()->FindTblLoc($tid);
                 if ($location[0] == '*') {
                     // allow multiple
                     $confdata = $this->_disp->Get(DInfo::FLD_ConfData);
                     $existingkeys = $confdata->GetChildrenValues($location, $ref);
                     if (in_array($holderval, $existingkeys)) {
                         $keynode->SetErr('This value has been used! Please choose a unique one.');
                         $isValid = -1;
                     }
                 }
             }
         }
     }
     if (($defaultExtract = $tbl->Get(DTbl::FLD_DEFAULTEXTRACT)) != NULL) {
         foreach ($defaultExtract as $k => $v) {
             $extracted->AddChild(new CNode($k, $v));
         }
     }
     $view = $this->_disp->Get(DInfo::FLD_View);
     if ($tid == 'L_GENERAL' || $tid == 'ADM_L_GENERAL') {
         $this->chkPostTbl_L_GENERAL($extracted);
     } elseif ($view == 'sl' || $view == 'al') {
         // will ignore vhlevel
         if ($tid == 'LVT_SSL') {
             $isValid = $this->chkPostTbl_L_SSL($extracted);
         } elseif ($tid == 'LVT_SSL_CERT') {
             $isValid = $this->chkPostTbl_L_SSL_CERT($extracted);
         }
     } elseif ($view == 'admin') {
         if ($tid == 'ADM_USR') {
             $isValid = $this->chkPostTbl_ADM_USR($extracted);
         } elseif ($tid == 'ADM_USR_NEW') {
             $isValid = $this->chkPostTbl_ADM_USR_NEW($extracted);
         }
     } elseif ($tid == 'V_UDB') {
         $isValid = $this->chkPostTbl_ADM_USR_NEW($extracted);
     }
     return $isValid;
 }
Example #3
0
<?php

require_once "inc/auth.php";
$disp = Service::ConfigDispData();
$page = DPageDef::GetPage($disp);
UI::PrintConfPage($disp, $page);
?>

<script type="text/javascript">

pageSetUp();

var pagefunction = function() {
	// clears memory even if nothing is in the function

<?php 
if (Service::HasChanged()) {
    ?>
	var span = $("#ribbon span");
	if (span.hasClass("hide"))
		span.removeClass("hide");
 <?php 
}
?>
};

// end pagefunction

// run pagefunction on load
pagefunction();
Example #4
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 #5
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'));
 }