]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/shownotice.php
'ajax' param on shownotice action so we can pull items in full html version for realtime
[quix0rs-gnu-social.git] / actions / shownotice.php
index b4af7dbaa272d814a7058ee70506a93939a772b7..8d8ab326df249e7fcaf58a218e44312180554d4e 100644 (file)
@@ -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
      *
@@ -274,12 +294,6 @@ class ShownoticeAction extends OwnerDesignAction
                                          'content' => $id->toString()));
         }
 
-        if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
-            $id = new Microid('xmpp:', $user->jabber,
-                              $this->notice->uri);
-            $this->element('meta', array('name' => 'microid',
-                                         'content' => $id->toString()));
-        }
         $this->element('link',array('rel'=>'alternate',
             'type'=>'application/json+oembed',
             'href'=>common_local_url(
@@ -344,7 +358,7 @@ class SingleNoticeItem extends DoFollowListItem
      * show the avatar of the notice's author
      *
      * We use the larger size for single notice page.
-     * 
+     *
      * @return void
      */