bind production mode view errors to admin users

This commit is contained in:
Ian 2013-05-29 15:05:16 +02:00
parent b0af9f201a
commit 68fbc2112e

View File

@ -133,15 +133,17 @@ if (!function_exists('errorToExceptionHandler')) {
exit; // make sure to exit in case of database connection errors. exit; // make sure to exit in case of database connection errors.
} }
if ($serendipity['production'] === true) { if ($serendipity['production'] === true) {
// ToDo: enhance for more special serendipity error needs if( serendipity_checkPermission('adminUsers') ) {
$str = '<p> == SERENDIPITY ERROR == </p>'; // ToDo: enhance for more special serendipity error needs
$str .= '<p>Please correct:</p>'; $str = '<p> == SERENDIPITY ERROR == </p>';
$str .= '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>'; $str .= '<p>Please correct:</p>';
if (headers_sent()) { $str .= '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>';
serendipity_die($str); // case HTTP headers: needs to halt with die() here, else it will path through and gets written underneath blog content, which hardly isn't seen by many users #var_dump(headers_list());
} else { if (headers_sent()) {
// this also reacts on non eye-displayed errors with following small javascript, while being in tags like <select> to push on top of page, else return non javascript use $str just there serendipity_die($str); // case HTTP headers: needs to halt with die() here, else it will path through and gets written underneath blog content, which hardly isn't seen by many users
echo '<noscript>' . $str . '</noscript>' . "\n<script>" . ' } else {
// this also reacts on non eye-displayed errors with following small javascript, while being in tags like <select> to push on top of page, else return non javascript use $str just there
echo '<noscript>' . $str . '</noscript>' . "\n<script>" . '
function create(htmlStr) { function create(htmlStr) {
var frag = document.createDocumentFragment(), var frag = document.createDocumentFragment(),
temp = document.createElement("div"); temp = document.createElement("div");
@ -155,7 +157,8 @@ var fragment = create("Error redirect: '.addslashes($str).'");
// You can use native DOM methods to insert the fragment: // You can use native DOM methods to insert the fragment:
document.body.insertBefore(fragment, document.body.childNodes[0]); document.body.insertBefore(fragment, document.body.childNodes[0]);
' . "\n</script>\n"; ' . "\n</script>\n";
// sadly we can't use HEREDOC notation here as this does not execute the javascript after finished writing // sadly we can't use HEREDOC notation here as this does not execute the javascript after finished writing
}
} }
} }
} }