Example #1
0
    /**  
     * 显示错误 
     * @param string $type 错误类型
     * @param string $error_msg 错误提示
     * @param string $show_trace
     * @return void
     */
    function showError($type, $error_msg, $show_trace = '')
    {
        global $_FANWE;
        ob_end_clean();
        $gzip = $_FANWE['gzip_compress'];
        ob_start($gzip ? 'ob_gzhandler' : NULL);
        $host = $_SERVER['HTTP_HOST'];
        $show_trace = trim($show_trace);
        $title = $type == 'db' ? 'Database' : 'System';
        echo <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
\t<title>{$host} - {$title} Error</title>
\t<meta http-equiv="Content-Type" content="text/html; charset={$_FANWE['config']['output']['charset']}" />
\t<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
\t<style type="text/css">
\t<!--
\tbody { background-color: white; color: black; }
\t#container { width: 650px; }
\t#message   { width: 650px; color: black; background-color: #FFFFCC; }
\t#bodytitle { font: 13pt/15pt verdana, arial, sans-serif; height: 35px; vertical-align: top; }
\t.bodytext  { font: 8pt/11pt verdana, arial, sans-serif; }
\t.help  { font: 12px verdana, arial, sans-serif; color: red;}
\t.red  {color: red;}
\ta:link     { font: 8pt/11pt verdana, arial, sans-serif; color: red; }
\ta:visited  { font: 8pt/11pt verdana, arial, sans-serif; color: #4e4e4e; }
\t-->
\t</style>
</head>
<body>
<table cellpadding="1" cellspacing="5" id="container">
<tr>
\t<td id="bodytitle" width="100%">FANWE {$title} Error </td>
</tr>
EOT;
        if ($type == 'db') {
            $help_link = "http://help.fanwe.com/?type=mysql&db_errno=" . rawurlencode(FDB::errno()) . "&db_error=" . rawurlencode(FDB::error());
            echo <<<EOT
<tr>
\t<td class="bodytext">The database has encountered a problem. </td>
</tr>
EOT;
        } else {
            echo <<<EOT
<tr>
\t<td class="bodytext">Your request has encountered a problem. </td>
</tr>
EOT;
        }
        echo <<<EOT
<tr><td><hr size="1"/></td></tr>
<tr><td class="bodytext">Error messages: </td></tr>
<tr>
\t<td class="bodytext" id="message">
\t\t<br/>
\t\t<ul> {$error_msg}</ul>
\t</td>
</tr>
EOT;
        if (!empty($show_trace)) {
            echo <<<EOT
<tr><td class="bodytext">&nbsp;</td></tr>
<tr><td class="bodytext">Program messages: </td></tr>
<tr>
\t<td class="bodytext">
\t\t<ul> {$show_trace} </ul>
\t</td>
</tr>
EOT;
        }
        //$end_msg = lang('error', 'error_end_message', array('host'=>$host));
        echo <<<EOT
<tr>
\t<td class="help"><br><br>{$end_msg}</td>
</tr>
</table>
</body>
</html>
EOT;
        $exit && exit;
    }