mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:10:11 +00:00
Add Contact Object
- Add Profile Object - Add User Model - Add use statements
This commit is contained in:
parent
f43aaf5227
commit
b92fc24ff0
50 changed files with 976 additions and 1 deletions
|
@ -10,6 +10,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Profile;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use dba;
|
||||
use Exception;
|
||||
|
|
50
src/Model/User.php
Normal file
50
src/Model/User.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* @file src/Model/User.php
|
||||
* @brief This file includes the User class with user related database functions
|
||||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use dba;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'plugin.php';
|
||||
|
||||
/**
|
||||
* @brief This class handles User related functions
|
||||
*/
|
||||
class User
|
||||
{
|
||||
public static function remove($uid)
|
||||
{
|
||||
if (!$uid) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger('Removing user: ' . $uid);
|
||||
|
||||
$r = dba::select('user', array(), array('uid' => $uid), array("limit" => 1));
|
||||
|
||||
call_hooks('remove_user', $r);
|
||||
|
||||
// save username (actually the nickname as it is guaranteed
|
||||
// unique), so it cannot be re-registered in the future.
|
||||
|
||||
dba::insert('userd', array('username' => $r['nickname']));
|
||||
|
||||
// The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
|
||||
q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid));
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
Worker::add(PRIORITY_LOW, "Directory", $r['url']);
|
||||
|
||||
if ($uid == local_user()) {
|
||||
unset($_SESSION['authenticated']);
|
||||
unset($_SESSION['uid']);
|
||||
goaway(System::baseUrl());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue