From d87f76019fc231ec20d95126a7fee0487e7be5f0 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 14 Aug 2012 10:56:20 -0400
Subject: [PATCH] - Added new web folder named private to web folder layout. The folder is intended to store data that shall not be visible in the web directory, it is owned by the user of the web. - Changed ownership of web root directory to root user in all security modes to prevent symlink attacks. - Apache log files are now owned by user root. - Improved functions in system library.

---
 interface/lib/classes/ini_parser.inc.php |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/interface/lib/classes/ini_parser.inc.php b/interface/lib/classes/ini_parser.inc.php
index 349990f..6303115 100644
--- a/interface/lib/classes/ini_parser.inc.php
+++ b/interface/lib/classes/ini_parser.inc.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2006, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
@@ -28,18 +28,17 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-class ini_parser {
+class ini_parser{
 
-	var $config;
+	private $config;
 
-	function parse_ini_string($ini) {
-		$ini = str_replace("\r\n","\n",$ini);
-		$lines = explode("\n",$ini);
-		
+	//* Converts a ini string to array
+	public function parse_ini_string($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) {
@@ -52,18 +51,24 @@
 	}
 
 
-
-	function get_ini_string($file) {
+	//* Converts a config array to a string
+	public function get_ini_string($config_array = '') {
+		if($config_array == '') $config_array = $this->config;
 		$content = '';
-		foreach($this->config as $section => $data) {
+		foreach($config_array as $section => $data) {
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
-				if($value != '') $content .= "$item=$value\n";
+				if($item != ''){
+					$value 	= trim($value);
+					$item 	= trim($item);
+					$content .= "$item=$value\n";
+				}
 			}
+			$content .= "\n";
 		}
 		return $content;
 	}
 
 }
 
-?>
\ No newline at end of file
+?>

--
Gitblit v1.9.1