/** * Sets the right action for the form, and passes request args into * the base action * * @param array $args misc. arguments * * @return boolean true */ function prepare($args) { parent::prepare($args); if (!common_logged_in()) { // TRANS: Client error displayed trying to change group design settings while not logged in. $this->clientError(_('You must be logged in to edit a group.')); return false; } $nickname_arg = $this->trimmed('nickname'); $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname if ($nickname_arg != $nickname) { $args = array('nickname' => $nickname); common_redirect(common_local_url('groupdesignsettings', $args), 301); return false; } if (!$nickname) { // TRANS: Client error displayed trying to change group design settings without providing a group nickname. $this->clientError(_('No nickname.'), 404); return false; } $groupid = $this->trimmed('groupid'); if ($groupid) { $this->group = User_group::staticGet('id', $groupid); } else { $local = Local_group::staticGet('nickname', $nickname); if ($local) { $this->group = User_group::staticGet('id', $local->group_id); } } if (!$this->group) { // TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group. $this->clientError(_('No such group.'), 404); return false; } $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { // TRANS: Client error displayed trying to change group design settings without being a (group) admin. $this->clientError(_('You must be an admin to edit the group.'), 403); return false; } $this->submitaction = common_local_url('groupdesignsettings', array('nickname' => $this->group->nickname)); return true; }
/** * Sets the right action for the form, and passes request args into * the base action * * @param array $args misc. arguments * * @return boolean true */ function prepare($args) { parent::prepare($args); if (!common_config('inboxes', 'enabled')) { $this->serverError(_('Inboxes must be enabled for groups to work')); return false; } if (!common_logged_in()) { $this->clientError(_('You must be logged in to edit a group.')); return false; } $nickname_arg = $this->trimmed('nickname'); $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname if ($nickname_arg != $nickname) { $args = array('nickname' => $nickname); common_redirect(common_local_url('groupdesignsettings', $args), 301); return false; } if (!$nickname) { $this->clientError(_('No nickname'), 404); return false; } $groupid = $this->trimmed('groupid'); if ($groupid) { $this->group = User_group::staticGet('id', $groupid); } else { $this->group = User_group::staticGet('nickname', $nickname); } if (!$this->group) { $this->clientError(_('No such group'), 404); return false; } $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { $this->clientError(_('You must be an admin to edit the group'), 403); return false; } $this->submitaction = common_local_url('groupdesignsettings', array('nickname' => $this->group->nickname)); return true; }
/** * Sets the right action for the form, and passes request args into * the base action * * @param array $args misc. arguments * * @return boolean true */ function prepare($args) { parent::prepare($args); $this->submitaction = common_local_url('userdesignsettings'); return true; }