use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\TwoFactor\AppSpecificPassword;
+use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
use Friendica\Network\HTTPException;
use Friendica\Object\Image;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images;
use Friendica\Util\Network;
+use Friendica\Util\Proxy;
use Friendica\Util\Strings;
use Friendica\Worker\Delivery;
use ImagickException;
const ACCOUNT_TYPE_NEWS = 2;
const ACCOUNT_TYPE_COMMUNITY = 3;
const ACCOUNT_TYPE_RELAY = 4;
+ const ACCOUNT_TYPE_DELETED = 127;
/**
* @}
*/
$system['name'] = 'System Account';
$system['addr'] = $system_actor_name . '@' . DI::baseUrl()->getHostname();
$system['nick'] = $system_actor_name;
- $system['avatar'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
- $system['photo'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
- $system['thumb'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_THUMB;
- $system['micro'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_MICRO;
$system['url'] = DI::baseUrl() . '/friendica';
+
+ $system['avatar'] = $system['photo'] = Contact::getDefaultAvatar($system, Proxy::SIZE_SMALL);
+ $system['thumb'] = Contact::getDefaultAvatar($system, Proxy::SIZE_THUMB);
+ $system['micro'] = Contact::getDefaultAvatar($system, Proxy::SIZE_MICRO);
+
$system['nurl'] = Strings::normaliseLink($system['url']);
$system['pubkey'] = $keys['pubkey'];
$system['prvkey'] = $keys['prvkey'];
/**
* Get owner data by user id
*
- * @param int $uid
- * @param boolean $check_valid Test if data is invalid and correct it
+ * @param int $uid
+ * @param boolean $repairMissing Repair the owner data if it's missing
* @return boolean|array
* @throws Exception
*/
- public static function getOwnerDataById(int $uid, bool $check_valid = true)
+ public static function getOwnerDataById(int $uid, bool $repairMissing = true)
{
if ($uid == 0) {
return self::getSystemAccount();
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
if (!DBA::isResult($owner)) {
- if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) {
+ if (!DBA::exists('user', ['uid' => $uid]) || !$repairMissing) {
return false;
}
Contact::createSelfFromUserId($uid);
return false;
}
- if (!$check_valid) {
+ if (!$repairMissing) {
return $owner;
}
* @return array
* @throws HTTPException\NotFoundException
*/
- private static function getAuthenticationInfo($user_info)
+ public static function getAuthenticationInfo($user_info)
{
$user = null;
return false;
}
+ // Delete the avatar
+ Photo::delete(['uid' => $register['uid']]);
+
return DBA::delete('user', ['uid' => $register['uid']]) &&
Register::deleteByHash($register['hash']);
}
*/
public static function remove(int $uid)
{
- if (!$uid) {
+ if (empty($uid)) {
return false;
}