X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fcancelgroup.php;h=90675d79bc8146177eb51c63aa73bc5f09ab7c2c;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=3074e3ffa3141db4fb47f851a0dbc92f76fc6eea;hpb=59043dca7fb6f974b11797c4d0f20e5b78b0611d;p=quix0rs-gnu-social.git diff --git a/actions/cancelgroup.php b/actions/cancelgroup.php index 3074e3ffa3..90675d79bc 100644 --- a/actions/cancelgroup.php +++ b/actions/cancelgroup.php @@ -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); } } }