- rewrote x() to empty() as it is deprecated
- fixed indending for some entries
This commit is contained in:
Roland Häder 2018-07-23 03:18:21 +02:00 committed by Hypolite Petovan
parent ffc70bee17
commit 4eb6707dc9

View File

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