"getUserId" is now "getLoggedInUserId"

This commit is contained in:
Michael
2021-08-09 20:33:46 +00:00
parent 15b93b4459
commit c81e81dc8d
23 changed files with 31 additions and 31 deletions

View File

@@ -157,7 +157,7 @@ class App
* Fetch the user id
* @return int
*/
public function getUserId()
public function getLoggedInUserId()
{
return $this->user_id;
}

View File

@@ -136,7 +136,7 @@ abstract class BaseModule
*/
public static function getFormSecurityToken($typename = '')
{
$user = User::getById(DI::app()->getUserId(), ['guid', 'prvkey']);
$user = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
$timestamp = time();
$sec_hash = hash('whirlpool', ($user['guid'] ?? '') . ($user['prvkey'] ?? '') . session_id() . $timestamp . $typename);
@@ -163,7 +163,7 @@ abstract class BaseModule
$max_livetime = 10800; // 3 hours
$user = User::getById(DI::app()->getUserId(), ['guid', 'prvkey']);
$user = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
$x = explode('.', $hash);
if (time() > (intval($x[0]) + $max_livetime)) {

View File

@@ -195,7 +195,7 @@ class Nav
$nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
// user info
$contact = DBA::selectFirst('contact', ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'], ['uid' => $a->getUserId(), 'self' => true]);
$contact = DBA::selectFirst('contact', ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'], ['uid' => $a->getLoggedInUserId(), 'self' => true]);
$userinfo = [
'icon' => Contact::getMicro($contact),
'name' => $contact['name'],

View File

@@ -55,7 +55,7 @@ class Poke extends BaseModule
$private = !empty($_POST['private']) ? Model\Item::PRIVATE : Model\Item::PUBLIC;
$user = Model\User::getById($a->getUserId());
$user = Model\User::getById($a->getLoggedInUserId());
$allow_cid = ($private ? '<' . $contact['id']. '>' : $user['allow_cid']);
$allow_gid = ($private ? '' : $user['allow_gid']);
$deny_cid = ($private ? '' : $user['deny_cid']);

View File

@@ -139,8 +139,8 @@ class Network extends BaseModule
}
$x = [
'lockstate' => self::$groupId || self::$forumContactId || self::$network || ACL::getLockstateForUserId($a->getUserId()) ? 'lock' : 'unlock',
'acl' => ACL::getFullSelectorHTML(DI::page(), $a->getUserId(), true, $default_permissions),
'lockstate' => self::$groupId || self::$forumContactId || self::$network || ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'acl' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), true, $default_permissions),
'bang' => ((self::$groupId || self::$forumContactId || self::$network) ? '!' : ''),
'content' => $content,
];

View File

@@ -45,7 +45,7 @@ class Delegation extends BaseModule
}
$uid = local_user();
$orig_record = User::getById(DI::app()->getUserId());
$orig_record = User::getById(DI::app()->getLoggedInUserId());
if (Session::get('submanage')) {
$user = User::getById(Session::get('submanage'));

View File

@@ -186,7 +186,7 @@ class Compose extends BaseModule
'$jotplugins' => $jotplugins,
'$rand_num' => Crypto::randomDigits(12),
'$acl_selector' => ACL::getFullSelectorHTML(DI::page(), $a->getUserId(), $doesFederate, [
'$acl_selector' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), $doesFederate, [
'allow_cid' => $contact_allow_list,
'allow_gid' => $group_allow_list,
'deny_cid' => $contact_deny_list,

View File

@@ -127,7 +127,7 @@ class Status extends BaseProfile
'allow_location' => ($is_owner || $commvisitor) && $profile['allow_location'],
'default_location' => $is_owner ? $profile['default-location'] : '',
'nickname' => $profile['nickname'],
'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->getUserId(), true) : '',
'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), true) : '',
'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
'profile_uid' => $profile['uid'],
];

View File

@@ -60,7 +60,7 @@ class Recovery extends BaseModule
Session::set('2fa', true);
info(DI::l10n()->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
DI::auth()->setForUser($a, User::getById($a->getUserId()), true, true);
DI::auth()->setForUser($a, User::getById($a->getLoggedInUserId()), true, true);
} else {
notice(DI::l10n()->t('Invalid code, please retry.'));
}

View File

@@ -71,7 +71,7 @@ class Verify extends BaseModule
}
// Resume normal login workflow
DI::auth()->setForUser($a, User::getById($a->getUserId()), true, true);
DI::auth()->setForUser($a, User::getById($a->getLoggedInUserId()), true, true);
} else {
self::$errors[] = DI::l10n()->t('Invalid code, please retry.');
}

View File

@@ -171,7 +171,7 @@ class Index extends BaseSettings
'value' => ['profile_field[' . $profileField->id . '][value]', DI::l10n()->t('Value:'), $profileField->value],
'acl' => ACL::getFullSelectorHTML(
DI::page(),
$a->getUserId(),
$a->getLoggedInUserId(),
false,
$defaultPermissions,
['network' => Protocol::DFRN],
@@ -191,7 +191,7 @@ class Index extends BaseSettings
'value' => ['profile_field[new][value]', DI::l10n()->t('Value:')],
'acl' => ACL::getFullSelectorHTML(
DI::page(),
$a->getUserId(),
$a->getLoggedInUserId(),
false,
['allow_cid' => []],
['network' => Protocol::DFRN],

View File

@@ -37,7 +37,7 @@ class ItemCCEMail extends Email
{
public function __construct(App $a, L10n $l10n, BaseURL $baseUrl, array $item, string $toAddress, string $authorThumb)
{
$user = User::getById($a->getUserId());
$user = User::getById($a->getLoggedInUserId());
$disclaimer = '<hr />' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $user['username'])
. '<br />';

View File

@@ -870,7 +870,7 @@ class Post
return '';
}
$owner = User::getOwnerDataById($a->getUserId());
$owner = User::getOwnerDataById($a->getLoggedInUserId());
if (!Feature::isEnabled(local_user(), 'explicit_mentions')) {
return '';