Пример #1
0
   dom, ftp, mail, quota, bro, admin, mem, mysql, err, variables
*/
// Load file for the system class.
// Those class will not be build by default.
// They may contain forbidden action for the panel, for example: exec, system
// or files operations
// We can imagine load those class only for command-line scripts.
foreach (glob($root . "class/class_system_*.php") as $fcs) {
    if (is_readable($fcs)) {
        require_once $fcs;
    }
}
/* Language */
include_once "lang_env.php";
$variables = new m_variables();
$mem = new m_mem();
$err = new m_err();
$authip = new m_authip();
$hooks = new m_hooks();
/* Check the User identity (if required) */
if (!defined('NOCHECK')) {
    if (!$mem->checkid()) {
        $error = $err->errstr();
        include "{$root}/admin/index.php";
        exit;
    }
}
for ($i = 0; $i < count($classes); $i++) {
    $name2 = $classes[$i];
    if (isset(${$name2})) {
        continue;
Пример #2
0
 /**
  * Return the var for a specific environnement :
  *   * logged via $fqdn url
  *   * the user is $uid
  *   * $var if we want only 1 var instead of all of them
  * 
  * If $fqdn and $uid aren't specified, return the default value
  * 
  * @global m_mysql $db
  * @global m_err $err
  * @param string $fqdn
  * @param int $uid
  * @param string $var
  * @return array
  */
 function get_impersonated($fqdn = null, $uid = null, $var = null)
 {
     global $db, $err;
     $arr_var = $this->variables_list();
     // Get some vars we are going to need.
     if ($fqdn != NULL) {
         $sub_infos = m_dom::get_sub_domain_id_and_member_by_name(strtolower($fqdn));
     } else {
         $sub_infos = false;
     }
     if ($uid != NULL) {
         $creator = m_mem::get_creator_by_uid($uid);
     } else {
         $creator = false;
     }
     $variables = array();
     // Browse the array in the specific order of the strata
     foreach ($this->strata_order as $strata) {
         if (!isset($arr_var[$strata]) || !is_array($arr_var[$strata])) {
             continue;
         }
         switch ($strata) {
             case 'DEFAULT':
                 //          $variables = $this->variable_merge(array(),$arr_var['DEFAULT'][NULL]);
                 $variablesList = current($arr_var["DEFAULT"]);
                 $variables = $this->variable_merge(array(), $variablesList);
                 break;
             case 'GLOBAL':
                 $variables = $this->variable_merge($variables, $arr_var['GLOBAL'][NULL]);
                 break;
             case 'FQDN_CREATOR':
                 if (is_array($sub_infos) && isset($arr_var['FQDN_CREATOR'][$sub_infos['member_id']]) && is_array($arr_var['FQDN_CREATOR'][$sub_infos['member_id']])) {
                     $variables = $this->variable_merge($variables, $arr_var['FQDN_CREATOR'][$sub_infos['member_id']]);
                 }
                 break;
             case 'FQDN':
                 if (is_array($sub_infos) && isset($arr_var['FQDN'][$sub_infos['sub_id']]) && is_array($arr_var['FQDN'][$sub_infos['sub_id']])) {
                     $variables = $this->variable_merge($variables, $arr_var['FQDN'][$sub_infos['sub_id']]);
                 }
                 break;
             case 'CREATOR':
                 if ($creator && isset($arr_var['CREATOR'][$creator]) && is_array($arr_var['CREATOR'][$creator])) {
                     $variables = $this->variable_merge($variables, $arr_var['CREATOR'][$creator]);
                 }
                 break;
             case 'MEMBER':
                 if ($uid && isset($arr_var['MEMBER'][$uid]) && is_array($arr_var['MEMBER'][$uid])) {
                     $variables = $this->variable_merge($variables, $arr_var['MEMBER'][$uid]);
                 }
                 break;
             case 'DOMAIN':
                 //FIXME TODO
                 break;
         }
         //switch
     }
     //foreach
     // Replace needed vars
     foreach ($variables as $vv => $hh) {
         if (!isset($hh['value']) || empty($hh['value'])) {
             continue;
         }
         if (is_array($hh['value'])) {
             foreach ($hh["value"] as $key => $val) {
                 $variables[$vv]['value'][$key] = strtr($hh['value'][$key], $this->replace_array);
             }
         } else {
             $variables[$vv]['value'] = strtr($hh['value'], $this->replace_array);
         }
     }
     if ($var && isset($variables[$var])) {
         return $variables[$var];
     } else {
         return $variables;
     }
 }