]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/tag.php
Fixed routing for direct messages and favorites in the API
[quix0rs-gnu-social.git] / actions / tag.php
index 039cd9660b71a0a0ad1fb0cbe7b9d927feeea889..231f2c299280580842099f251541fbc9d2619204 100644 (file)
@@ -24,14 +24,22 @@ class TagAction extends Action
     function prepare($args)
     {
         parent::prepare($args);
-        $this->tag = $this->trimmed('tag');
+        $taginput = $this->trimmed('tag');
+        $this->tag = common_canonical_tag($taginput);
 
         if (!$this->tag) {
             common_redirect(common_local_url('publictagcloud'), 301);
             return false;
         }
 
+        if ($this->tag != $taginput) {
+            common_redirect(common_local_url('tag', array('tag' => $this->tag)));
+        }
+
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+
+        common_set_returnto($this->selfUrl());
+
         return true;
     }
 
@@ -53,12 +61,11 @@ class TagAction extends Action
         $this->showPage();
     }
 
-    function showFeeds()
+    function getFeeds()
     {
-        $this->element('link', array('rel' => 'alternate',
-                                     'href' => common_local_url('tagrss', array('tag' => $this->tag)),
-                                     'type' => 'application/rss+xml',
-                                     'title' => sprintf(_('Feed for tag %s'), $this->tag)));
+        return array(new Feed(Feed::RSS1,
+                              common_local_url('tagrss', array('tag' => $this->tag)),
+                              sprintf(_('Feed for tag %s'), $this->tag)));
     }
 
     function showPageNotice()
@@ -66,15 +73,6 @@ class TagAction extends Action
         return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
     }
 
-    function showExportData()
-    {
-        $fl = new FeedList($this);
-        $fl->show(array(0=>array('href'=>common_local_url('tagrss', array('tag' => $this->tag)),
-                                 'type' => 'rss',
-                                 'version' => 'RSS 1.0',
-                                 'item' => 'tagrss')));
-    }
-
     function showContent()
     {
         $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);