phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc functions.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc functions.inc.php
Date: Fri, 22 Sep 2006 00:33:38 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/09/22 00:33:38

Modified files:
        inc            : functions.inc.php 

Log message:
        fix call to lang before it is defined in version detection and fix up 
error handler so it can be used for debugging too

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/functions.inc.php?cvsroot=phpgwapi&r1=1.199&r2=1.200

Patches:
Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -b -r1.199 -r1.200
--- functions.inc.php   20 Sep 2006 13:54:16 -0000      1.199
+++ functions.inc.php   22 Sep 2006 00:33:38 -0000      1.200
@@ -3,11 +3,12 @@
        * Has a few functions, but primary role is to load the phpgwapi
        * @author Dan Kuykendall <address@hidden>
        * @author Joseph Engo <address@hidden>
-       * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @author Dave Hall skwashd at phpgroupware.org
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: functions.inc.php,v 1.199 2006/09/20 13:54:16 sigurdne 
Exp $
+       * @version $Id: functions.inc.php,v 1.200 2006/09/22 00:33:38 skwashd 
Exp $
        */
        
        
@@ -75,8 +76,8 @@
        
        if (!function_exists('html_entity_decode'))//html_entity_decode() is 
only available in PHP4.3+
        {
-               die(lang('You appear to be using PHP %1, phpGroupWare requires 
4.3.0 or later', PHP_VERSION) . "<br>\n"
-                       . lang('Please contact your System Administrator') );
+               die('<h1>You appear to be using PHP ' . PHP_VERSION . " 
phpGroupWare requires 4.3.0 or later <br>\n"
+                       . 'Please contact your System Administrator</h1>');
        }
 
        include_once(PHPGW_API_INC.'/common_functions.inc.php');
@@ -95,13 +96,15 @@
                {
                        $vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
                }
-               $value = 
$GLOBALS['phpgw']->translation->translate("$key",$vars);
+               $value = $GLOBALS['phpgw']->translation->translate("$key", 
$vars);
                return $value;
        }
 
        /**
        * cleans up a backtrace array and converts it to a string
        *
+       * @internal this is such an ugly piece of code due to a reference to 
the error context 
+       * being in the backtrace and the error context can not be edited - see 
php.net/set_error_handler
        * @param array $bt php backtrace
        * @return string the formatted backtrace, empty if the user is not an 
admin
        */
@@ -120,7 +123,7 @@
                        $trace[0]['function'] = $bt[0]['function'];
                }
 
-               if ( isset($bt[0]['args']) && is_array($bt[0]['args']) )
+               if ( isset($bt[0]['args']) && is_array($bt[0]['args']) && 
count($bt[0]['args']) )
                {
                        $trace[0]['args'] = array($bt[0]['args'][0], 
$bt[0]['args'][1], $bt[0]['args'][2],  $bt[0]['args'][3], 
'***error_handler_content_data***');
                }
@@ -195,6 +198,16 @@
        }
 
        /**
+       * phpGroupWare Information level "error"
+       */
+       define('PHPGW_E_INFO', -512);
+
+       /**
+       * phpGroupWare debug level "error"
+       */
+       define('PHPHW_E_DEBUG', -1024);
+
+       /**
        * phpGroupWare generic error handler
        */
        function phpgw_handle_error($error_level, $error_msg, $error_file, 
$error_line)
@@ -236,12 +249,20 @@
                                $log->warn($log_args);
                                echo "\n<br>" . lang('ERROR Warning: %1 in %2 
at line %3', $error_msg, $error_file, $error_line) . "<br>\n";
                                break;
+                       case PHPGW_E_INFO:
+                               $log_args['severity'] = 'I';
+                               $log->info($log_args);
+                               break;
+                       case PHPGW_E_DEBUG:
+                               $log_args['severity'] = 'D';
+                               $log->info($log_args);
+                               break;
                        case E_NOTICE:
                        case E_USER_NOTICE:
-                       default:
-                               $log_args['severity'] = 'I';
+                               $log_args['severity'] = 'N';
                                $log->notice($log_args);
                                echo "\n<br>" . lang('ERROR Notice: %1 in %2 at 
line %3', $error_msg, $error_file, $error_line) . "<br>\n"; //this will be 
commented in the final version
+                       //No default, we just ignore it, for now
                }
        }
        set_error_handler('phpgw_handle_error');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]