diff options
author | Stephen Shkardoon <ss23@ss23.geek.nz> | 2012-01-02 23:40:02 +1100 |
---|---|---|
committer | Stephen Shkardoon <ss23@ss23.geek.nz> | 2012-01-02 23:41:20 +1100 |
commit | 3af6e0baefbeb144dea0490e05218a91a616103e (patch) | |
tree | 958dfe8533bea186a1c4ef2c9eebb835398a8bc7 /lib/debug.lib.php | |
parent | 49a1757d626b50a56e52c5174cf6ac72c89f4aed (diff) | |
download | ampache-3af6e0baefbeb144dea0490e05218a91a616103e.tar.gz ampache-3af6e0baefbeb144dea0490e05218a91a616103e.tar.bz2 ampache-3af6e0baefbeb144dea0490e05218a91a616103e.zip |
Bug where configuration file was escaped incorrectly
Bug where a timeout of 0 was incorrectly recognized
Diffstat (limited to 'lib/debug.lib.php')
-rw-r--r-- | lib/debug.lib.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/debug.lib.php b/lib/debug.lib.php index e6636976..928b4f8d 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -225,12 +225,8 @@ function check_php_memory() { */ function check_php_timelimit() { - $current = ini_get('max_execution_time'); - if (intval($current) < 60) { - return false; - } - - return true; + $current = intval(ini_get('max_execution_time')); + return ($current > 60 || $current == 0); } // check_php_timelimit @@ -352,10 +348,10 @@ function generate_config($current) { /* Put in the current value */ if ($key == 'config_version') { - $line = $key . ' = ' . addslashes($value); + $line = $key . ' = ' . escape_ini($value); } elseif (isset($current[$key])) { - $line = $key . ' = "' . addslashes($current[$key]) . '"'; + $line = $key . ' = "' . escape_ini($current[$key]) . '"'; unset($current[$key]); } // if set @@ -370,6 +366,18 @@ function generate_config($current) { } // generate_config /** + * escape_ini + * Escape a value used for inserting into an ini file. + * Won't quote ', like addslashes does. + */ +function escape_ini($str) { + + return str_replace('"', '\"', $str); + +} + + +/** * debug_ok * Return an "OK" with the specified string */ |