]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
Resolve Group Aliases in showgroup.php
[quix0rs-gnu-social.git] / actions / showgroup.php
index ce11d574e94c7be3577902b15d5ef51590fa94f7..b0cc1dbc7df61ab4d720f49debc39c4a83fdc119 100644 (file)
@@ -130,8 +130,18 @@ class ShowgroupAction extends GroupDesignAction
         $this->group = User_group::staticGet('nickname', $nickname);
 
         if (!$this->group) {
-            $this->clientError(_('No such group'), 404);
-            return false;
+            $alias = Group_alias::staticGet('alias', $nickname);
+            if ($alias) {
+                $args = array('id' => $alias->group_id);
+                if ($this->page != 1) {
+                    $args['page'] = $this->page;
+                }
+                common_redirect(common_local_url('groupbyid', $args), 301);
+                return false;
+            } else {
+                $this->clientError(_('No such group'), 404);
+                return false;
+            }
         }
 
         common_set_returnto($this->selfUrl());
@@ -317,8 +327,25 @@ class ShowgroupAction extends GroupDesignAction
           common_local_url('grouprss',
                            array('nickname' => $this->group->nickname));
 
-        return array(new Feed(Feed::RSS1, $url, sprintf(_('Notice feed for %s group'),
-                                                        $this->group->nickname)));
+        return array(new Feed(Feed::RSS1,
+                              common_local_url('grouprss',
+                                               array('nickname' => $this->group->nickname)),
+                              sprintf(_('Notice feed for %s group (RSS 1.0)'),
+                                      $this->group->nickname)),
+                     new Feed(Feed::RSS2,
+                              common_local_url('api',
+                                               array('apiaction' => 'groups',
+                                                     'method' => 'timeline',
+                                                     'argument' => $this->group->nickname.'.rss')),
+                              sprintf(_('Notice feed for %s group (RSS 2.0)'),
+                                      $this->group->nickname)),
+                     new Feed(Feed::ATOM,
+                              common_local_url('api',
+                                               array('apiaction' => 'groups',
+                                                     'method' => 'timeline',
+                                                     'argument' => $this->group->nickname.'.atom')),
+                              sprintf(_('Notice feed for %s group (Atom)'),
+                                      $this->group->nickname)));
     }
 
     /**
@@ -423,8 +450,9 @@ class ShowgroupAction extends GroupDesignAction
             $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
                 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
                 'short messages about their life and interests. '.
-                '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
-                     $this->group->nickname);
+                '[Join now](%%%%action.%s%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
+                     $this->group->nickname,
+                     (!common_config('site','openidonly')) ? 'register' : 'openidlogin');
         } else {
             $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
                 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
@@ -466,4 +494,4 @@ class GroupAdminSection extends ProfileSection
     {
         return null;
     }
-}
\ No newline at end of file
+}