Example #1
0
/**
 * Exception Handler
 *
 * error:   中断程序,提示信息中出现报告bug的链接以及记录到日志文件
 * warning: 中断程序,提示信息中出现报告bug的链接。
 * notice:  不中断程序,错误信息输出到页面的注释中
 *---------------------------------------
 * 用户级的错误处理方式:
 *
 * error:   中断程序,提示信息中出现报告bug的链接以及记录到日志文件
 * warning: 中断程序,提示信息中不包括出错文件及行号等信息
 * notice:  中断程序,提示信息中不包括出错文件及行号等信息。 如何处理链接地址呢?
 *---------------------------------------
 *
 * @param   number  $errno
 * @param   string  $errstr
 * @param   string  $errfile
 * @param   string  $errline
 *
 * @return  void
 */
function exception_handler($errno, $errstr, $errfile, $errline)
{
    if ($errno == 2048) {
        return true;
    }
    if ($errno != E_NOTICE) {
        $msg = new Message($errstr, $errno);
        $errfile = str_replace(ROOT_PATH, '', $errfile);
        if ($errno != E_USER_WARNING && $errno != E_USER_NOTICE) {
            $msg->err_file = $errfile;
            $msg->err_line = $errline;
        }
        /* add report link */
        if ($errno == E_USER_ERROR || $errno == E_ERROR || $errno == E_PARSE || $errno == E_WARNING) {
            $msg->report_link($errno, $errstr, $errfile, $errline);
            put_log($errno, $errstr, $errfile, $errline);
            // 写入错误日志
            $msg->display();
            exit;
        } else {
            $msg->display();
        }
    } else {
        if ($errno == E_NOTICE && (defined(DEBUG_MODE) && DEBUGE_MODE > 0)) {
            echo "<div style='font: 14px verdana'><b>Notice:</b> {$errstr}<br/><b>Error File:</b> {$errfile}: [{$errline}]</div>";
        }
    }
    return true;
}
Example #2
0
/**
 * Exception Handler
 *
 * error:   中断程序,提示信息中出现报告bug的链接以及记录到日志文件
 * warning: 中断程序,提示信息中出现报告bug的链接。
 * notice:  不中断程序,错误信息输出到页面的注释中
 *---------------------------------------
 * 用户级的错误处理方式:
 *
 * error:   中断程序,提示信息中出现报告bug的链接以及记录到日志文件
 * warning: 中断程序,提示信息中不包括出错文件及行号等信息
 * notice:  中断程序,提示信息中不包括出错文件及行号等信息。 如何处理链接地址呢?
 *---------------------------------------
 *
 * @param   number  $errno
 * @param   string  $errstr
 * @param   string  $errfile
 * @param   string  $errline
 *
 * @return  void
 */
function exception_handler($errno, $errstr, $errfile, $errline)
{
    if ($errno == 2048 || ($errno & error_reporting()) != $errno) {
        //不再需要通过_at方法来抵制错误
        //错误被屏蔽时就不抛出异常,该处理就允许你在代码中照常使用error_reporting来控制错误报告
        return true;
    }
    if ($errno != E_NOTICE) {
        $msg = new Message($errstr, $errno);
        $errfile = str_replace(ROOT_PATH, '', $errfile);
        if ($errno != E_USER_WARNING && $errno != E_USER_NOTICE) {
            $msg->err_file = $errfile;
            $msg->err_line = $errline;
        }
        /* add report link */
        if ($errno == E_USER_ERROR || $errno == E_ERROR || $errno == E_PARSE || $errno == E_WARNING) {
            $msg->report_link($errno, $errstr, $errfile, $errline);
            put_log($errno, $errstr, $errfile, $errline);
            // 写入错误日志
            $msg->display();
            exit;
        } else {
            $msg->display();
        }
    } else {
        if ($errno == E_NOTICE && (defined('DEBUG_MODE') && DEBUG_MODE > 0)) {
            echo "<div style='font: 14px verdana'><b>Notice:</b> {$errstr}<br/><b>Error File:</b> {$errfile}: [{$errline}]</div>";
        }
    }
    return true;
}
Example #3
0
            //catches $_GET refresh
            require_once "date_select.php";
            $dates = unserialize($_STATE->date_select);
            if (!$dates->POST(DATE_SELECT::TO)) {
                //check only to date for recent
                $calendar = unserialize($_STATE->calendar);
                $_STATE->msgGreet = "Select the data window";
                break 2;
            }
            set_state($dates);
            $_STATE->heading .= "<br>as of " . $_STATE->to_date->format('Y-m-d');
            $_STATE->msgGreet = $_STATE->project_name . "<br>Download the report";
            $_STATE->status = DOWNLOAD_LOG;
            break 2;
        case DOWNLOAD_LOG:
            put_log();
            $_STATE->msgGreet = "Done!";
            $_STATE->status = STATE::DONE;
            break 2;
        default:
            throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): Invalid state=" . $_STATE->status);
    }
}
//while & switch
$redirect = $_SESSION["_SITE_CONF"]["_REDIRECT"];
EX_pageStart();
//standard HTML page start stuff - insert scripts here
?>
<script language="JavaScript">

<?php