From 41fd4a4b7ce9abec36b49cc8fcc80758bbf1d30c Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Jun 2007 13:19:16 +0000 Subject: [PATCH] Implemented php bug submitting git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6734 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/index.php | 2 +- html/main.php | 2 +- html/setup.php | 2 +- include/functions.inc | 40 +++++++++++++++++ include/php_setup.inc | 62 ++++++++++++++++++++++++++- plugins/admin/fai/class_faiScript.inc | 2 + 6 files changed, 105 insertions(+), 5 deletions(-) diff --git a/html/index.php b/html/index.php index 7a947cd58..0ad4f6800 100644 --- a/html/index.php +++ b/html/index.php @@ -366,7 +366,7 @@ if (isset($_SESSION['errors'])){ $smarty->assign("errors", $_SESSION['errors']); } if ($error_collector != ""){ - $smarty->assign("php_errors", $error_collector.""); + $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector).""); } else { $smarty->assign("php_errors", ""); } diff --git a/html/main.php b/html/main.php index 7e001e122..be5e03e17 100644 --- a/html/main.php +++ b/html/main.php @@ -373,7 +373,7 @@ if (isset($_SESSION['errors'])){ $smarty->assign("errors", $_SESSION['errors']); } if ($error_collector != ""){ - $smarty->assign("php_errors", $error_collector.""); + $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector).""); } else { $smarty->assign("php_errors", ""); } diff --git a/html/setup.php b/html/setup.php index 5adc78a6d..06164aa00 100644 --- a/html/setup.php +++ b/html/setup.php @@ -120,7 +120,7 @@ $smarty->assign("header", $_SESSION['setup']->get_header_html()); $smarty->assign("bottom", $_SESSION['setup']->get_bottom_html()); if ($error_collector != ""){ - $smarty->assign("php_errors", $error_collector.""); + $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector).""); } else { $smarty->assign("php_errors", ""); } diff --git a/include/functions.inc b/include/functions.inc index 37bfa9fa0..9e0f24c9a 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2382,5 +2382,45 @@ function check_schema($cfg,$rfc2307bis = FALSE) return($checks); } + +function prepare4mailbody($string) +{ + $string = html_entity_decode($string); + + $from = array( + "/%/", + "/ /", + "/\n/", + "/\r/", + "/!/", + "/#/", + "/\*/", + "/\//", + "//", + "/\?/", + "/\"/"); + + $to = array( + "%25", + "%20", + "%0A", + "%0D", + "%21", + "%23", + "%2A", + "%2F", + "%3C", + "%3E", + "%3F", + "%22"); + + $string = preg_replace($from,$to,$string); + + return($string); +} + + + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/include/php_setup.inc b/include/php_setup.inc index ec1345943..95fb9a53e 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -20,7 +20,7 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) { - global $error_collector,$config; + global $error_collector,$config, $error_collector_mailto; if(@class_exists("log")){ new log("debug","all",$errfile,array(),"Type:".$errno.", Message:".$errstr.", File:".$errfile.", Line: ".$errline); @@ -69,22 +69,67 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) /* Create header as needed */ if ($error_collector == ""){ + + /* Mailto body header */ + $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(). + "\nDate: ".date("d.m.Y"). + "\nTime: ".date("H:i:s"). + "\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". + "*** PHP error information ***\n\n"); + if (isset($_SESSION['js']) && $_SESSION['js']==FALSE){ $error_collector= "
"; } else { - $error_collector= "
\"\" "._("Generating this page caused the PHP interpreter to raise some errors!")."