Update function calls to use Model\User and Object\Contact

This commit is contained in:
Hypolite Petovan 2017-12-03 22:29:06 -05:00
parent b0dcfc2724
commit 27212c7f39
4 changed files with 8 additions and 11 deletions

View file

@ -1466,9 +1466,7 @@ function admin_page_users_post(App $a)
check_form_security_token_redirectOnErr('/admin/users', 'admin_users'); check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) { if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) {
require_once 'include/user.php'; $result = User::create(array('username' => $nu_name, 'email' => $nu_email,
$result = create_user(array('username' => $nu_name, 'email' => $nu_email,
'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language)); 'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language));
if (!$result['success']) { if (!$result['success']) {
notice($result['message']); notice($result['message']);

View file

@ -5,8 +5,8 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Model\User;
require_once('include/user.php');
require_once 'include/enotify.php'; require_once 'include/enotify.php';
require_once 'include/bbcode.php'; require_once 'include/bbcode.php';
@ -61,7 +61,7 @@ function register_post(App $a) {
$arr['verified'] = $verified; $arr['verified'] = $verified;
$arr['language'] = get_browser_language(); $arr['language'] = get_browser_language();
$result = create_user($arr); $result = User::create($arr);
if(! $result['success']) { if(! $result['success']) {
notice($result['message']); notice($result['message']);
@ -89,7 +89,7 @@ function register_post(App $a) {
// Only send a password mail when the password wasn't manually provided // Only send a password mail when the password wasn't manually provided
if (!x($_POST,'password1') || !x($_POST,'confirm')) { if (!x($_POST,'password1') || !x($_POST,'confirm')) {
$res = send_register_open_eml( $res = User::sendRegisterOpenEmail(
$user['email'], $user['email'],
$a->config['sitename'], $a->config['sitename'],
System::baseUrl(), System::baseUrl(),
@ -159,7 +159,7 @@ function register_post(App $a) {
)); ));
} }
// send notification to the user, that the registration is pending // send notification to the user, that the registration is pending
send_register_pending_eml( User::sendRegisterPendingEmail(
$user['email'], $user['email'],
$a->config['sitename'], $a->config['sitename'],
$user['username']); $user['username']);

View file

@ -6,8 +6,6 @@ use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once('include/user.php');
require_once 'include/enotify.php'; require_once 'include/enotify.php';
function user_allow($hash) function user_allow($hash)
@ -52,7 +50,7 @@ function user_allow($hash)
push_lang($register[0]['language']); push_lang($register[0]['language']);
send_register_open_eml( User::sendRegisterOpenEmail(
$user[0]['email'], $user[0]['email'],
$a->config['sitename'], $a->config['sitename'],
System::baseUrl(), System::baseUrl(),

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\GlobalContact; use Friendica\Model\GlobalContact;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Protocol\PortableContact; use Friendica\Protocol\PortableContact;
use dba; 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`)"); $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)) { if (DBM::is_result($r)) {
foreach ($r AS $user) { foreach ($r AS $user) {
user_create_self_contact($user['uid']);
logger('Create missing self contact for user ' . $user['uid']); logger('Create missing self contact for user ' . $user['uid']);
Contact::createSelfFromUserId($user['uid']);
} }
} }