X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ferror.php;h=e7bdd0570703efc048c2e4b7481e3e9514132ad4;hb=c6b1b3e5e3ad1c47c7bd25b5bcfb0a8cb1cb2bb5;hp=d234ab92b2bdbf8346e17802b284802614eb5952;hpb=3d310c80bed74015d0a56d3f6e37d23302b7a633;p=quix0rs-gnu-social.git diff --git a/lib/error.php b/lib/error.php index d234ab92b2..e7bdd05707 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 * @@ -68,7 +66,11 @@ class ErrorAction extends InfoAction function showPage() { - if ($this->minimal) { + if (StatusNet::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(); @@ -94,4 +96,27 @@ class ErrorAction extends InfoAction 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(); + } }