]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/cancelgroup.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / cancelgroup.php
index 3074e3ffa3141db4fb47f851a0dbc92f76fc6eea..90675d79bc8146177eb51c63aa73bc5f09ab7c2c 100644 (file)
@@ -50,20 +50,19 @@ class CancelgroupAction extends Action
     /**
      * Prepare to run
      */
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
         if (!common_logged_in()) {
             // TRANS: Client error displayed when trying to leave a group while not logged in.
             $this->clientError(_('You must be logged in to leave a group.'));
-            return false;
         }
 
         $nickname_arg = $this->trimmed('nickname');
         $id = intval($this->arg('id'));
         if ($id) {
-            $this->group = User_group::staticGet('id', $id);
+            $this->group = User_group::getKV('id', $id);
         } else if ($nickname_arg) {
             $nickname = common_canonical_nickname($nickname_arg);
 
@@ -71,44 +70,38 @@ class CancelgroupAction extends Action
             if ($nickname_arg != $nickname) {
                 $args = array('nickname' => $nickname);
                 common_redirect(common_local_url('leavegroup', $args), 301);
-                return false;
             }
 
-            $local = Local_group::staticGet('nickname', $nickname);
+            $local = Local_group::getKV('nickname', $nickname);
 
             if (!$local) {
                 // TRANS: Client error displayed when trying to leave a non-local group.
                 $this->clientError(_('No such group.'), 404);
-                return false;
             }
 
-            $this->group = User_group::staticGet('id', $local->group_id);
+            $this->group = User_group::getKV('id', $local->group_id);
         } else {
             // TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
             $this->clientError(_('No nickname or ID.'), 404);
-            return false;
         }
 
         if (!$this->group) {
             // TRANS: Client error displayed when trying to leave a non-existing group.
             $this->clientError(_('No such group.'), 404);
-            return false;
         }
 
         $cur = common_current_user();
         if (empty($cur)) {
             // TRANS: Client error displayed when trying to leave a group while not logged in.
             $this->clientError(_('Must be logged in.'), 403);
-            return false;
         }
         if ($this->arg('profile_id')) {
             if ($cur->isAdmin($this->group)) {
-                $this->profile = Profile::staticGet('id', $this->arg('profile_id'));
+                $this->profile = Profile::getKV('id', $this->arg('profile_id'));
             } else {
                 // TRANS: Client error displayed when trying to approve or cancel a group join request without
                 // TRANS: being a group administrator.
                 $this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
-                return false;
             }
         } else {
             $this->profile = $cur->getProfile();
@@ -134,7 +127,7 @@ class CancelgroupAction extends Action
      *
      * @return void
      */
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
 
@@ -162,11 +155,9 @@ class CancelgroupAction extends Action
             $jf = new JoinForm($this, $this->group);
             $jf->show();
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
-            common_redirect(common_local_url('groupmembers', array('nickname' =>
-                                                                   $this->group->nickname)),
-                            303);
+            common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)), 303);
         }
     }
 }