From d62207327c99ea070985d46eaa8399b139914a86 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Wed, 20 Dec 2006 02:59:31 +0000 Subject: * Added new icons, and speed up icon display * Fixed ORDER BY `track` on play selected * Started work on editing/flagging albums and artists --- lib/debug.lib.php | 99 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 47 deletions(-) (limited to 'lib/debug.lib.php') diff --git a/lib/debug.lib.php b/lib/debug.lib.php index cccfd8e6..ca0d55cb 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -233,63 +233,68 @@ function check_config_values($conf) { */ function debug_read_config($config_file,$debug) { - $fp = @fopen($config_file,'r'); - if(!is_resource($fp)) return false; - $file_data = fread($fp,filesize($config_file)); - fclose($fp); + $fp = @fopen($config_file,'r'); + if(!is_resource($fp)) return false; + $file_data = fread($fp,filesize($config_file)); + fclose($fp); - // explode the var by \n's - $data = explode("\n",$file_data); - if($debug) echo "
";
-    $count = 0;
+	// explode the var by \n's
+	$data = explode("\n",$file_data);
+	if($debug) echo "
";
+	$count = 0;
 
-    $results = array();
+	if (!count($data)) { 
+		debug_event('debug_read_config','Error Unable to Read config file','1'); 	
+		return false; 
+	} 
+
+	$results = array();
     
-    foreach($data as $value) {
-        $count++;
+	foreach($data as $value) {
+	        $count++;
         
-        $value = trim($value);
+	        $value = trim($value);
        
-        if (preg_match("/^#?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$value,$matches)
-                        || preg_match("/^#?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $value, $matches)
-                        || preg_match("/^#?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$value,$matches)) {
-
-
-                if (is_array($results[$matches[1]]) && isset($matches[2]) ) {
-                        if($debug) echo "Adding value $matches[2] to existing key $matches[1]\n";
-                        array_push($results[$matches[1]], $matches[2]);
-                }
-
-                elseif (isset($results[$matches[1]]) && isset($matches[2]) ) {
-                        if($debug) echo "Adding value $matches[2] to existing key $matches[1]\n";
-                        $results[$matches[1]] = array($results[$matches[1]],$matches[2]);
-                }
-
-                elseif ($matches[2] !== "") {
-                        if($debug) echo "Adding value $matches[2] for key $matches[1]\n";
-                        $results[$matches[1]] = $matches[2];
-                }
-
-                // if there is something there and it's not a comment
-                elseif ($value{0} !== "#" AND strlen(trim($value)) > 0 AND !$test AND strlen($matches[2]) > 0) {
-                        echo "Error Invalid Config Entry --> Line:$count"; return false;
-                } // elseif it's not a comment and there is something there
-
-                else {
-                        if($debug) echo "Key $matches[1] defined, but no value set\n";
-                }
+	        if (preg_match("/^#?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$value,$matches)
+	                        || preg_match("/^#?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $value, $matches)
+	                        || preg_match("/^#?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$value,$matches)) {
+
+
+                	if (is_array($results[$matches[1]]) && isset($matches[2]) ) {
+	                        if($debug) echo "Adding value $matches[2] to existing key $matches[1]\n";
+	                        array_push($results[$matches[1]], $matches[2]);
+	                }
+
+	                elseif (isset($results[$matches[1]]) && isset($matches[2]) ) {
+	                        if($debug) echo "Adding value $matches[2] to existing key $matches[1]\n";
+        	                $results[$matches[1]] = array($results[$matches[1]],$matches[2]);
+	                }
+
+	                elseif ($matches[2] !== "") {
+	                        if($debug) echo "Adding value $matches[2] for key $matches[1]\n";
+	                        $results[$matches[1]] = $matches[2];
+        	        }
+
+	                // if there is something there and it's not a comment
+	                elseif ($value{0} !== "#" AND strlen(trim($value)) > 0 AND !$test AND strlen($matches[2]) > 0) {
+        	                echo "Error Invalid Config Entry --> Line:$count"; return false;
+	                } // elseif it's not a comment and there is something there
+	
+	                else {
+	                        if($debug) echo "Key $matches[1] defined, but no value set\n";
+	                }
 
-        } // end else
+        	} // end else
 
-    } // foreach
+	} // foreach
 
-    if (isset($config_name) && isset(${$config_name}) && count(${$config_name})) {
-        $results[$config_name] = ${$config_name};
-    }
+	if (isset($config_name) && isset(${$config_name}) && count(${$config_name})) {
+		$results[$config_name] = ${$config_name};
+	}
 
-    if($debug) echo "
"; + if($debug) echo "
"; - return $results; + return $results; } // debug_read_config -- cgit