require_once INSTALLDIR . '/lib/apiauth.php';
-class ApiValidationException extends Exception { }
-
/**
* API analog to the group edit page
*
parent::prepare($args);
$this->nickname = common_canonical_nickname($this->trimmed('nickname'));
+
$this->fullname = $this->trimmed('fullname');
$this->homepage = $this->trimmed('homepage');
$this->description = $this->trimmed('description');
$this->serverError(_('Could not update group.'));
}
- $aliases = null;
+ $aliases = array();
try {
- if (!empty($this->aliasstring)) {
- $aliases = $this->parseAliases();
+ if (!empty($this->aliasstring)) {
+ $aliases = $this->validateAliases();
}
} catch (ApiValidationException $ave) {
$this->serverError(_('Could not create aliases.'));
}
- if (!empty($this->nickname) && $this->nickname != $orig->nickname) {
+ if (!empty($this->nickname) && ($this->nickname != $orig->nickname)) {
common_log(LOG_INFO, "Saving local group info.");
$local = Local_group::staticGet('group_id', $this->group->id);
$local->setNickname($this->nickname);
_('Not a valid nickname.')
);
}
+
+ return true;
}
function validateHomepage()
)
);
- if (empty($aliases)) {
- $aliases = array();
- }
-
if (count($aliases) > common_config('group', 'maxaliases')) {
throw new ApiValidationException(
sprintf(
}
// XXX assumes alphanum nicknames
- if (strcmp($alias, $nickname) == 0) {
+ if (strcmp($alias, $this->nickname) == 0) {
throw new ApiValidationException(
_('Alias can\'t be the same as nickname.')
);