mirror of
https://github.com/e107inc/e107.git
synced 2025-07-16 04:26:20 +02:00
Improved handling of CRITICAL ERROR messages.
This commit is contained in:
@ -1835,7 +1835,7 @@ function session_set($name, $value, $expire='', $path = e_HTTP, $domain = '', $s
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
function message_handler($mode, $message, $line = 0, $file = '')
|
||||
{
|
||||
if(defined('e_DEBUG') && e_DEBUG === true)
|
||||
if(!defined('e_HANDLER'))
|
||||
{
|
||||
echo $message;
|
||||
return;
|
||||
|
@ -982,9 +982,47 @@ class eMessage
|
||||
|
||||
function show_emessage($mode, $message, $line = 0, $file = "") {
|
||||
global $tp;
|
||||
|
||||
// For critical errors where no theme is available.
|
||||
$errorHead = '
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Error</title>
|
||||
<link rel="stylesheet" media="all" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" media="all" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" media="all" type="text/css" href="/e107_web/css/e107.css" />
|
||||
</head>
|
||||
<body >
|
||||
<div class="container" style="margin-top:100px">';
|
||||
|
||||
|
||||
$errorFoot = "</div></body></html>";
|
||||
|
||||
|
||||
|
||||
if(is_numeric($message))
|
||||
{
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_error.php");
|
||||
if(!defined('e_LANGUAGE'))
|
||||
{
|
||||
define('e_LANGUAGE', 'English');
|
||||
}
|
||||
|
||||
if(!defined('e_LANGUAGEDIR'))
|
||||
{
|
||||
define('e_LANGUAGEDIR','e107_languages/');
|
||||
}
|
||||
|
||||
$path = e_LANGUAGEDIR.e_LANGUAGE."/lan_error.php";
|
||||
|
||||
if(is_readable($path))
|
||||
{
|
||||
include($path);
|
||||
}
|
||||
|
||||
// include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_error.php");
|
||||
|
||||
$emessage[1] = "<b>".LAN_ERROR_25."</b>";
|
||||
$emessage[2] = "<b>".LAN_ERROR_26."</b>";
|
||||
$emessage[3] = "<b>".LAN_ERROR_27."</b>";
|
||||
@ -992,7 +1030,7 @@ function show_emessage($mode, $message, $line = 0, $file = "") {
|
||||
$emessage[5] = LAN_ERROR_29;
|
||||
$emessage[6] = "<b>".LAN_ERROR_30."</b>";
|
||||
$emessage[7] = "<b>".LAN_ERROR_31."</b>";
|
||||
$emessage[8] = "
|
||||
/*$emessage[8] = "
|
||||
<div style='text-align:center; font: 12px Verdana, Tahoma'><b>".LAN_ERROR_32." </b><br /><br />
|
||||
".chr(36)."ADMIN_DIRECTORY = \"e107_admin/\";<br />
|
||||
".chr(36)."FILES_DIRECTORY = \"e107_files/\";<br />
|
||||
@ -1003,24 +1041,59 @@ function show_emessage($mode, $message, $line = 0, $file = "") {
|
||||
".chr(36)."LANGUAGES_DIRECTORY = \"e107_languages/\"; <br />
|
||||
".chr(36)."HELP_DIRECTORY = \"e107_docs/help/\"; <br />
|
||||
".chr(36)."DOWNLOADS_DIRECTORY = \"e107_files/downloads/\";\n
|
||||
</div>";
|
||||
</div>";*/
|
||||
//v2.x
|
||||
$emessage[8] = '<b>'.LAN_ERROR_32.' </b><br /><br /><pre>
|
||||
$ADMIN_DIRECTORY = "e107_admin/";
|
||||
$IMAGES_DIRECTORY = "e107_images/";
|
||||
$THEMES_DIRECTORY = "e107_themes/";
|
||||
$PLUGINS_DIRECTORY = "e107_plugins/";
|
||||
$HANDLERS_DIRECTORY = "e107_handlers/";
|
||||
$LANGUAGES_DIRECTORY = "e107_languages/";
|
||||
$HELP_DIRECTORY = "e107_docs/help/";
|
||||
$MEDIA_DIRECTORY = "e107_media/";
|
||||
$SYSTEM_DIRECTORY = "e107_system/";</pre>
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (class_exists('e107table'))
|
||||
{
|
||||
$ns = new e107table;
|
||||
}
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "CRITICAL_ERROR" :
|
||||
$message = $emessage[$message] ? $emessage[$message] : $message;
|
||||
//FIXME - this breaks class2 pref check!!!
|
||||
if (is_readable(e_THEME.'index.html'))
|
||||
|
||||
$message = !empty($emessage[$message]) ? $emessage[$message] : $message;
|
||||
|
||||
//FIXME - this breaks class2 pref check!!! ?
|
||||
|
||||
if (is_readable(e_THEME.'error.html'))
|
||||
{
|
||||
require_once(e_THEME.'index.html');
|
||||
require_once(e_THEME.'error.html');
|
||||
exit;
|
||||
}
|
||||
echo "<div class='alert alert-block alert-error alert-danger' style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>CRITICAL_ERROR: </b><br />Line $line $file<br /><br />Error reported as: ".$message."</div>";
|
||||
|
||||
if(!defined('HEADERF'))
|
||||
{
|
||||
echo $errorHead;
|
||||
}
|
||||
|
||||
echo "<div class='alert alert-block alert-error alert-danger' style='font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><h4>CRITICAL ERROR: </h4>";
|
||||
echo (!empty($line)) ? "Line $line " : "";
|
||||
echo (!empty($file)) ? $file : "";
|
||||
echo "<div>Error reported as: ".$message."</div>";
|
||||
echo "</div>";
|
||||
|
||||
if(!defined('FOOTERF'))
|
||||
{
|
||||
echo $errorFoot;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "MESSAGE":
|
||||
|
Reference in New Issue
Block a user