"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

@ -379,7 +379,7 @@ function is_site_admin()
$adminlist = explode(',', str_replace(' ', '', $admin_email)); $adminlist = explode(',', str_replace(' ', '', $admin_email));
return local_user() && $admin_email && DBA::exists('user', ['uid' => $a->getUserId(), 'email' => $adminlist]); return local_user() && $admin_email && DBA::exists('user', ['uid' => $a->getLoggedInUserId(), 'email' => $adminlist]);
} }
/** /**

View File

@ -1071,7 +1071,7 @@ function status_editor(App $a, array $x = [], $notes_cid = 0, $popup = false)
DI::profiler()->startRecording('rendering'); DI::profiler()->startRecording('rendering');
$o = ''; $o = '';
$user = User::getById($a->getUserId(), ['uid', 'nickname', 'allow_location', 'default-location']); $user = User::getById($a->getLoggedInUserId(), ['uid', 'nickname', 'allow_location', 'default-location']);
$x['allow_location'] = $x['allow_location'] ?? $user['allow_location']; $x['allow_location'] = $x['allow_location'] ?? $user['allow_location'];
$x['default_location'] = $x['default_location'] ?? $user['default-location']; $x['default_location'] = $x['default_location'] ?? $user['default-location'];

View File

@ -513,7 +513,7 @@ function events_content(App $a)
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00'; $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
if (!$cid && in_array($mode, ['new', 'copy'])) { if (!$cid && in_array($mode, ['new', 'copy'])) {
$acl = ACL::getFullSelectorHTML(DI::page(), $a->getUserId(), false, ACL::getDefaultUserPermissions($orig_event)); $acl = ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), false, ACL::getDefaultUserPermissions($orig_event));
} else { } else {
$acl = ''; $acl = '';
} }

View File

@ -175,7 +175,7 @@ function follow_process(App $a, string $url)
{ {
$return_path = 'follow?url=' . urlencode($url); $return_path = 'follow?url=' . urlencode($url);
$result = Contact::createFromProbeForUser($a->getUserId(), $url); $result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $url);
if ($result['success'] == false) { if ($result['success'] == false) {
// Possibly it is a remote item and not an account // Possibly it is a remote item and not an account

View File

@ -111,7 +111,7 @@ function ostatus_subscribe_content(App $a)
$probed = Contact::getByURL($url); $probed = Contact::getByURL($url);
if (in_array($probed['network'], Protocol::FEDERATED)) { if (in_array($probed['network'], Protocol::FEDERATED)) {
$result = Contact::createFromProbeForUser($a->getUserId(), $probed['url']); $result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $probed['url']);
if ($result['success']) { if ($result['success']) {
$o .= ' - ' . DI::l10n()->t('success'); $o .= ' - ' . DI::l10n()->t('success');
} else { } else {

View File

@ -948,7 +948,7 @@ function photos_content(App $a)
$tpl = Renderer::getMarkupTemplate('photos_upload.tpl'); $tpl = Renderer::getMarkupTemplate('photos_upload.tpl');
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML(DI::page(), $a->getUserId())); $aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()));
$o .= Renderer::replaceMacros($tpl,[ $o .= Renderer::replaceMacros($tpl,[
'$pagename' => DI::l10n()->t('Upload Photos'), '$pagename' => DI::l10n()->t('Upload Photos'),
@ -961,7 +961,7 @@ function photos_content(App $a)
'$albumselect' => $albumselect, '$albumselect' => $albumselect,
'$permissions' => DI::l10n()->t('Permissions'), '$permissions' => DI::l10n()->t('Permissions'),
'$aclselect' => $aclselect_e, '$aclselect' => $aclselect_e,
'$lockstate' => ACL::getLockstateForUserId($a->getUserId()) ? 'lock' : 'unlock', '$lockstate' => ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'$alt_uploader' => $ret['addon_text'], '$alt_uploader' => $ret['addon_text'],
'$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''), '$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''),
'$default_upload_submit' => ($ret['default_upload'] ? $default_upload_submit : ''), '$default_upload_submit' => ($ret['default_upload'] ? $default_upload_submit : ''),
@ -1307,7 +1307,7 @@ function photos_content(App $a)
$album_e = $ph[0]['album']; $album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc']; $caption_e = $ph[0]['desc'];
$aclselect_e = ACL::getFullSelectorHTML(DI::page(), $a->getUserId(), false, ACL::getDefaultUserPermissions($ph[0])); $aclselect_e = ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), false, ACL::getDefaultUserPermissions($ph[0]));
$edit = Renderer::replaceMacros($edit_tpl, [ $edit = Renderer::replaceMacros($edit_tpl, [
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],

View File

@ -69,8 +69,8 @@ function removeme_post(App $a)
DI::emailer()->send($email); DI::emailer()->send($email);
} }
if (User::getIdFromPasswordAuthentication($a->getUserId(), trim($_POST['qxz_password']))) { if (User::getIdFromPasswordAuthentication($a->getLoggedInUserId(), trim($_POST['qxz_password']))) {
User::remove($a->getUserId()); User::remove($a->getLoggedInUserId());
unset($_SESSION['authenticated']); unset($_SESSION['authenticated']);
unset($_SESSION['uid']); unset($_SESSION['uid']);

View File

@ -70,7 +70,7 @@ function repair_ostatus_content(App $a) {
$o .= "<p>".DI::l10n()->t("Keep this window open until done.")."</p>"; $o .= "<p>".DI::l10n()->t("Keep this window open until done.")."</p>";
Contact::createFromProbeForUser($a->getUserId(), $r[0]["url"]); Contact::createFromProbeForUser($a->getLoggedInUserId(), $r[0]["url"]);
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . DI::baseUrl() . '/repair_ostatus?counter='.$counter.'">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . DI::baseUrl() . '/repair_ostatus?counter='.$counter.'">';

View File

@ -69,7 +69,7 @@ function settings_post(App $a)
return; return;
} }
$user = User::getById($a->getUserId()); $user = User::getById($a->getLoggedInUserId());
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors'); BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors');
@ -590,7 +590,7 @@ function settings_content(App $a)
return; return;
} }
$user = User::getById($a->getUserId()); $user = User::getById($a->getLoggedInUserId());
$username = $user['username']; $username = $user['username'];
$email = $user['email']; $email = $user['email'];
@ -748,7 +748,7 @@ function settings_content(App $a)
'$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")], '$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")],
'$group_select' => Group::displayGroupSelection(local_user(), $user['def_gid']), '$group_select' => Group::displayGroupSelection(local_user(), $user['def_gid']),
'$permissions' => DI::l10n()->t('Default Post Permissions'), '$permissions' => DI::l10n()->t('Default Post Permissions'),
'$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getUserId()), '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),
'$expire' => [ '$expire' => [
'label' => DI::l10n()->t('Expiration settings'), 'label' => DI::l10n()->t('Expiration settings'),

View File

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

View File

@ -136,7 +136,7 @@ abstract class BaseModule
*/ */
public static function getFormSecurityToken($typename = '') public static function getFormSecurityToken($typename = '')
{ {
$user = User::getById(DI::app()->getUserId(), ['guid', 'prvkey']); $user = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
$timestamp = time(); $timestamp = time();
$sec_hash = hash('whirlpool', ($user['guid'] ?? '') . ($user['prvkey'] ?? '') . session_id() . $timestamp . $typename); $sec_hash = hash('whirlpool', ($user['guid'] ?? '') . ($user['prvkey'] ?? '') . session_id() . $timestamp . $typename);
@ -163,7 +163,7 @@ abstract class BaseModule
$max_livetime = 10800; // 3 hours $max_livetime = 10800; // 3 hours
$user = User::getById(DI::app()->getUserId(), ['guid', 'prvkey']); $user = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
$x = explode('.', $hash); $x = explode('.', $hash);
if (time() > (intval($x[0]) + $max_livetime)) { 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')]; $nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
// user info // 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 = [ $userinfo = [
'icon' => Contact::getMicro($contact), 'icon' => Contact::getMicro($contact),
'name' => $contact['name'], 'name' => $contact['name'],

View File

@ -55,7 +55,7 @@ class Poke extends BaseModule
$private = !empty($_POST['private']) ? Model\Item::PRIVATE : Model\Item::PUBLIC; $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_cid = ($private ? '<' . $contact['id']. '>' : $user['allow_cid']);
$allow_gid = ($private ? '' : $user['allow_gid']); $allow_gid = ($private ? '' : $user['allow_gid']);
$deny_cid = ($private ? '' : $user['deny_cid']); $deny_cid = ($private ? '' : $user['deny_cid']);

View File

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

View File

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

View File

@ -186,7 +186,7 @@ class Compose extends BaseModule
'$jotplugins' => $jotplugins, '$jotplugins' => $jotplugins,
'$rand_num' => Crypto::randomDigits(12), '$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_cid' => $contact_allow_list,
'allow_gid' => $group_allow_list, 'allow_gid' => $group_allow_list,
'deny_cid' => $contact_deny_list, 'deny_cid' => $contact_deny_list,

View File

@ -127,7 +127,7 @@ class Status extends BaseProfile
'allow_location' => ($is_owner || $commvisitor) && $profile['allow_location'], 'allow_location' => ($is_owner || $commvisitor) && $profile['allow_location'],
'default_location' => $is_owner ? $profile['default-location'] : '', 'default_location' => $is_owner ? $profile['default-location'] : '',
'nickname' => $profile['nickname'], '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', 'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
'profile_uid' => $profile['uid'], 'profile_uid' => $profile['uid'],
]; ];

View File

@ -60,7 +60,7 @@ class Recovery extends BaseModule
Session::set('2fa', true); Session::set('2fa', true);
info(DI::l10n()->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user()))); 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 { } else {
notice(DI::l10n()->t('Invalid code, please retry.')); notice(DI::l10n()->t('Invalid code, please retry.'));
} }

View File

@ -71,7 +71,7 @@ class Verify extends BaseModule
} }
// Resume normal login workflow // 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 { } else {
self::$errors[] = DI::l10n()->t('Invalid code, please retry.'); 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], 'value' => ['profile_field[' . $profileField->id . '][value]', DI::l10n()->t('Value:'), $profileField->value],
'acl' => ACL::getFullSelectorHTML( 'acl' => ACL::getFullSelectorHTML(
DI::page(), DI::page(),
$a->getUserId(), $a->getLoggedInUserId(),
false, false,
$defaultPermissions, $defaultPermissions,
['network' => Protocol::DFRN], ['network' => Protocol::DFRN],
@ -191,7 +191,7 @@ class Index extends BaseSettings
'value' => ['profile_field[new][value]', DI::l10n()->t('Value:')], 'value' => ['profile_field[new][value]', DI::l10n()->t('Value:')],
'acl' => ACL::getFullSelectorHTML( 'acl' => ACL::getFullSelectorHTML(
DI::page(), DI::page(),
$a->getUserId(), $a->getLoggedInUserId(),
false, false,
['allow_cid' => []], ['allow_cid' => []],
['network' => Protocol::DFRN], ['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) 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']) $disclaimer = '<hr />' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $user['username'])
. '<br />'; . '<br />';

View File

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

View File

@ -202,7 +202,7 @@ function frio_remote_nav(App $a, array &$nav_info)
// this isn't optimal because the contact query will be done now twice // this isn't optimal because the contact query will be done now twice
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated']; $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
if ($a->isLoggedIn()) { if ($a->isLoggedIn()) {
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getUserId(), 'self' => true]); $remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
} elseif (!local_user() && remote_user()) { } elseif (!local_user() && remote_user()) {
$remoteUser = Contact::getById(remote_user(), $fields); $remoteUser = Contact::getById(remote_user(), $fields);
$nav_info['nav']['remote'] = DI::l10n()->t('Guest'); $nav_info['nav']['remote'] = DI::l10n()->t('Guest');