- foreach ($aliases as $alias) {
- if (!Validate::string(
- $alias, array(
- 'min_length' => 1,
- 'max_length' => 64,
- 'format' => NICKNAME_FMT)
- )
- ) {
- throw new ApiValidationException(
- sprintf(
- // TRANS: API validation exception thrown when aliases does not validate.
- // TRANS: %s is the invalid alias.
- _('Invalid alias: "%s".'),
- $alias
- )
- );
- }
-
- if ($this->nicknameExists($alias)) {
- throw new ApiValidationException(
- sprintf(
- // TRANS: API validation exception thrown when aliases is already used.
- // TRANS: %s is the already used alias.
- _('Alias "%s" already in use. Try another one.'),
- $alias)
- );
- }
-
- // XXX assumes alphanum nicknames
- if (strcmp($alias, $this->nickname) == 0) {
- throw new ApiValidationException(
- // TRANS: API validation exception thrown when alias is the same as nickname.
- _('Alias cannot be the same as nickname.')
- );
- }
- }
-