X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ferror.php;h=03a1960c620bdc124836e16f276426b2f210185f;hb=4ea396f8718648ef6b900ea2aa8a7cad9f14d721;hp=762425dc44ade45ccb3e46c77aec6bfcf07cda1b;hpb=a2090ecc97f93894ba6f833acde5f44058988510;p=quix0rs-gnu-social.git diff --git a/lib/error.php b/lib/error.php index 762425dc44..03a1960c62 100644 --- a/lib/error.php +++ b/lib/error.php @@ -33,8 +33,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/lib/info.php'; - /** * Base class for displaying HTTP errors * @@ -58,7 +56,7 @@ class ErrorAction extends InfoAction $this->code = $code; $this->message = $message; - $this->minimal = StatusNet::isApi(); + $this->minimal = GNUsocial::isApi(); // XXX: hack alert: usually we aren't going to // call this page directly, but because it's @@ -68,7 +66,11 @@ class ErrorAction extends InfoAction function showPage() { - if ($this->minimal) { + if (GNUsocial::isAjax()) { + $this->extraHeaders(); + $this->ajaxErrorMsg(); + exit(); + } if ($this->minimal) { // Even more minimal -- we're in a machine API // and don't want to flood the output. $this->extraHeaders(); @@ -91,6 +93,30 @@ class ErrorAction extends InfoAction $this->element('div', array('class' => 'error'), $this->message); } + function showNoticeForm() + { + } + /** + * Show an Ajax-y error message + * + * Goes back to the browser, where it's shown in a popup. + * + * @param string $msg Message to show + * + * @return void + */ + function ajaxErrorMsg() + { + $this->startHTML('text/xml;charset=utf-8', true); + $this->elementStart('head'); + // TRANS: Page title after an AJAX error occurs on the send notice page. + $this->element('title', null, _('Ajax Error')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->element('p', array('id' => 'error'), $this->message); + $this->elementEnd('body'); + $this->endHTML(); + } }