$this->show_form(_t('Nickname must have only letters and numbers and no spaces.'));
return;
}
+
+ if (!User::allowed_nickname($nickname)) {
+ $this->show_form(_t('Nickname not allowed.'));
+ return;
+ }
if (User::staticGet('nickname', $nickname)) {
$this->show_form(_t('Nickname already in use. Try another one.'));
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
return false;
}
+ if (!User::allowed_nickname($str)) {
+ return false;
+ }
if (User::staticGet('nickname', $str)) {
return false;
}
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
$this->show_form(_t('Nickname must have only letters and numbers and no spaces.'));
return;
+ } else if (!User::allowed_nickname($nickname)) {
+ $this->show_form(_t('Not a valid nickname.'));
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
$this->show_form(_t('Homepage is not a valid URL.'));
$this->show_form(_t('Nickname must have only lowercase letters and numbers and no spaces.'));
} else if ($this->nickname_exists($nickname)) {
$this->show_form(_t('Nickname already exists.'));
+ } else if (!User::allowed_nickname($nickname)) {
+ $this->show_form(_t('Not a valid nickname.'));
} else if ($this->email_exists($email)) {
$this->show_form(_t('Email address already exists.'));
} else if ($password != $confirm) {
' WHERE id = ' . $this->id;
return $this->query($qry);
}
+
+ function allowed_nickname($nickname) {
+ # XXX: should already be validated for size, content, etc.
+ static $blacklist = array('rss', 'xrds', 'doc', 'main',
+ 'settings', 'notice', 'user');
+ $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
+ return !in_array($nickname, $merged);
+ }
}
#session_set_cookie_params(0, '/'. $config['site']['path'] .'/');
+#Standard fancy-url clashes prevented by not allowing nicknames on a blacklist
+#Add your own here. Note: empty array by default
+#$config['nickname']['blacklist'][] = 'scobleizer';
'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
'mail' =>
array('backend' => 'mail',
- 'params' => NULL)
+ 'params' => NULL),
+ 'nickname' =>
+ array('blacklist' => array())
);
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');