]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/error.php
Merge branch 'testing' into 0.9.x
[quix0rs-gnu-social.git] / lib / error.php
index 5ed5dec1bda057efa4083b0b6d365cef5cdacc99..a6a29119f7f612046f2f2c0075167c5d03acef84 100644 (file)
@@ -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
@@ -102,13 +103,20 @@ class ErrorAction extends Action
 
     function showPage()
     {
-        parent::showPage();
-
-        // We do not want to have any more output after this
+        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();
     }
 
-    // Overload a bunch of stuff so the page is not too bloated
+    // Overload a bunch of stuff so the page isn't too bloated
 
     function showBody()
     {