From e0226507e1c14bb9b08d30b1b4e5ac4ea678aaec Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 19 May 2011 16:58:41 -0400 Subject: [PATCH] CC-2309: fix update_ini function -fixed --- install/include/AirtimeIni.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install/include/AirtimeIni.php b/install/include/AirtimeIni.php index 35637b373..65243eb08 100644 --- a/install/include/AirtimeIni.php +++ b/install/include/AirtimeIni.php @@ -155,10 +155,14 @@ class AirtimeIni { $lines = file($p_filename); $n=count($lines); - for ($i=0; $i<$n; $i++) { - if (strlen($lines[$i]) > strlen($p_property)) - if ($p_property == substr($lines[$i], 0, strlen($p_property))){ - $lines[$i] = "$p_property = $p_value\n"; + foreach ($lines as &$line) { + if ($line[0] != "#"){ + $key_value = split("=", $line); + $key = trim($key_value[0]); + + if ($key == $p_property){ + $line = "$p_property = $p_value".PHP_EOL; + } } }