Code

Updated phoneAccount.
[gosa.git] / include / functions_debug.inc
index 9fd5d8bcdeca087e7da243a49d7dcbea03385e17..340dd97317a9c247070d1df91fb35854be1753fb 100644 (file)
@@ -127,7 +127,7 @@ class Print_a_class {
                }
                
                # build a single table ... may be nested
-               $this->output .= '<table style="border:none;" cellspacing="1" '.( !$iteration && $this->export_flag ? 'onClick="document.getElementById(\'pa_form_'.$this->export_hash.'\').submit();" )' : '' ).'>';
+               $this->output .= '<table summary=\"\" style="border:none;" cellspacing="1" '.( !$iteration && $this->export_flag ? 'onClick="document.getElementById(\'pa_form_'.$this->export_hash.'\').submit();" )' : '' ).'>';
                foreach( $array as $key => $value ) {
                        
                        $value_style = 'color:black;';
@@ -272,7 +272,7 @@ function print_result($RESULT) {
                </script>
        ';
 
-       print '<table border="0" bgcolor="#000000" cellspacing="1" cellpadding="1">';
+       print '<table summary=\"\" border="0" bgcolor="#000000" cellspacing="1" cellpadding="1">';
        
        print '<tr>';
        foreach($tables as $tableName => $tableCount) {
@@ -415,4 +415,69 @@ function pre($sql_string, $simple_mode = FALSE) {
                        
        print '<pre>'.$sql_string.'</pre>';
 }
+
+function print_array($array, $sort=true) {
+       $result= "";
+
+       if($array && is_array($array) && array_count_values($array) > 0) {
+
+               if($sort) {
+                       sort($array);
+               }
+
+               $size= count($array);
+
+               foreach($array as $value) {
+                       $result.= $value;
+
+                       if($size > 1) {
+                               $result.= ", ";
+                       }
+
+                       $size--;
+               }
+       }
+
+       return $result;
+}
+
+/** 
+ * parse php modules from phpinfo
+ * taken from user comments on php-net site
+ */
+
+function parsePHPModules() {
+       ob_start();
+       phpinfo(INFO_MODULES);
+       $s = ob_get_contents();
+       ob_end_clean();
+
+       $s = strip_tags($s,'<h2><th><td>');
+       $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
+       $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
+       $vTmp = preg_split('/(<h2>[^<]+<\/h2>)/',$s,-1,PREG_SPLIT_DELIM_CAPTURE);
+       $vModules = array();
+       for ($i=1;$i<count($vTmp);$i++) {
+               if (preg_match('/<h2>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
+                       $vName = trim($vMat[1]);
+                       $vTmp2 = explode("\n",$vTmp[$i+1]);
+                       foreach ($vTmp2 AS $vOne) {
+                               $vPat = '<info>([^<]+)<\/info>';
+                               $vPat3 = "/$vPat\s*$vPat\s*$vPat/";
+                               $vPat2 = "/$vPat\s*$vPat/";
+                               if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
+                                       $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3]));
+                               } elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
+                                       $vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
+                               }
+                       }
+               }
+       }
+       return $vModules;
+}
+
+function get_module_setting($pModuleName, $pSetting) {
+       $vModules= parsePHPModules();
+       return $vModules[$pModuleName][$pSetting];
+}
 ?>