Browse Source

Cleanup: (#5463)

- rewrote x() to empty() as it is deprecated
- fixed indending for some entries
pull/5466/head
Roland Häder 3 years ago
committed by Hypolite Petovan
parent
commit
4eb6707dc9
1 changed files with 19 additions and 16 deletions
  1. +19
    -16
      src/Model/User.php

+ 19
- 16
src/Model/User.php View File

@ -314,16 +314,19 @@ class User
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;
}
@ -352,20 +355,20 @@ class User
$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) {
@ -384,7 +387,7 @@ class User
}
}
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'));


Loading…
Cancel
Save