From e61e8d49a98cd2c66d16423648395bc3c513df11 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Tue, 21 Jan 2014 16:33:52 +0000 Subject: [PATCH] Retro compatibilite --- bureau/class/m_variables.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bureau/class/m_variables.php b/bureau/class/m_variables.php index d9953b7f..906fc1da 100644 --- a/bureau/class/m_variables.php +++ b/bureau/class/m_variables.php @@ -157,14 +157,13 @@ class m_variables { */ function variable_get($name, $default = null, $createit_comment = null) { global $conf; - $name=str_replace('.', '_', $name); // Php can't handle POST var with a '.' $this->variable_init_maybe(); if (isset($conf[$name])) { return $conf[$name]['value']; } elseif (!is_null($createit_comment)) { - $this->variable_set($name, $default, $createit_comment); + $this->variable_update_or_create($name, $value, 'DEFAULT', null, null, $createit_comment); } return $default; } @@ -182,8 +181,6 @@ class m_variables { global $conf, $db, $err; $err->log('variable', 'variable_set', '+'.serialize($value).'+'.$comment.'+'); - $name=str_replace('.', '_', $name); // Php can't handle POST var with a '.' - $conf[$name] = $value; if (is_object($value) || is_array($value)) { $value = serialize($value); @@ -202,7 +199,7 @@ class m_variables { $this->variable_init(); } - function variable_update_or_create($var_name, $var_value, $strata=null, $strata_id=null, $var_id=null) { + function variable_update_or_create($var_name, $var_value, $strata=null, $strata_id=null, $var_id=null, $comment=null) { global $db, $err; $err->log('variable', 'variable_update_or_create'); @@ -214,12 +211,13 @@ class m_variables { return false; } $sql="INSERT INTO - variable (name, value, strata, strata_id) + variable (name, value, strata, strata_id, comment) VALUES ( '".mysql_real_escape_string($var_name)."', '".mysql_real_escape_string($var_value)."', '".mysql_real_escape_string($strata)."', - '".mysql_real_escape_string($strata_id)."' );"; + '".mysql_real_escape_string($strata_id)."', + '".mysql_real_escape_string($comment)."' );"; } $db->query("$sql");