public static function isNicknameBlocked($nickname)
{
$forbidden_nicknames = Config::get('system', 'forbidden_nicknames', '');
+
// if the config variable is empty return false
- if (!x($forbidden_nicknames)) {
+ if (empty($forbidden_nicknames)) {
return false;
}
+
// check if the nickname is in the list of blocked nicknames
$forbidden = explode(',', $forbidden_nicknames);
$forbidden = array_map('trim', $forbidden);
if (in_array(strtolower($nickname), $forbidden)) {
return true;
}
+
// else return false
return false;
}
$using_invites = Config::get('system', 'invitation_only');
$num_invites = Config::get('system', 'number_invites');
- $invite_id = x($data, 'invite_id') ? notags(trim($data['invite_id'])) : '';
- $username = x($data, 'username') ? notags(trim($data['username'])) : '';
- $nickname = x($data, 'nickname') ? notags(trim($data['nickname'])) : '';
- $email = x($data, 'email') ? notags(trim($data['email'])) : '';
- $openid_url = x($data, 'openid_url') ? notags(trim($data['openid_url'])) : '';
- $photo = x($data, 'photo') ? notags(trim($data['photo'])) : '';
- $password = x($data, 'password') ? trim($data['password']) : '';
- $password1 = x($data, 'password1') ? trim($data['password1']) : '';
- $confirm = x($data, 'confirm') ? trim($data['confirm']) : '';
- $blocked = x($data, 'blocked') ? intval($data['blocked']) : 0;
- $verified = x($data, 'verified') ? intval($data['verified']) : 0;
- $language = x($data, 'language') ? notags(trim($data['language'])) : 'en';
-
- $publish = x($data, 'profile_publish_reg') && intval($data['profile_publish_reg']) ? 1 : 0;
+ $invite_id = !empty($data['invite_id']) ? notags(trim($data['invite_id'])) : '';
+ $username = !empty($data['username']) ? notags(trim($data['username'])) : '';
+ $nickname = !empty($data['nickname']) ? notags(trim($data['nickname'])) : '';
+ $email = !empty($data['email']) ? notags(trim($data['email'])) : '';
+ $openid_url = !empty($data['openid_url']) ? notags(trim($data['openid_url'])) : '';
+ $photo = !empty($data['photo']) ? notags(trim($data['photo'])) : '';
+ $password = !empty($data['password']) ? trim($data['password']) : '';
+ $password1 = !empty($data['password1']) ? trim($data['password1']) : '';
+ $confirm = !empty($data['confirm']) ? trim($data['confirm']) : '';
+ $blocked = !empty($data['blocked']) ? intval($data['blocked']) : 0;
+ $verified = !empty($data['verified']) ? intval($data['verified']) : 0;
+ $language = !empty($data['language']) ? notags(trim($data['language'])) : 'en';
+
+ $publish = !empty($data['profile_publish_reg']) && intval($data['profile_publish_reg']) ? 1 : 0;
$netpublish = strlen(Config::get('system', 'directory')) ? $publish : 0;
if ($password1 != $confirm) {
}
}
- if (!x($username) || !x($email) || !x($nickname)) {
+ if (empty($username) || empty($email) || empty($nickname)) {
if ($openid_url) {
if (!Network::isUrlValid($openid_url)) {
throw new Exception(L10n::t('Invalid OpenID url'));