index 1f821e2c7ae39f59c17aae6c2d852104a4061773..2024321f3e6371307b6ba27898bc10026bc9103b 100644 (file)
{
global $error_collector,$config, $error_collector_mailto;
{
global $error_collector,$config, $error_collector_mailto;
- /* Return if error reporting is set to zero */
+ // To avoid recursion - restore original error handler.
+ restore_error_handler();
+
+ /* Return if error reporting is set to zero
+ * Also exclude statements prefixed with @ - Comment out the block below to see suppressed errors.
+ * e.g. @call_function_but_hide_errors()
+ */
if (error_reporting() == 0){
if (error_reporting() == 0){
+ set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
return;
}
/* Workaround for buggy imap_open error outputs */
if (preg_match('/imap_open/', $errstr)){
return;
}
/* Workaround for buggy imap_open error outputs */
if (preg_match('/imap_open/', $errstr)){
+ set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
return;
}
/* Hide ldap size limit messages */
if (preg_match('/ldap_error/', $errstr)){
if (preg_match('/sizelimit/', $errstr)){
return;
}
/* Hide ldap size limit messages */
if (preg_match('/ldap_error/', $errstr)){
if (preg_match('/sizelimit/', $errstr)){
+ set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
return;
}
}
/* Error messages are hidden in GOsa, so we only send them to the logging class and abort here */
return;
}
}
/* Error messages are hidden in GOsa, so we only send them to the logging class and abort here */
- if((isset($config->data))){
- if((isset($config->data['MAIN']['DISPLAYERRORS']))&&(!preg_match("/^true$/i",$config->data['MAIN']['DISPLAYERRORS']))){
+ if(isset($config->data) && $config->get_cfg_value("core","displayErrors") != "true"){
-
- /* Write to syslog */
- if(class_exists("log") && !preg_match("/No such object/",$errstr)){
- new log("view","error","",array(),"PHP error: $errstr ($errfile, line $errline)");
- }
- return;
+ /* Write to syslog */
+ if(class_exists("log") && !preg_match("/No such object/",$errstr)){
+ new log("view","error","",array(),"PHP error: $errstr ($errfile, line $errline)");
}
}
+
+ set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
+ return;
}
}
-
+
/* Send all errors to logging class, except "Ldap : No such object" messages*/
if(class_exists("log") && !preg_match("/No such object/",$errstr)){
new log("debug","all",$errfile,array(),"Type:".$errno.", Message:".$errstr.", File:".$errfile.", Line: ".$errline);
/* Send all errors to logging class, except "Ldap : No such object" messages*/
if(class_exists("log") && !preg_match("/No such object/",$errstr)){
new log("debug","all",$errfile,array(),"Type:".$errno.", Message:".$errstr.", File:".$errfile.", Line: ".$errline);
/* Mailto body header */
if(function_exists("prepare4mailbody")){
/* Mailto body header */
if(function_exists("prepare4mailbody")){
+ $version= "unknown";
+ if(function_exists("get_gosa_version")){
+ $version= get_gosa_version();
+ }
$error_collector_mailto .=prepare4mailbody(
"Oups. Seems like you've catched some kind of bug inside GOsa/PHP. You may want to help ".
"us to improve the software stability. If so, please provide some more information below.".
"\n\n".
"*** GOsa bug report ***".
$error_collector_mailto .=prepare4mailbody(
"Oups. Seems like you've catched some kind of bug inside GOsa/PHP. You may want to help ".
"us to improve the software stability. If so, please provide some more information below.".
"\n\n".
"*** GOsa bug report ***".
- "\nGOsa Version: ".get_gosa_version().
+ "\nGOsa Version: $version".
"\n\n".
"Please describe what you did to produce this error as detailed as possible. Can you ".
"reproduce this bug using the demo on http://www.gosa-project.org ?".
"\n\n".
"Please describe what you did to produce this error as detailed as possible. Can you ".
"reproduce this bug using the demo on http://www.gosa-project.org ?".
if (session::is_set('js') && session::get('js')==FALSE){
$error_collector= "<div>";
} else {
if (session::is_set('js') && session::get('js')==FALSE){
$error_collector= "<div>";
} else {
- $error_collector= "
- <table summary=\"\" width=\"100%\" style='background-color:#E0E0E0;border-bottom:1px solid black;z-index:150;'>
+ $error_collector= "
+ <table summary=\"\" class='error-collector'>
<tr>
<tr>
- <td>
- <img alt=\"\" align=\"middle\" src='".get_template_path('images/warning.png')."'>
- <font style='font-size:14px;font-weight:bold'>".
- _("Generating this page caused the PHP interpreter to raise some errors!")."
- </font>
- </td>
- <td align=right>
- <a href=\"mailto:gosa-bugs@oss.gonicus.de?subject=GOsa%20bugreport&body=%BUGBODY%\">
- <img border='0' src='images/mailto.png' title='"._("Send bug report to the GOsa Team")."' class='center' alt=''> "._("Send bugreport")."
- </a>
- </td>
- <td align=right>
- <button onClick='toggle(\"errorbox\")'>".
- _("Toggle information")."
- </button>
+ <td style='width:32px'>".image('images/toolbar-warning.png')."</td>
+ <td><span>"._("Generating this page caused the PHP interpreter to raise some errors!")."</span></td>
+ <td align='right'>
+ <a href=\"mailto:gosa-bugs@oss.gonicus.de?subject=GOsa%20bugreport&body=%BUGBODY%\">
+ ".image('images/mailto.png')." "._("Send bugreport")."
+ </a>
+ </td>
+ <td align='right'>
+ <button onClick=\"$('errorbox').toggle();\">"._("Toggle details")."</button>
</td>
</tr>
</table>
</td>
</tr>
</table>
- <div id='errorbox' style='position:absolute; z-index:150; visibility: hidden'>";
+ <div id='errorbox' style='position:absolute; z-index:150; display: none;'>";
}
}
}
}
$error_collector_mailto .= prepare4mailbody("=== Trace ===");
/* Generate trace history */
$error_collector_mailto .= prepare4mailbody("=== Trace ===");
/* Generate trace history */
- for ($index= 0; $index<count($trace); $index++){
+ for ($index= 0, $c= count($trace); $index<$c; $index++){
$ct= $trace[$index];
$ct= $trace[$index];
$line="";
}
$color= ($index&1)?'#404040':'606060';
$line="";
}
$color= ($index&1)?'#404040':'606060';
- $error_collector.= "<tr style='background-color:$color'><td style='padding-left:20px' width=\"30%\">"._("Trace")."[$index]: $loc</td>";
+ $error_collector.= "<tr style='background-color:$color'><td style='padding-left:20px' width=\"30%\">"._("Traceback")."[$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>";
$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>";
$error_collector.= "</table>";
/* Flush in case of fatal errors */
$error_collector.= "</table>";
/* Flush in case of fatal errors */
+ set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
if (preg_match('/^fatal/i', $errstr)){
echo $error_collector."</div>";
flush();
if (preg_match('/^fatal/i', $errstr)){
echo $error_collector."</div>";
flush();
/* Bail out for incompatible/old PHP versions */
if (!version_compare(phpversion(),"5.2.0",">=")){
/* Bail out for incompatible/old PHP versions */
if (!version_compare(phpversion(),"5.2.0",">=")){
-# echo "PHP version needs to be 5.2.0 or above to run GOsa. Aborted.";
-## exit();
+ echo "PHP version needs to be 5.2.0 or above to run GOsa. Aborted.";
+ exit();
}
/* Set timezone */
}
/* Set timezone */
/* Register error handler */
$error_collector= "";
$error_collector_mailto= "";
/* Register error handler */
$error_collector= "";
$error_collector_mailto= "";
-set_error_handler('gosaRaiseError');
+
+set_error_handler('gosaRaiseError', E_WARNING | E_NOTICE | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT) ;
$variables_order= "ES";
ini_set("register_globals",0);
ini_set("track_vars",1);
ini_set("display_errors",1);
ini_set("report_memleaks",1);
$variables_order= "ES";
ini_set("register_globals",0);
ini_set("track_vars",1);
ini_set("display_errors",1);
ini_set("report_memleaks",1);
-ini_set("include_path",".:$BASE_DIR/include:$BASE_DIR/include/utils/excel");
+ini_set("include_path",".:$BASE_DIR/include:$BASE_DIR/include/utils/excel:/usr/share/php");
/* Do smarty setup */
require("smarty/Smarty.class.php");
/* Do smarty setup */
require("smarty/Smarty.class.php");
$smarty->caching= false;
$smarty->php_handling= SMARTY_PHP_REMOVE;
$smarty->caching= false;
$smarty->php_handling= SMARTY_PHP_REMOVE;
+/* Global FPDF define */
+define('FPDF_FONTPATH', '/usr/share/php/fpdf/font/');
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>