From 6c76c91951d259f59b2b7a42b8fe895dcc0ef21b Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 23 Aug 2006 17:36:37 -0400
Subject: [PATCH] Updated Polish, Portuguese, Latvian, Chinese and Japanese localization

---
 program/include/bugs.inc |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/program/include/bugs.inc b/program/include/bugs.inc
index d67281e..771f1ae 100644
--- a/program/include/bugs.inc
+++ b/program/include/bugs.inc
@@ -63,11 +63,21 @@
                  $arg_arr['message'],
                  $arg_arr['file'],
                  $arg_arr['line']);
-
-    if ($fp = fopen($INSTALL_PATH.'logs/errors', 'a'))
+                 
+    if (empty($CONFIG['log_dir']))
+      $CONFIG['log_dir'] = $INSTALL_PATH.'logs';
+      
+    // try to open specific log file for writing
+    if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a'))
+    
       {
       fwrite($fp, $log_entry);
       fclose($fp);
+      }
+    else
+      {
+      // send error to PHPs error handler
+      trigger_error($arg_arr['message']);
       }
     }
 
@@ -93,7 +103,12 @@
   // show error if debug_mode is on
   if ($CONFIG['debug_level'] & 4)
     {
-    print "<b>$program Error in $arg_arr[file] ($arg_arr[line]):</b>&nbsp;";
+    print "<b>$program Error";
+
+    if (!empty($arg_arr['file']) && !empty($arg_arr['line']))
+      print " in $arg_arr[file] ($arg_arr[line])";
+
+    print ":</b>&nbsp;";
     print nl2br($arg_arr['message']);
     print '<br />';
     flush();

--
Gitblit v1.9.1