X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ferror.php;h=a6a29119f7f612046f2f2c0075167c5d03acef84;hb=8e102da76cc7466bffb67cb591927f123ed74c12;hp=6a9b76be11b97391f41ac13292ed76f38bdeba2a;hpb=fe7848e8b87b6a3f44fc8b7a58f79812d197dec2;p=quix0rs-gnu-social.git diff --git a/lib/error.php b/lib/error.php index 6a9b76be11..a6a29119f7 100644 --- a/lib/error.php +++ b/lib/error.php @@ -50,12 +50,13 @@ class ErrorAction extends Action var $message = 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 @@ -70,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); } @@ -92,7 +93,7 @@ class ErrorAction extends Action function title() { - return self::$status[$this->code]; + return @self::$status[$this->code]; } function isReadOnly($args) @@ -102,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();