コード例 #1
0
ファイル: Error.php プロジェクト: aquarion/Plank
    function defaultError($status, $message, $response)
    {
        $trace = debug_backtrace();
        if (is_object($message) && is_subclass_of($message, 'Exception')) {
            $trace = $message->getTrace();
            $message = $message->getMessage();
        }
        if (defined('DESTRUCT')) {
            die($message);
        }
        $view = new Plank_View('Errors', 'Error503');
        $view->error = '		
		<p>Something\'s drastically wrong. Sorry about this, this is a last-ditch fail message, caused by terror upon terror to have been inflicted upon my poor innocent paradiems. Nothing\'s worked. The thing you asked for? Failed. The recovery from error system? Broken. The error display system itself? F****d. I have no idea what to try next, so I\'m going to throw data at you until you go away.</p>
				
		<h2>' . $message . '</h2>
		
		';
        $view->error .= Plank_Error::getBacktrace($trace);
        $response->setContent($view->render());
        $response->respond();
        if (defined("TEXTMODE")) {
            echo "Uh-Oh\n";
            echo striptags($view->error);
            die;
        } else {
            echo Plank_Logger_Display::display();
        }
    }
コード例 #2
0
ファイル: Response.php プロジェクト: aquarion/Plank
    public function setstatus($code)
    {
        $this->status_code = $code;
        switch ($code) {
            case '404':
                $this->status_message = 'Does not exist';
                try {
                    $view = new Plank_View('Errors', 'Error404');
                    $view->error = $this->errortext;
                    $this->content = $view->render();
                } catch (Plank_Exception_View_NotFound $e) {
                    $this->content = '
					<h1>File Not Found</h1>
					
					<p>Sorry folks, that doesn\'t exist here. The message would be prettier, but that\'s missing too. </p>			
					';
                }
                break;
            case '503':
                $this->status_message = 'Something\'s screwed';
                try {
                    $view = new Plank_View('Errors', 'Error503');
                    $this->content = $view->render();
                } catch (Plank_Exception_View_NotFound $e) {
                    $this->content = '
					<h1>System Error</h1>
					
					<p>Something\'s gone wrong. Try again later? Maybe</p>			
					';
                }
                break;
            case '302':
            case '301':
                if (!$this->location) {
                    throw new Plank_Exception("Redirect requested, but no location specified");
                }
                header("Location: " . $this->location);
        }
    }
コード例 #3
0
ファイル: Index.php プロジェクト: aquarion/Plank
 function IndexAction()
 {
     $view = new Plank_View('Errors', 'DefaultPage');
     $view->config = Plank_Config::getInstance();
     $this->response->setContent($view->render());
 }