Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / actions / groupbyid.php
index befd526de11a6472e432ab1a7153d4866e65d7e2..448924bf473dc9eab1969ba4b61f706ae07af51f 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/noticelist.php';
-require_once INSTALLDIR.'/lib/feedlist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Permalink for a group
@@ -47,53 +42,22 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class GroupbyidAction extends Action
+class GroupbyidAction extends ManagedAction
 {
     /** group we're viewing. */
-    var $group = null;
+    protected $group = null;
 
-    /**
-     * Is this page read-only?
-     *
-     * @return boolean true
-     */
     function isReadOnly(array $args=array())
     {
         return true;
     }
 
-    function prepare(array $args=array())
+    protected function doPreparation()
     {
-        parent::prepare($args);
-
-        $id = $this->arg('id');
-
-        if (!$id) {
-            // TRANS: Client error displayed referring to a group's permalink without providing a group ID.
-            $this->clientError(_('No ID.'));
-        }
-
-        common_debug("Got ID $id");
-
-        $this->group = User_group::getKV('id', $id);
-
-        if (!$this->group) {
-            // TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
-            $this->clientError(_('No such group.'), 404);
-        }
-
-        return true;
+        $this->group = User_group::getByID($this->arg('id'));
     }
 
-    /**
-     * Handle the request
-     *
-     * Shows a profile for the group, some controls, and a list of
-     * group notices.
-     *
-     * @return void
-     */
-    function handle(array $args=array())
+    public function showPage()
     {
         common_redirect($this->group->homeUrl(), 303);
     }