Code

Macro setting will be saved in Extension_table for asterisk
[gosa.git] / include / php_setup.inc
index 08f75dfc1360279ca3ebdbc03822d41e030631f7..e746e41409943bfcd6a84cfe03b0fb610a45713c 100644 (file)
@@ -20,7 +20,7 @@
 
 function gosaRaiseError($errno, $errstr, $errfile, $errline)
 {
-  global $error_collector;
+  global $error_collector,$config;
 
   /* Return if error reporting is set to zero */
   if (error_reporting() == 0){
@@ -53,6 +53,16 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline)
     }
   }
 
+  if((isset($config->data))){ 
+    if((isset($config->data['MAIN']['DISPLAYERRORS']))&&(!preg_match("/^true$/i",$config->data['MAIN']['DISPLAYERRORS']))){
+
+      /* Write to syslog */
+      gosa_log ("PHP error: $errstr ($errfile, line $errline)");
+      return;
+    }
+  }
+
+
   /* Create header as needed */
   if ($error_collector == ""){
     if ($_SESSION['js']==FALSE){
@@ -96,8 +106,10 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline)
         $type= "-";
       }
       $args= "";
-      foreach ($ct['args'] as $arg){
-        $args.= htmlentities("\"$arg\", ");
+      if (isset($ct['args'])){
+        foreach ($ct['args'] as $arg){
+          $args.= htmlentities("\"$arg\", ");
+        }
       }
       $args= preg_replace("/, $/", "", $args);
       if ($args == ""){
@@ -115,9 +127,6 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline)
   /* Close error table */
   $error_collector.= "</table>";
 
-  /* Write to syslog */
-  gosa_log ("PHP error: $errstr ($errfile, line $errline)");
-
   /* Flush in case of fatal errors */
   if (preg_match('/^fatal/i', $errstr)){
     echo $error_collector."</div>";