From 27212c7f3904d42308686bf82b9b300be3d8dc7c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 3 Dec 2017 22:29:06 -0500 Subject: [PATCH] Update function calls to use Model\User and Object\Contact --- mod/admin.php | 4 +--- mod/register.php | 8 ++++---- mod/regmod.php | 4 +--- src/Worker/CronJobs.php | 3 ++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index d73ac23fd0..1b6975ab89 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1466,9 +1466,7 @@ function admin_page_users_post(App $a) check_form_security_token_redirectOnErr('/admin/users', 'admin_users'); if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) { - require_once 'include/user.php'; - - $result = create_user(array('username' => $nu_name, 'email' => $nu_email, + $result = User::create(array('username' => $nu_name, 'email' => $nu_email, 'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language)); if (!$result['success']) { notice($result['message']); diff --git a/mod/register.php b/mod/register.php index 8645ecb9ce..4f6dedd24b 100644 --- a/mod/register.php +++ b/mod/register.php @@ -5,8 +5,8 @@ use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; +use Friendica\Model\User; -require_once('include/user.php'); require_once 'include/enotify.php'; require_once 'include/bbcode.php'; @@ -61,7 +61,7 @@ function register_post(App $a) { $arr['verified'] = $verified; $arr['language'] = get_browser_language(); - $result = create_user($arr); + $result = User::create($arr); if(! $result['success']) { notice($result['message']); @@ -89,7 +89,7 @@ function register_post(App $a) { // Only send a password mail when the password wasn't manually provided if (!x($_POST,'password1') || !x($_POST,'confirm')) { - $res = send_register_open_eml( + $res = User::sendRegisterOpenEmail( $user['email'], $a->config['sitename'], System::baseUrl(), @@ -159,7 +159,7 @@ function register_post(App $a) { )); } // send notification to the user, that the registration is pending - send_register_pending_eml( + User::sendRegisterPendingEmail( $user['email'], $a->config['sitename'], $user['username']); diff --git a/mod/regmod.php b/mod/regmod.php index 7fce6914f2..2c5d61059a 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -6,8 +6,6 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBM; -require_once('include/user.php'); - require_once 'include/enotify.php'; function user_allow($hash) @@ -52,7 +50,7 @@ function user_allow($hash) push_lang($register[0]['language']); - send_register_open_eml( + User::sendRegisterOpenEmail( $user[0]['email'], $a->config['sitename'], System::baseUrl(), diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index a59cd4f9f1..7df7d030cb 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -12,6 +12,7 @@ use Friendica\Core\Config; use Friendica\Database\DBM; use Friendica\Model\GlobalContact; use Friendica\Network\Probe; +use Friendica\Object\Contact; use Friendica\Protocol\PortableContact; use dba; @@ -263,8 +264,8 @@ class CronJobs $r = q("SELECT `uid` FROM `user` WHERE NOT EXISTS (SELECT `uid` FROM `contact` WHERE `contact`.`uid` = `user`.`uid` AND `contact`.`self`)"); if (DBM::is_result($r)) { foreach ($r AS $user) { - user_create_self_contact($user['uid']); logger('Create missing self contact for user ' . $user['uid']); + Contact::createSelfFromUserId($user['uid']); } } -- 2.39.5