当前位置: 首页>>代码示例>>PHP>>正文


PHP postParser::mycode_parse_php方法代码示例

本文整理汇总了PHP中postParser::mycode_parse_php方法的典型用法代码示例。如果您正苦于以下问题:PHP postParser::mycode_parse_php方法的具体用法?PHP postParser::mycode_parse_php怎么用?PHP postParser::mycode_parse_php使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在postParser的用法示例。


在下文中一共展示了postParser::mycode_parse_php方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unset

    function output_error($type, $message, $file, $line)
    {
        global $mybb, $parser;
        if (!$mybb->settings['bbname']) {
            $mybb->settings['bbname'] = "MyBB";
        }
        if ($type == MYBB_SQL) {
            $title = "MyBB SQL Error";
            $error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";
            if ($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")) {
                $error_message .= "<dl>\n";
                $error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n";
                if ($message['query'] != "") {
                    $error_message .= "<dt>Query:</dt>\n<dd>{$message['query']}</dd>\n";
                }
                $error_message .= "</dl>\n";
            }
        } else {
            $title = "MyBB Internal Error";
            $error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>";
            if ($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")) {
                $error_message .= "<dl>\n";
                $error_message .= "<dt>Error Type:</dt>\n<dd>{$this->error_types[$type]} ({$type})</dd>\n";
                $error_message .= "<dt>Error Message:</dt>\n<dd>{$message}</dd>\n";
                if (!empty($file)) {
                    $error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd>\n";
                    if (!@preg_match('#config\\.php|settings\\.php#', $file) && @file_exists($file)) {
                        $code_pre = @file($file);
                        $code = "";
                        if (isset($code_pre[$line - 4])) {
                            $code .= $line - 3 . ". " . $code_pre[$line - 4];
                        }
                        if (isset($code_pre[$line - 3])) {
                            $code .= $line - 2 . ". " . $code_pre[$line - 3];
                        }
                        if (isset($code_pre[$line - 2])) {
                            $code .= $line - 1 . ". " . $code_pre[$line - 2];
                        }
                        $code .= $line . ". " . $code_pre[$line - 1];
                        // The actual line.
                        if (isset($code_pre[$line])) {
                            $code .= $line + 1 . ". " . $code_pre[$line];
                        }
                        if (isset($code_pre[$line + 1])) {
                            $code .= $line + 2 . ". " . $code_pre[$line + 1];
                        }
                        if (isset($code_pre[$line + 2])) {
                            $code .= $line + 3 . ". " . $code_pre[$line + 2];
                        }
                        unset($code_pre);
                        $parser_exists = false;
                        if (!is_object($parser) || !method_exists($parser, 'mycode_parse_php')) {
                            if (@file_exists(MYBB_ROOT . "inc/class_parser.php")) {
                                @(require_once MYBB_ROOT . "inc/class_parser.php");
                                $parser = new postParser();
                                $parser_exists = true;
                            }
                        } else {
                            $parser_exists = true;
                        }
                        if ($parser_exists) {
                            $code = $parser->mycode_parse_php($code, true);
                        } else {
                            $code = @nl2br($code);
                        }
                        $error_message .= "<dt>Code:</dt><dd>{$code}</dd>\n";
                    }
                }
                $backtrace = $this->generate_backtrace();
                if ($backtrace && !in_array($type, $this->mybb_error_types)) {
                    $error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd>\n";
                }
                $error_message .= "</dl>\n";
            }
        }
        if (isset($lang->settings['charset'])) {
            $charset = $lang->settings['charset'];
        } else {
            $charset = 'UTF-8';
        }
        if (!headers_sent() && !defined("IN_INSTALL") && !defined("IN_UPGRADE")) {
            @header('HTTP/1.1 503 Service Temporarily Unavailable');
            @header('Status: 503 Service Temporarily Unavailable');
            @header('Retry-After: 1800');
            @header("Content-type: text/html; charset={$charset}");
            $_SERVER['PHP_SELF'] = htmlspecialchars_uni($_SERVER['PHP_SELF']);
            echo <<<EOF
\t<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head profile="http://gmpg.org/xfn/11">
\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\t<title>{$mybb->settings['bbname']} - Internal Error</title>
\t<style type="text/css">
\t\tbody { background: #efefef; color: #000; font-family: Verdana; font-size: 12px; text-align: center; line-height: 1.4; }
\t\ta:link { color: #026CB1; text-decoration: none;\t}
\t\ta:visited {\tcolor: #026CB1;\ttext-decoration: none; }
\t\ta:hover, a:active {\tcolor: #000; text-decoration: underline; }
\t\t#container { width: 600px; padding: 20px; background: #fff;\tborder: 1px solid #e4e4e4; margin: 100px auto; text-align: left; }
\t\th1 { margin: 0; background: url({$_SERVER['PHP_SELF']}?action=mybb_logo) no-repeat;\theight: 82px; width: 248px; }
\t\t#content { border: 1px solid #B60101; background: #fff; }
//.........这里部分代码省略.........
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:101,代码来源:class_error.php


注:本文中的postParser::mycode_parse_php方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。