fix wrong language-string in settings/180.dkim.php, implemented Settings::Add() for updates later (much better than a manual query etc.), added new php-errorhandler so we can display php errors/warnings/notices (whatever is activated) in a nicer way
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
37
lib/functions/froxlor/function.phpErrHandler.php
Normal file
37
lib/functions/froxlor/function.phpErrHandler.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* froxlor php error handler
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
* @param array $errcontext
|
||||
*
|
||||
* @return void|boolean
|
||||
*/
|
||||
function phpErrHandler($errno, $errstr, $errfile, $errline, array $errcontext) {
|
||||
|
||||
if (!(error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) {
|
||||
global $theme;
|
||||
// if we're not on the shell, output a nicer error-message
|
||||
$err_hint = file_get_contents(FROXLOR_INSTALL_DIR.'/templates/'.$theme.'/misc/phperrornice.tpl');
|
||||
// replace values
|
||||
$err_hint = str_replace("<TEXT>", '#'.$errno.' '.$errstr, $err_hint);
|
||||
$err_hint = str_replace("<DEBUG>", $errfile.':'.$errline, $err_hint);
|
||||
|
||||
// show
|
||||
echo $err_hint;
|
||||
// return true to ignore php standard error-handler
|
||||
return true;
|
||||
}
|
||||
|
||||
// of on shell, use the php standard error-handler
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user