diff --git a/include/functions.inc b/include/functions.inc
index 45564fb24ef2e7b5b3ad40e476ada54dc4f05449..72bd6723f2092d9b0e4cc94c4bbc650b13f1facf 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
<?php
/*
* This code is part of GOsa (https://gosa.gonicus.de)
- * Copyright (C) 2003 Cajus Pollmeier
+ * Copyright (C) 2003-2005 Cajus Pollmeier
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return (sprintf(_("GOsa development snapshot (Rev %s)"), $revision));
} else {
$release= preg_replace('%^.*/([^/]+)/include/functions.inc.*$%', '\1', $svn_path);
- return (sprintf(_("GOsa $release (Rev %s)"), $revision));
+ return (sprintf(_("GOsa $release"), $revision));
}
}
+function gosaRaiseError($errno, $errstr, $errfile, $errline)
+{
+ global $error_collector;
+
+ $svn_path = '$HeadURL$';
+
+ if (!preg_match('%/gosa/trunk/%', $svn_path)){
+ gosa_log ("PHP error: $errstr ($errfile, line $errline)");
+ return;
+ }
+
+ /* FIXME: workaround for buggy imap_open */
+ if (preg_match('/imap_open/', $errstr)){
+ return;
+ }
+
+ /* Extract traceback data */
+ $trace= debug_backtrace();
+
+ /* Create error header */
+ $error_collector.= "<table width=100% cellspacing=0 style='background-color:#402005;color:white;border:2px solid red'><tr><td colspan=3><b>"._("PHP error")."</b> \"$errstr\"</td></tr>";
+
+ /* Generate trace history */
+ for ($index= 1; $index<count($trace); $index++){
+ $ct= $trace[$index];
+ $loc= "";
+ if (isset($ct['class'])){
+ $loc.= _("class")." ".$ct['class'];
+ if (isset($ct['function'])){
+ $loc.= " / ";
+ }
+ }
+ if (isset($ct['function'])){
+ $loc.= _("function")." ".$ct['function'];
+ }
+ if (isset($ct['type'])){
+ switch ($ct['type']){
+ case "::":
+ $type= _("static");
+ break;
+
+ case "->":
+ $type= _("method");
+ break;
+ }
+ } else {
+ $type= "-";
+ }
+ $args= "";
+ foreach ($ct['args'] as $arg){
+ $args.= htmlentities("\"$arg\", ");
+ }
+ $args= preg_replace("/, $/", "", $args);
+ $file= $ct['file'];
+ $line= $ct['line'];
+ $color= ($index&1)?'#452510':'351500';
+ $error_collector.= "<tr style='background-color:$color'><td style='padding-left:20px' width=30%>"._("Trace")."[$index]: $loc</td>";
+ $error_collector.= "<td>"._("File").": $file ("._('Line')." $line)</td><td width=10%>"._("Type").": $type</td></tr>";
+ $error_collector.= "<tr style='background-color:$color'><td colspan=3 style='padding-left:20px;'>"._("Arguments").": $args</td></tr>";
+ }
+
+ /* Close error table */
+ $error_collector.= "</table>";
+
+ /* Write to syslog */
+ gosa_log ("PHP error: $errstr ($errfile, line $errline)");
+}
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>