Variables deviens une classe
This commit is contained in:
parent
c8a8695687
commit
8f67797f3b
|
@ -415,9 +415,9 @@ bureau/class/m_menu.php -text
|
||||||
bureau/class/m_mysql.php -text
|
bureau/class/m_mysql.php -text
|
||||||
bureau/class/m_piwik.php -text
|
bureau/class/m_piwik.php -text
|
||||||
bureau/class/m_quota.php -text
|
bureau/class/m_quota.php -text
|
||||||
|
bureau/class/m_variables.php -text
|
||||||
bureau/class/mime.php -text
|
bureau/class/mime.php -text
|
||||||
bureau/class/reset_stats_conf.php -text
|
bureau/class/reset_stats_conf.php -text
|
||||||
bureau/class/variables.php -text
|
|
||||||
bureau/class/vm.class.php -text
|
bureau/class/vm.class.php -text
|
||||||
bureau/index.php -text
|
bureau/index.php -text
|
||||||
bureau/locales/Makefile -text
|
bureau/locales/Makefile -text
|
||||||
|
|
|
@ -34,10 +34,10 @@ if (!$admin->enabled) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$conf = variable_init();
|
$conf = $variables->variable_init();
|
||||||
foreach ($conf as $name => $val) {
|
foreach ($conf as $name => $val) {
|
||||||
if (isset($GLOBALS['_POST'][$name])) {
|
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");
|
||||||
<tr><th><?php __("Names"); ?></th><th><?php __("Value"); ?></th><th><?php __("Comment"); ?></th></tr>
|
<tr><th><?php __("Names"); ?></th><th><?php __("Value"); ?></th><th><?php __("Comment"); ?></th></tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
foreach( variables_list() as $vars) { ?>
|
foreach( $variables->variables_list() as $vars) { ?>
|
||||||
|
|
||||||
<tr class="lst">
|
<tr class="lst">
|
||||||
<td><?php echo $vars['name']; ?></td>
|
<td><?php echo $vars['name']; ?></td>
|
||||||
|
|
|
@ -117,7 +117,6 @@ $root=ALTERNC_PANEL."/";
|
||||||
|
|
||||||
require_once($root."/class/db_mysql.php");
|
require_once($root."/class/db_mysql.php");
|
||||||
require_once($root."/class/functions.php");
|
require_once($root."/class/functions.php");
|
||||||
require_once($root."class/variables.php");
|
|
||||||
|
|
||||||
// Redirection si appel à https://(!fqdn)/
|
// Redirection si appel à https://(!fqdn)/
|
||||||
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
|
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
|
||||||
|
@ -167,13 +166,14 @@ while ($di=readdir($c)) {
|
||||||
}
|
}
|
||||||
closedir($c);
|
closedir($c);
|
||||||
/* THE DEFAULT CLASSES ARE :
|
/* THE DEFAULT CLASSES ARE :
|
||||||
dom, ftp, mail, quota, bro, admin, mem, mysql, err
|
dom, ftp, mail, quota, bro, admin, mem, mysql, err, variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Language */
|
/* Language */
|
||||||
include_once("lang_env.php");
|
include_once("lang_env.php");
|
||||||
|
|
||||||
|
$variables=new m_variables();
|
||||||
$mem=new m_mem();
|
$mem=new m_mem();
|
||||||
$err=new m_err();
|
$err=new m_err();
|
||||||
$authip=new m_authip();
|
$authip=new m_authip();
|
||||||
|
|
|
@ -35,6 +35,11 @@ function compare_logname($a, $b) {
|
||||||
return strcmp($a['name'],$b['name']);
|
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 :
|
Check if a domain can be hosted on this server :
|
||||||
Return a negative value in case of an error,
|
Return a negative value in case of an error,
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
* @link http://cvs.drupal.org/viewcvs/drupal/drupal/includes/bootstrap.inc?rev=1.38&view=auto
|
* @link http://cvs.drupal.org/viewcvs/drupal/drupal/includes/bootstrap.inc?rev=1.38&view=auto
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class m_variables {
|
||||||
/**
|
/**
|
||||||
* Load the persistent variable table.
|
* Load the persistent variable table.
|
||||||
*
|
*
|
||||||
|
@ -67,7 +68,7 @@ function variable_init($conf = array()) {
|
||||||
function variable_init_maybe() {
|
function variable_init_maybe() {
|
||||||
global $conf;
|
global $conf;
|
||||||
if (!isset($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;
|
global $conf;
|
||||||
$name=str_replace('.', '_', $name); // Php can't handle POST var with a '.'
|
$name=str_replace('.', '_', $name); // Php can't handle POST var with a '.'
|
||||||
|
|
||||||
variable_init_maybe();
|
$this->variable_init_maybe();
|
||||||
|
|
||||||
if (isset($conf[$name])) {
|
if (isset($conf[$name])) {
|
||||||
return $conf[$name];
|
return $conf[$name];
|
||||||
} elseif (!is_null($createit_comment)) {
|
} elseif (!is_null($createit_comment)) {
|
||||||
variable_set($name, $default, $createit_comment);
|
$this->variable_set($name, $default, $createit_comment);
|
||||||
}
|
}
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,7 @@ function variable_set($name, $value, $comment=null) {
|
||||||
|
|
||||||
$db->query("$query");
|
$db->query("$query");
|
||||||
|
|
||||||
variable_init();
|
$this->variable_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,4 +158,5 @@ function variables_list() {
|
||||||
return $t;
|
return $t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} /* Class m_variables */
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue