From: Brion Vibber Date: Mon, 14 Mar 2011 20:05:30 +0000 (-0700) Subject: 'ajax' param on shownotice action so we can pull items in full html version for realtime X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c7e7cc79da4255c42dbc8500fc5d6db25d1f90c3;p=quix0rs-gnu-social.git 'ajax' param on shownotice action so we can pull items in full html version for realtime --- diff --git a/actions/shownotice.php b/actions/shownotice.php index 3978f03ea9..8d8ab326df 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -188,22 +188,27 @@ class ShownoticeAction extends OwnerDesignAction { parent::handle($args); - if ($this->notice->is_local == Notice::REMOTE_OMB) { - if (!empty($this->notice->url)) { - $target = $this->notice->url; - } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { - // Old OMB posts saved the remote URL only into the URI field. - $target = $this->notice->uri; - } else { - // Shouldn't happen. - $target = false; - } - if ($target && $target != $this->selfUrl()) { - common_redirect($target, 301); - return false; + if ($this->boolean('ajax')) { + StatusNet::setApi(true); + $this->showAjax(); + } else { + if ($this->notice->is_local == Notice::REMOTE_OMB) { + if (!empty($this->notice->url)) { + $target = $this->notice->url; + } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { + // Old OMB posts saved the remote URL only into the URI field. + $target = $this->notice->uri; + } else { + // Shouldn't happen. + $target = false; + } + if ($target && $target != $this->selfUrl()) { + common_redirect($target, 301); + return false; + } } + $this->showPage(); } - $this->showPage(); } /** @@ -232,6 +237,21 @@ class ShownoticeAction extends OwnerDesignAction $this->elementEnd('ol'); } + function showAjax() + { + header('Content-Type: text/xml;charset=utf-8'); + $this->xw->startDocument('1.0', 'UTF-8'); + $this->elementStart('html'); + $this->elementStart('head'); + $this->element('title', null, _('Notice')); + $this->elementEnd('head'); + $this->elementStart('body'); + $nli = new NoticeListItem($this->notice, $this); + $nli->show(); + $this->elementEnd('body'); + $this->elementEnd('html'); + } + /** * Don't show page notice *