From ebd0e986ed11f2a34fb58cdd33efbfab192083ad Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Fri, 22 Apr 2016 05:26:17 -0400
Subject: [PATCH] Added PHP 7 check in installer and updater.
---
server/lib/classes/ini_parser.inc.php | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/server/lib/classes/ini_parser.inc.php b/server/lib/classes/ini_parser.inc.php
index 05a7259..d4c9454 100644
--- a/server/lib/classes/ini_parser.inc.php
+++ b/server/lib/classes/ini_parser.inc.php
@@ -28,18 +28,17 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-class ini_parser {
+class ini_parser{
var $config;
function parse_ini_string($ini) {
- $ini = str_replace("\r\n","\n",$ini);
- $lines = explode("\n",$ini);
-
+ $ini = str_replace("\r\n", "\n", $ini);
+ $lines = explode("\n", $ini);
+
foreach($lines as $line) {
-
+ $line = trim($line);
if($line != '') {
- $line = trim($line);
if(preg_match("/^\[([\w\d_]+)\]$/", $line, $matches)) {
$section = strtolower($matches[1]);
} elseif(preg_match("/^([\w\d_]+)=(.*)$/", $line, $matches) && $section != null) {
@@ -58,7 +57,11 @@
foreach($this->config as $section => $data) {
$content .= "[$section]\n";
foreach($data as $item => $value) {
- if($value != '') $content .= "$item=$value\n";
+ if($value != '') {
+ $value = trim($value);
+ $item = trim($item);
+ $content .= "$item=$value\n";
+ }
}
}
return $content;
@@ -66,4 +69,4 @@
}
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1