X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fphp_setup.inc;h=ebddd810af024e1c61becb511f2a490a52ca3e42;hb=a587a3d7106e6636279f232eb5d2b3f25bb64a41;hp=e74f4eebe7481447b6ec86979315d837280c75ec;hpb=c2c6a6e54355a1b67c25bb4d761d847513810d02;p=gosa.git diff --git a/include/php_setup.inc b/include/php_setup.inc index e74f4eebe..ebddd810a 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -18,16 +18,158 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +function gosaRaiseError($errno, $errstr, $errfile, $errline) +{ + global $error_collector,$config; + + /* Return if error reporting is set to zero */ + if (error_reporting() == 0){ + return; + } + + /* Workaround for buggy imap_open error outputs */ + if (preg_match('/imap_open/', $errstr)){ + return; + } + + /* FIXME: Workaround for PHP5 error message flooding. The new OOM + code want's us to use public/protected/private instead of flat + var declarations. For now I can't workaround this - let's ignore + the messages till the next major release which may drop support + for PHP4. */ + if (preg_match('/var: Deprecated./', $errstr)){ + return; + } + + /* FIXME: Same as above. Compatibility does error flooding.*/ + if (preg_match('/zend.ze1_compatibility_mode/', $errstr)){ + return; + } + + /* Hide ldap size limit messages */ + if (preg_match('/ldap_error/', $errstr)){ + if (preg_match('/sizelimit/', $errstr)){ + return; + } + } + + if((isset($config->data))){ + if((isset($config->data['MAIN']['DISPLAYERRORS']))&&(!preg_match("/^true$/i",$config->data['MAIN']['DISPLAYERRORS']))){ + + /* Write to syslog */ + gosa_log ("PHP error: $errstr ($errfile, line $errline)"); + return; + } + } + + + /* Create header as needed */ + if ($error_collector == ""){ + if (isset($_SESSION['js']) && $_SESSION['js']==FALSE){ + $error_collector= "
"; + } else { + $error_collector= "
\"\" "._("Generating this page caused the PHP interpreter to raise some errors!")."
"; + flush(); + exit; + } +} + + +function dummy_error_handler() +{ +} + + /* Get base dir for reference */ $BASE_DIR= dirname(dirname(__FILE__)); $ROOT_DIR= $BASE_DIR."/html"; error_reporting (E_ALL); +/* Register error handler */ +$error_collector= ""; +set_error_handler('gosaRaiseError'); + $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"); -#ini_set("display_errors",0); /* Do smarty setup */ require("smarty/Smarty.class.php"); @@ -36,5 +178,10 @@ $smarty->template_dir = $BASE_DIR.'/ihtml/'; $smarty->caching= false; $smarty->php_handling= SMARTY_PHP_REMOVE; +/* Set timezone */ +if (function_exists("date_default_timezone_set")){ + date_default_timezone_set("GMT"); +} + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>