예제 #1
0
파일: Func.php 프로젝트: xdire/dude
function __sdn()
{
    $isBuffered = \Xdire\Dude\Core\App::getOutputType();
    if ($error = error_get_last()) {
        if ($isBuffered == 1) {
            ob_clean();
        }
        header("HTTP/1.0 500");
        if (\Xdire\Dude\Core\App::getEnvironment() == 1) {
            echo "Error produced by application: \n";
            echo "Code: " . $error['type'] . " \nMessage: " . $error['message'] . " \nFile: " . $error['file'] . " \nLine: " . $error['line'];
        } else {
            $file = explode("/", $error['file']);
            $fileName = strstr(array_pop($file), '.', true);
            echo '{"errorCode":500,"errorMessage":"Error happened, be calm, send us a report and we\'ll fix it. (' . $fileName . ':' . $error['line'] . ') "}';
        }
        if ($isBuffered == 1) {
            ob_flush();
        }
    }
    if ($isBuffered == 1) {
        ob_end_clean();
    }
}