123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- class ErrorAction extends InfoAction
- {
- static $status = [];
- var $code = null;
- var $message = null;
- var $default = null;
- function __construct($message, $code, $output='php://output', $indent=null)
- {
- parent::__construct(null, $message, $output, $indent);
- $this->code = $code;
- $this->message = $message;
- $this->minimal = GNUsocial::isApi();
-
-
-
- $this->prepare($_REQUEST);
- }
- function showPage()
- {
- if (GNUsocial::isAjax()) {
- $this->extraHeaders();
- $this->ajaxErrorMsg();
- exit();
- } if ($this->minimal) {
-
-
- $this->extraHeaders();
- $this->showContent();
- } else {
- parent::showPage();
- }
-
- exit();
- }
-
- function showContent()
- {
- $this->element('div', ['class' => 'error'], $this->message);
- }
- function showNoticeForm()
- {
- }
-
- function ajaxErrorMsg()
- {
- $this->startHTML('text/xml;charset=utf-8');
- $this->elementStart('head');
-
- $this->element('title', null, _('Ajax Error'));
- $this->elementEnd('head');
- $this->elementStart('body');
- $this->element('p', ['id' => 'error'], $this->message);
- $this->elementEnd('body');
- $this->endHTML();
- }
- }
|