X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ferror.php;h=a6a29119f7f612046f2f2c0075167c5d03acef84;hb=c95daacfdb6d89098716b8eeccfdd82124019d7a;hp=0c521db08124a29d77259ae3dfb25df5dadb0f49;hpb=9d87313eaebe8240393ac300a435f3b1332c8849;p=quix0rs-gnu-social.git diff --git a/lib/error.php b/lib/error.php index 0c521db081..a6a29119f7 100644 --- a/lib/error.php +++ b/lib/error.php @@ -44,17 +44,19 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { */ class ErrorAction extends Action { + static $status = array(); + var $code = null; var $message = null; - var $status = null; var $default = null; - function __construct($message, $code, $output='php://output', $indent=true) + function __construct($message, $code, $output='php://output', $indent=null) { parent::__construct($output, $indent); $this->code = $code; $this->message = $message; + $this->minimal = StatusNet::isApi(); // XXX: hack alert: usually we aren't going to // call this page directly, but because it's @@ -69,7 +71,7 @@ class ErrorAction extends Action */ function extraHeaders() { - $status_string = $this->status[$this->code]; + $status_string = @self::$status[$this->code]; header('HTTP/1.1 '.$this->code.' '.$status_string); } @@ -88,9 +90,10 @@ class ErrorAction extends Action * * @return page title */ + function title() { - return $this->message; + return @self::$status[$this->code]; } function isReadOnly($args) @@ -100,7 +103,14 @@ class ErrorAction extends Action function showPage() { - parent::showPage(); + if ($this->minimal) { + // Even more minimal -- we're in a machine API + // and don't want to flood the output. + $this->extraHeaders(); + $this->showContent(); + } else { + parent::showPage(); + } // We don't want to have any more output after this exit();