- $this->clientError(_('API method not found.'), 404, $this->format);
- break;
- }
- }
-
- function nicknameExists($nickname)
- {
- $group = Local_group::staticGet('nickname', $nickname);
-
- if (!empty($group) &&
- $group->group_id != $this->group->id) {
- return true;
- }
-
- $alias = Group_alias::staticGet('alias', $nickname);
-
- if (!empty($alias) &&
- $alias->group_id != $this->group->id) {
- return true;
- }
-
- return false;
- }
-
- function validateNickname()
- {
- if (!Validate::string(
- $this->nickname, array(
- 'min_length' => 1,
- 'max_length' => 64,
- 'format' => NICKNAME_FMT
- )
- )
- ) {
- throw new ApiValidationException(
- _(
- 'Nickname must have only lowercase letters ' .
- 'and numbers and no spaces.'
- )
- );
- } else if ($this->nicknameExists($this->nickname)) {
- throw new ApiValidationException(
- _('Nickname already in use. Try another one.')
- );
- } else if (!User_group::allowedNickname($this->nickname)) {
- throw new ApiValidationException(
- _('Not a valid nickname.')
- );
+ // TRANS: Client error displayed when coming across a non-supported API method.
+ $this->clientError(_('API method not found.'), 404);