X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fphp_setup.inc;h=d9bf3dc458ca0645e40cd3ebdfbd9c06db094ded;hb=439b82d99aeef6e804007bb36dcf472431a07b9f;hp=7979c636899b8b263343732eb3dc49ae53a43bbf;hpb=d32806eb84c7a94f3133effff9bb7ddb07a13af4;p=gosa.git diff --git a/include/php_setup.inc b/include/php_setup.inc index 7979c6368..d9bf3dc45 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -18,11 +18,146 @@ 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); @@ -37,5 +172,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: ?>