]> git.mxchange.org Git - friendica.git/commitdiff
"getUserId" is now "getLoggedInUserId"
authorMichael <heluecht@pirati.ca>
Mon, 9 Aug 2021 20:33:46 +0000 (20:33 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 9 Aug 2021 20:33:46 +0000 (20:33 +0000)
23 files changed:
boot.php
include/conversation.php
mod/events.php
mod/follow.php
mod/ostatus_subscribe.php
mod/photos.php
mod/removeme.php
mod/repair_ostatus.php
mod/settings.php
src/App.php
src/BaseModule.php
src/Content/Nav.php
src/Module/Contact/Poke.php
src/Module/Conversation/Network.php
src/Module/Delegation.php
src/Module/Item/Compose.php
src/Module/Profile/Status.php
src/Module/Security/TwoFactor/Recovery.php
src/Module/Security/TwoFactor/Verify.php
src/Module/Settings/Profile/Index.php
src/Object/EMail/ItemCCEMail.php
src/Object/Post.php
view/theme/frio/theme.php

index c71c16b354e3bac9609b99e4081d6d3f5d5451fd..7ee023b68a34328e95680f23b558e77c191d7080 100644 (file)
--- a/boot.php
+++ b/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]);
 }
 
 /**
index b545445e4b25ed7e1266a63b6c9bffa27583951d..684532345f5f0d082768dd9d1b2df6b8c717ad11 100644 (file)
@@ -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'];
index e7c3ed36f12ad033eabdfb39659feb9f04fe9bc0..ebb7d3f114649f045fd4ab3c737625644fd31345 100644 (file)
@@ -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 = '';
                }
index d7b01e6192f00b1473abade23bb244a26e5b68f2..075e58d091b18181afe36e389d263672fbebe900 100644 (file)
@@ -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
index 9de27f52ed3e92df60704c16c03870389e94b053..57f8b9a738c3a2b654ca4ae0b302070414e409d5 100644 (file)
@@ -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 {
index 1379ed12e6c7f763e39a9a07a11b825b28cd1cfd..45129210741acbcf2a46f3f9cbc1c3962dc274c2 100644 (file)
@@ -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'],
index 5df3360655d61c2ec14f5733b1b1e66ac58d5907..bdc49ab745ebb7cddc14beb0881a8edad0cb636a 100644 (file)
@@ -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']);
index e201e60a4a3861febd18fb65687ea80b1704157a..bc6b177f9528b8a896ca320dbcd435ec50b11067 100644 (file)
@@ -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.'">';
 
index 378e25ed9f7fd3d38c98f01a6a01bff3fec9003e..ce556b8bf146c5d981b38897583713b87c302daf 100644 (file)
@@ -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'),
index 3a952c7a338c7ba7f43b7994adf7325f694ce43f..69167e98f1ceee4e64b340f346074500a5e9cc1e 100644 (file)
@@ -157,7 +157,7 @@ class App
         * Fetch the user id
         * @return int 
         */
-       public function getUserId()
+       public function getLoggedInUserId()
        {
                return $this->user_id;
        }
index b812370fdf0d5b35f335d0e47005f148b23620fb..d7ca5798deb61ae48bbc0eabd96a40689d7c6362 100644 (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)) {
index 56049fa16e2bfdc823f9013f0d3c82296b58b76f..b9f61dacb2aeda5008ec2d0b50de841bf4a91700 100644 (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'],
index 01d3ec138547a6b8f64dacd209f8d1c669913738..d9dd7e27aa4f964b309b5051ac7af99142d72bff 100644 (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']);
index 1e97894cb834bf01463e8f030bec3d3515dcb457..d9f34e3e83b6c06d4b27090e4b2da12d521f4106 100644 (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,
                        ];
index cd3f50f59f098eeb66c076b6210e12a47ee2b311..45f7fc57d2bca064270de857b0e86e53bc348cc1 100644 (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'));
index b7e6bce7de04352d01125053815237328c3d6f72..29fdbea746c88b1a78ed8ca47165082bfb5de421 100644 (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,
index b60fb2cdb6adc61b4a545dfc40473372b01e8619..c6a9e272a989afda1ee560a353b2815dc743f1bf 100644 (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'],
                        ];
index 9faab40705d4bc193ac2436294f8e0f73c482f1b..d93146cb6cc3ed0a56d5c3810ecd17df6d084a02 100644 (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.'));
                        }
index bb3e444a930380c28c5a8c1e32b926bfc8305314..22c757b82deacfdc7558a668f6bbfb8161fb6f56 100644 (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.');
                        }
index adf6fff974d86c503dd51469b635c9c6423cae50..b5f7ef350010c572eaf82180daefb0867154e1e6 100644 (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],
index 1fa2e94d773b1b131e384cb8dd10875d368f7f3d..199a6bad1af4634ba3f9392b04993de60b1ffc0e 100644 (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 />';
index 8ffe4bbafdfa64690460aab6cc3f0416cfb2ba36..dcb7ad208b2dede4e3ff95e3ceffe2ccb15eadc2 100644 (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 '';
index 446aa6acdc88dd4efd7aadf1cf4f3fb98b1744dd..5304d3fd463d4d13874bd12151bdd5b2528b907c 100644 (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
        $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');