"getUserId" is now "getLoggedInUserId"
This commit is contained in:
parent
15b93b4459
commit
c81e81dc8d
2
boot.php
2
boot.php
|
@ -379,7 +379,7 @@ function is_site_admin()
|
|||
|
||||
$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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1071,7 +1071,7 @@ function status_editor(App $a, array $x = [], $notes_cid = 0, $popup = false)
|
|||
DI::profiler()->startRecording('rendering');
|
||||
$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['default_location'] = $x['default_location'] ?? $user['default-location'];
|
||||
|
|
|
@ -513,7 +513,7 @@ function events_content(App $a)
|
|||
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
|
||||
|
||||
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 {
|
||||
$acl = '';
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ function follow_process(App $a, string $url)
|
|||
{
|
||||
$return_path = 'follow?url=' . urlencode($url);
|
||||
|
||||
$result = Contact::createFromProbeForUser($a->getUserId(), $url);
|
||||
$result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $url);
|
||||
|
||||
if ($result['success'] == false) {
|
||||
// Possibly it is a remote item and not an account
|
||||
|
|
|
@ -111,7 +111,7 @@ function ostatus_subscribe_content(App $a)
|
|||
|
||||
$probed = Contact::getByURL($url);
|
||||
if (in_array($probed['network'], Protocol::FEDERATED)) {
|
||||
$result = Contact::createFromProbeForUser($a->getUserId(), $probed['url']);
|
||||
$result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $probed['url']);
|
||||
if ($result['success']) {
|
||||
$o .= ' - ' . DI::l10n()->t('success');
|
||||
} else {
|
||||
|
|
|
@ -948,7 +948,7 @@ function photos_content(App $a)
|
|||
|
||||
$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,[
|
||||
'$pagename' => DI::l10n()->t('Upload Photos'),
|
||||
|
@ -961,7 +961,7 @@ function photos_content(App $a)
|
|||
'$albumselect' => $albumselect,
|
||||
'$permissions' => DI::l10n()->t('Permissions'),
|
||||
'$aclselect' => $aclselect_e,
|
||||
'$lockstate' => ACL::getLockstateForUserId($a->getUserId()) ? 'lock' : 'unlock',
|
||||
'$lockstate' => ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
|
||||
'$alt_uploader' => $ret['addon_text'],
|
||||
'$default_upload_box' => ($ret['default_upload'] ? $default_upload_box : ''),
|
||||
'$default_upload_submit' => ($ret['default_upload'] ? $default_upload_submit : ''),
|
||||
|
@ -1307,7 +1307,7 @@ function photos_content(App $a)
|
|||
|
||||
$album_e = $ph[0]['album'];
|
||||
$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, [
|
||||
'$id' => $ph[0]['id'],
|
||||
|
|
|
@ -69,8 +69,8 @@ function removeme_post(App $a)
|
|||
DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
if (User::getIdFromPasswordAuthentication($a->getUserId(), trim($_POST['qxz_password']))) {
|
||||
User::remove($a->getUserId());
|
||||
if (User::getIdFromPasswordAuthentication($a->getLoggedInUserId(), trim($_POST['qxz_password']))) {
|
||||
User::remove($a->getLoggedInUserId());
|
||||
|
||||
unset($_SESSION['authenticated']);
|
||||
unset($_SESSION['uid']);
|
||||
|
|
|
@ -70,7 +70,7 @@ function repair_ostatus_content(App $a) {
|
|||
|
||||
$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.'">';
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ function settings_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($a->getUserId());
|
||||
$user = User::getById($a->getLoggedInUserId());
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) {
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors');
|
||||
|
@ -590,7 +590,7 @@ function settings_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($a->getUserId());
|
||||
$user = User::getById($a->getLoggedInUserId());
|
||||
|
||||
$username = $user['username'];
|
||||
$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")],
|
||||
'$group_select' => Group::displayGroupSelection(local_user(), $user['def_gid']),
|
||||
'$permissions' => DI::l10n()->t('Default Post Permissions'),
|
||||
'$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getUserId()),
|
||||
'$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),
|
||||
|
||||
'$expire' => [
|
||||
'label' => DI::l10n()->t('Expiration settings'),
|
||||
|
|
|
@ -157,7 +157,7 @@ class App
|
|||
* Fetch the user id
|
||||
* @return int
|
||||
*/
|
||||
public function getUserId()
|
||||
public function getLoggedInUserId()
|
||||
{
|
||||
return $this->user_id;
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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,
|
||||
];
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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'],
|
||||
];
|
||||
|
|
|
@ -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.'));
|
||||
}
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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 />';
|
||||
|
|
|
@ -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 '';
|
||||
|
|
|
@ -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
|
||||
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
|
||||
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()) {
|
||||
$remoteUser = Contact::getById(remote_user(), $fields);
|
||||
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
|
||||
|
|
Loading…
Reference in a new issue