]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Move Temporal::convert() to DateTimeFormat::convert()
[friendica.git] / src / Model / User.php
index c767ec1b62f887e90fc6fac42724ed531e04ab23..7cf7fea2e6562b96f4041326726796750ac98a6f 100644 (file)
@@ -7,8 +7,8 @@ namespace Friendica\Model;
 
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
-use Friendica\Core\PConfig;
 use Friendica\Core\L10n;
+use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -17,14 +17,15 @@ use Friendica\Model\Group;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
 use Friendica\Util\Crypto;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use dba;
 use Exception;
+use LightOpenID;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
 require_once 'include/enotify.php';
-require_once 'library/openid.php';
 require_once 'include/text.php';
 /**
  * @brief This class handles User related functions
@@ -281,13 +282,13 @@ class User
 
                if (!x($username) || !x($email) || !x($nickname)) {
                        if ($openid_url) {
-                               if (!Network::validateURL($openid_url)) {
+                               if (!Network::isUrlValid($openid_url)) {
                                        throw new Exception(L10n::t('Invalid OpenID url'));
                                }
                                $_SESSION['register'] = 1;
                                $_SESSION['openid'] = $openid_url;
 
-                               $openid = new \LightOpenID;
+                               $openid = new LightOpenID;
                                $openid->identity = $openid_url;
                                $openid->returnUrl = System::baseUrl() . '/openid';
                                $openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
@@ -304,7 +305,7 @@ class User
                        throw new Exception(L10n::t('Please enter the required information.'));
                }
 
-               if (!Network::validateURL($openid_url)) {
+               if (!Network::isUrlValid($openid_url)) {
                        $openid_url = '';
                }
 
@@ -329,11 +330,11 @@ class User
                        }
                }
 
-               if (!Network::allowedEmail($email)) {
+               if (!Network::isEmailDomainAllowed($email)) {
                        throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
                }
 
-               if (!valid_email($email) || !Network::validateEmail($email)) {
+               if (!valid_email($email) || !Network::isEmailDomainValid($email)) {
                        throw new Exception(L10n::t('Not a valid email address.'));
                }
 
@@ -395,7 +396,7 @@ class User
                        'verified' => $verified,
                        'blocked'  => $blocked,
                        'timezone' => 'UTC',
-                       'register_date' => datetime_convert(),
+                       'register_date' => DateTimeFormat::utcNow(),
                        'default-location' => ''
                ]);
 
@@ -460,7 +461,7 @@ class User
 
                // if we have no OpenID photo try to look up an avatar
                if (!strlen($photo)) {
-                       $photo = Network::avatarImg($email);
+                       $photo = Network::lookupAvatarByEmail($email);
                }
 
                // unless there is no avatar-addon loaded
@@ -468,7 +469,7 @@ class User
                        $photo_failure = false;
 
                        $filename = basename($photo);
-                       $img_str = Network::fetchURL($photo, true);
+                       $img_str = Network::fetchUrl($photo, true);
                        // guess mimetype from headers or filename
                        $type = Image::guessType($photo, true);
 
@@ -612,7 +613,7 @@ class User
                dba::insert('userd', ['username' => $user['nickname']]);
 
                // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
-               dba::update('user', ['account_removed' => true, 'account_expires_on' => datetime_convert()], ['uid' => $uid]);
+               dba::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utcNow()], ['uid' => $uid]);
                Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
 
                // Send an update to the directory