diff --git a/.gitattributes b/.gitattributes index 677125f1..5803dcf5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -415,9 +415,9 @@ bureau/class/m_menu.php -text bureau/class/m_mysql.php -text bureau/class/m_piwik.php -text bureau/class/m_quota.php -text +bureau/class/m_variables.php -text bureau/class/mime.php -text bureau/class/reset_stats_conf.php -text -bureau/class/variables.php -text bureau/class/vm.class.php -text bureau/index.php -text bureau/locales/Makefile -text diff --git a/bureau/admin/adm_variables.php b/bureau/admin/adm_variables.php index 9e40812a..3cce8984 100644 --- a/bureau/admin/adm_variables.php +++ b/bureau/admin/adm_variables.php @@ -34,10 +34,10 @@ if (!$admin->enabled) { exit(); } -$conf = variable_init(); +$conf = $variables->variable_init(); foreach ($conf as $name => $val) { if (isset($GLOBALS['_POST'][$name])) { - variable_set($name, $GLOBALS['_POST'][$name]); + $variables->variable_set($name, $GLOBALS['_POST'][$name]); } } @@ -57,7 +57,7 @@ include_once ("head.php"); +foreach( $variables->variables_list() as $vars) { ?> diff --git a/bureau/class/config.php b/bureau/class/config.php index ae2a0054..0d4d2bfc 100644 --- a/bureau/class/config.php +++ b/bureau/class/config.php @@ -117,7 +117,6 @@ $root=ALTERNC_PANEL."/"; require_once($root."/class/db_mysql.php"); require_once($root."/class/functions.php"); -require_once($root."class/variables.php"); // Redirection si appel à https://(!fqdn)/ if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) { @@ -167,13 +166,14 @@ while ($di=readdir($c)) { } closedir($c); /* THE DEFAULT CLASSES ARE : - dom, ftp, mail, quota, bro, admin, mem, mysql, err + dom, ftp, mail, quota, bro, admin, mem, mysql, err, variables */ /* Language */ include_once("lang_env.php"); +$variables=new m_variables(); $mem=new m_mem(); $err=new m_err(); $authip=new m_authip(); diff --git a/bureau/class/functions.php b/bureau/class/functions.php index 35924a24..376787f1 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -35,6 +35,11 @@ function compare_logname($a, $b) { return strcmp($a['name'],$b['name']); } +function variable_get($name, $default = null, $createit_comment = null) { + global $variables; + return $variables->variable_get($name, $default, $createit_comment); +} + /* Check if a domain can be hosted on this server : Return a negative value in case of an error, diff --git a/bureau/class/variables.php b/bureau/class/m_variables.php similarity index 95% rename from bureau/class/variables.php rename to bureau/class/m_variables.php index c6d86fe4..5ffbb13a 100644 --- a/bureau/class/variables.php +++ b/bureau/class/m_variables.php @@ -33,6 +33,7 @@ * @link http://cvs.drupal.org/viewcvs/drupal/drupal/includes/bootstrap.inc?rev=1.38&view=auto */ +class m_variables { /** * Load the persistent variable table. * @@ -67,7 +68,7 @@ function variable_init($conf = array()) { function variable_init_maybe() { global $conf; if (!isset($conf)) { - $conf = variable_init(); + $conf = $this->variable_init(); } } @@ -90,12 +91,12 @@ function variable_get($name, $default = null, $createit_comment = null) { global $conf; $name=str_replace('.', '_', $name); // Php can't handle POST var with a '.' - variable_init_maybe(); + $this->variable_init_maybe(); if (isset($conf[$name])) { return $conf[$name]; } elseif (!is_null($createit_comment)) { - variable_set($name, $default, $createit_comment); + $this->variable_set($name, $default, $createit_comment); } return $default; } @@ -129,7 +130,7 @@ function variable_set($name, $value, $comment=null) { $db->query("$query"); - variable_init(); + $this->variable_init(); } /** @@ -157,4 +158,5 @@ function variables_list() { return $t; } +} /* Class m_variables */ ?>