font
论坛元老
 
初级会员
UID 43400
精华
0
积分 36461
帖子 260
金钱 36461 喜悦币
威望 0
人脉 0
阅读权限 90
注册 2004-11-1
状态 离线
|
[推荐阅读] 求助当天的浏览量代码怎么些
<?php PHPBB3 :)
function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user; global $phpEx, $phpbb_root_path, $starttime, $msg_title, $msg_long_text;
// Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { $msg_text = $msg_long_text; }
switch ($errno) { case E_NOTICE: case E_WARNING:
// Check the error reporting level and return if the error level does not match // Additionally do not display notices if we suppress them via @ // If DEBUG_EXTRA is defined the default level is E_ALL if (($errno & ((defined('DEBUG_EXTRA') && error_reporting()) ? E_ALL : error_reporting())) == 0) { return; }
/** * @todo Think about removing the if-condition within the final product, since we no longer enable DEBUG by default and we will maybe adjust the error reporting level */ if (defined('DEBUG')) { if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(realpath($phpbb_root_path), '\'), array('', '/'), $errfile); $msg_text = str_replace(array(realpath($phpbb_root_path), ''), array('', '/'), $msg_text);
echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "n"; } } break;
case E_USER_ERROR:
if (isset($db)) { $db->sql_close(); }
if (isset($cache)) { $cache->unload(); } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">'; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo '<title>' . $msg_title . '</title>'; echo '<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; echo ' <div id="page-header">'; echo ' <a href="' . $phpbb_root_path . '">Return to forum index</a>'; echo ' </div>'; echo ' <div id="page-body">'; echo ' <div class="panel">'; echo ' <span class="corners-top"><span></span></span>'; echo ' <div id="content">'; echo ' <h1>General Error</h1>'; echo ' <h2>' . $msg_text . '</h2>'; if (!empty($config['board_contact'])) { echo ' <p>Please notify the board administrator or webmaster : <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; } echo ' </div>'; echo ' <span class="corners-bottom"><span></span></span>'; echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; echo ' Powered by phpBB © ' . date('Y') . ' <a href="http://www.phpbb.com/">phpBB Group</a>'; echo ' </div>'; echo '</div>'; echo '</body>'; echo '</html>'; exit; break;
case E_USER_WARNING: case E_USER_NOTICE:
define('IN_ERROR_HANDLER', true); if (empty($user->data)) { $user->session_begin(); }
// We re-init the auth array to get correct results on login/logout $auth->acl($user->data);
if (empty($user->lang)) { $user->setup(); }
$msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title);
if (!defined('HEADER_INC')) { if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($msg_title); } else { page_header($msg_title); } }
$template->set_filenames(array( 'body' => 'message_body.html') );
$template->assign_vars(array( 'MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text) );
// We do not want the cron script to be called on error messages define('IN_CRON', true); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); }
exit; break; } }
set_error_handler('msg_handler'); ?> [ 本帖最后由 font 于 2006-7-13 11:08 AM 编辑 ]
|
|