From: hickert Date: Thu, 28 Jun 2007 09:27:36 +0000 (+0000) Subject: Udpated PHP error box, added a mailto link X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=06498abac9b750a866448b8cdafeb555edfb35e1;p=gosa.git Udpated PHP error box, added a mailto link git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6725 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/index.php b/html/index.php index b7f1ae83a..756d50378 100644 --- a/html/index.php +++ b/html/index.php @@ -70,7 +70,7 @@ function displayLogin() $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 ffb834262..57996e0df 100644 --- a/html/main.php +++ b/html/main.php @@ -374,8 +374,9 @@ $smarty->assign("contents", $display); 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 544fb6352..4cac0b7c7 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2452,6 +2452,17 @@ function get_base_from_hook($dn, $attrib) } +function prepare4mailbody($string) +{ + $string = $string; + + $from = array("/\n/" , "/&/" ,"/(\'|\")/"); + $to = array("%0A" , "%26" ,""); + + $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 ebddd810a..f443562eb 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,$error_collector_mailto,$config; /* Return if error reporting is set to zero */ if (error_reporting() == 0){ @@ -65,10 +65,39 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) /* Create header as needed */ if ($error_collector == ""){ + + /* Mailto body header */ + $error_collector_mailto .=prepare4mailbody( + "GOsa bug report". + "\nGOsa Version : ".get_gosa_version(). + "\nDate : ".date("H:i:s d.m.Y"). + "\n". + "\nTrace : ". + "\n"); + if (isset($_SESSION['js']) && $_SESSION['js']==FALSE){ $error_collector= "
"; } else { - $error_collector= "
\"\" "._("Generating this page caused the PHP interpreter to raise some errors!")."