10 * @author Evan Prodromou <evan@status.net>
11 * @author Zach Copley <zach@status.net>
12 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13 * @link http://status.net/
15 * StatusNet - the distributed open-source microblogging tool
16 * Copyright (C) 2008, 2009, StatusNet, Inc.
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Affero General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Affero General Public License for more details.
28 * You should have received a copy of the GNU Affero General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
37 * Base class for displaying HTTP errors
41 * @author Zach Copley <zach@status.net>
42 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
43 * @link http://status.net/
45 class ErrorAction extends Action
47 static $status = array();
53 function __construct($message, $code, $output='php://output', $indent=true)
55 parent::__construct($output, $indent);
58 $this->message = $message;
60 // XXX: hack alert: usually we aren't going to
61 // call this page directly, but because it's
62 // an action it needs an args array anyway
63 $this->prepare($_REQUEST);
67 * To specify additional HTTP headers for the action
71 function extraHeaders()
73 $status_string = @self::$status[$this->code];
74 header('HTTP/1.1 '.$this->code.' '.$status_string);
82 function showContent()
84 $this->element('div', array('class' => 'error'), $this->message);
95 return @self::$status[$this->code];
98 function isReadOnly($args)
107 // We don't want to have any more output after this
111 // Overload a bunch of stuff so the page isn't too bloated
115 $this->elementStart('body', array('id' => 'error'));
116 $this->elementStart('div', array('id' => 'wrap'));
120 $this->elementEnd('div');
121 $this->elementEnd('body');
126 $this->elementStart('div', array('id' => 'core'));
127 $this->showContentBlock();
128 $this->elementEnd('div');
131 function showHeader()
133 $this->elementStart('div', array('id' => 'header'));
135 $this->showPrimaryNav();
136 $this->elementEnd('div');