diff --git a/include/api.php b/include/api.php index 7b649da7df..e0cac831e5 100644 --- a/include/api.php +++ b/include/api.php @@ -322,7 +322,7 @@ function api_call(App $a, App\Arguments $args = null) if (!empty($info['auth']) && api_user() === false) { api_login($a); - Logger::info(API_LOG_PREFIX . 'nickname {nickname}', ['module' => 'api', 'action' => 'call', 'nickname' => $a->getUserNickname()]); + Logger::info(API_LOG_PREFIX . 'nickname {nickname}', ['module' => 'api', 'action' => 'call', 'nickname' => $a->getLoggedInUserNickname()]); } Logger::debug(API_LOG_PREFIX . 'parameters', ['module' => 'api', 'action' => 'call', 'parameters' => $_REQUEST]); diff --git a/mod/display.php b/mod/display.php index 7ac4f38ce8..5e24bd4b43 100644 --- a/mod/display.php +++ b/mod/display.php @@ -62,7 +62,7 @@ function display_init(App $a) if (local_user()) { $item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()]); if (DBA::isResult($item)) { - $nick = $a->getUserNickname(); + $nick = $a->getLoggedInUserNickname(); } } diff --git a/mod/editpost.php b/mod/editpost.php index e522522e3d..cc72dbd3c2 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -68,7 +68,7 @@ function editpost_content(App $a) DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => ' ', // DI::l10n()->t('Visible to everybody'), '$geotag' => $geotag, - '$nickname' => $a->getUserNickname(), + '$nickname' => $a->getLoggedInUserNickname(), '$is_mobile' => DI::mode()->isMobile(), ]); diff --git a/mod/events.php b/mod/events.php index 25a9376325..e7c3ed36f1 100644 --- a/mod/events.php +++ b/mod/events.php @@ -280,7 +280,7 @@ function events_content(App $a) $tabs = ''; // tabs if ($a->getThemeInfoValue('events_in_profile')) { - $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getUserNickname(), false); + $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getLoggedInUserNickname(), false); } $mode = 'view'; diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 5d086e0bf8..53aa255a2e 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -88,7 +88,7 @@ function fbrowser_content(App $a) } return [ - DI::baseUrl() . '/photos/' . $a->getUserNickname() . '/image/' . $rr['resource-id'], + DI::baseUrl() . '/photos/' . $a->getLoggedInUserNickname() . '/image/' . $rr['resource-id'], $filename_e, DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext ]; @@ -103,7 +103,7 @@ function fbrowser_content(App $a) '$folders' => $albums, '$files' => $files, '$cancel' => DI::l10n()->t('Cancel'), - '$nickname' => $a->getUserNickname(), + '$nickname' => $a->getLoggedInUserNickname(), '$upload' => DI::l10n()->t('Upload') ]); @@ -132,7 +132,7 @@ function fbrowser_content(App $a) '$folders' => false, '$files' => $files, '$cancel' => DI::l10n()->t('Cancel'), - '$nickname' => $a->getUserNickname(), + '$nickname' => $a->getLoggedInUserNickname(), '$upload' => DI::l10n()->t('Upload') ]); } diff --git a/mod/message.php b/mod/message.php index c8e5f42904..2f4fe0c1aa 100644 --- a/mod/message.php +++ b/mod/message.php @@ -112,7 +112,7 @@ function message_content(App $a) return Login::form(); } - $myprofile = DI::baseUrl() . '/profile/' . $a->getUserNickname(); + $myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname(); $tpl = Renderer::getMarkupTemplate('mail_head.tpl'); if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') { @@ -179,7 +179,7 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => DI::baseUrl()->get(true), - '$nickname' => $a->getUserNickname(), + '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -292,7 +292,7 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => DI::baseUrl()->get(true), - '$nickname' => $a->getUserNickname(), + '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -431,7 +431,7 @@ function render_messages(array $msg, $t) $tpl = Renderer::getMarkupTemplate($t); $rslt = ''; - $myprofile = DI::baseUrl() . '/profile/' . $a->getUserNickname(); + $myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname(); foreach ($msg as $rr) { if ($rr['unknown']) { diff --git a/mod/notes.php b/mod/notes.php index 1c160a2f2e..11ec8a0352 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -45,7 +45,7 @@ function notes_content(App $a, $update = false) return; } - $o = BaseProfile::getTabsHTML($a, 'notes', true, $a->getUserNickname(), false); + $o = BaseProfile::getTabsHTML($a, 'notes', true, $a->getLoggedInUserNickname(), false); if (!$update) { $o .= '

' . DI::l10n()->t('Personal Notes') . '

'; diff --git a/mod/photos.php b/mod/photos.php index f90a9f3bfc..1379ed12e6 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -224,7 +224,7 @@ function photos_post(App $a) // Update the photo albums cache Photo::clearAlbumCache($page_owner_uid); - DI::baseUrl()->redirect('photos/' . $a->getUserNickname() . '/album/' . bin2hex($newalbum)); + DI::baseUrl()->redirect('photos/' . $a->getLoggedInUserNickname() . '/album/' . bin2hex($newalbum)); return; // NOTREACHED } diff --git a/mod/ping.php b/mod/ping.php index 14331b2e77..bdd30be3fc 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -193,7 +193,7 @@ function ping_init(App $a) $intro_count = count($intros1) + count($intros2); $intros = $intros1 + $intros2; - $myurl = DI::baseUrl() . '/profile/' . $a->getUserNickname(); + $myurl = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname(); $mails = q( "SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", diff --git a/mod/settings.php b/mod/settings.php index 5ad884e883..378e25ed9f 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -594,7 +594,7 @@ function settings_content(App $a) $username = $user['username']; $email = $user['email']; - $nickname = $a->getUserNickname(); + $nickname = $a->getLoggedInUserNickname(); $timezone = $user['timezone']; $language = $user['language']; $notify = $user['notify-flags']; diff --git a/src/App.php b/src/App.php index ff8c059dec..3a952c7a33 100644 --- a/src/App.php +++ b/src/App.php @@ -166,7 +166,7 @@ class App * Fetch the user nick name * @return string */ - public function getUserNickname() + public function getLoggedInUserNickname() { return $this->nickname; } diff --git a/src/App/Page.php b/src/App/Page.php index 75107df6da..766dd4ebef 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -277,8 +277,8 @@ class Page implements ArrayAccess // If you're just visiting, let javascript take you home if (!empty($_SESSION['visitor_home'])) { $homebase = $_SESSION['visitor_home']; - } elseif (!empty($app->getUserNickname())) { - $homebase = 'profile/' . $app->getUserNickname(); + } elseif (!empty($app->getLoggedInUserNickname())) { + $homebase = 'profile/' . $app->getLoggedInUserNickname(); } if (isset($homebase)) { diff --git a/src/BaseModule.php b/src/BaseModule.php index 28cce09e07..b812370fdf 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -183,7 +183,7 @@ abstract class BaseModule public static function checkFormSecurityTokenRedirectOnError($err_redirect, $typename = '', $formname = 'form_security_token') { if (!self::checkFormSecurityToken($typename, $formname)) { - Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getUserNickname() . ' - form element ' . $typename); + Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename); Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA); notice(self::getFormSecurityStandardErrorMessage()); DI::baseUrl()->redirect($err_redirect); @@ -193,7 +193,7 @@ abstract class BaseModule public static function checkFormSecurityTokenForbiddenOnError($typename = '', $formname = 'form_security_token') { if (!self::checkFormSecurityToken($typename, $formname)) { - Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getUserNickname() . ' - form element ' . $typename); + Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename); Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA); throw new \Friendica\Network\HTTPException\ForbiddenException(); diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 4ed25cdad5..56049fa16e 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -154,7 +154,7 @@ class Nav * Display the current site location as a navigation aid. */ - $myident = !empty($a->getUserNickname()) ? $a->getUserNickname() . '@' : ''; + $myident = !empty($a->getLoggedInUserNickname()) ? $a->getLoggedInUserNickname() . '@' : ''; $sitelocation = $myident . substr(DI::baseUrl()->get($ssl_state), strpos(DI::baseUrl()->get($ssl_state), '//') + 2); @@ -187,10 +187,10 @@ class Nav if ($a->isLoggedIn()) { // user menu - $nav['usermenu'][] = ['profile/' . $a->getUserNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')]; - $nav['usermenu'][] = ['profile/' . $a->getUserNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')]; - $nav['usermenu'][] = ['photos/' . $a->getUserNickname(), DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')]; - $nav['usermenu'][] = ['videos/' . $a->getUserNickname(), DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')]; + $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')]; + $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')]; + $nav['usermenu'][] = ['photos/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')]; + $nav['usermenu'][] = ['videos/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')]; $nav['usermenu'][] = ['events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')]; $nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')]; @@ -267,10 +267,10 @@ class Nav } // The following nav links are only show to logged in users - if (local_user() && !empty($a->getUserNickname())) { + if (local_user() && !empty($a->getLoggedInUserNickname())) { $nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')]; - $nav['home'] = ['profile/' . $a->getUserNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')]; + $nav['home'] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')]; // Don't show notifications for public communities if (Session::get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) { diff --git a/src/Factory/Notification/Introduction.php b/src/Factory/Notification/Introduction.php index a153e5a566..2b5aecdb00 100644 --- a/src/Factory/Notification/Introduction.php +++ b/src/Factory/Notification/Introduction.php @@ -68,7 +68,7 @@ class Introduction extends BaseFactory $this->l10n = $l10n; $this->pConfig = $pConfig; $this->session = $session; - $this->nick = $app->getUserNickname() ?? ''; + $this->nick = $app->getLoggedInUserNickname() ?? ''; } /** diff --git a/src/Model/Mail.php b/src/Model/Mail.php index 7b18ac3c31..7eaeb09b5e 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -173,7 +173,7 @@ class Mail $recip_host = substr($recip_host, 0, strpos($recip_host, '/')); $recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host); - $sender_handle = $a->getUserNickname() . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3); + $sender_handle = $a->getLoggedInUserNickname() . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3); $conv_guid = System::createUUID(); $convuri = $recip_handle . ':' . $conv_guid; diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index ac662ecbd0..cd3f50f59f 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -109,7 +109,7 @@ class Delegation extends BaseModule $ret = []; Hook::callAll('home_init', $ret); - DI::baseUrl()->redirect('profile/' . DI::app()->getUserNickname()); + DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname()); // NOTREACHED } @@ -130,7 +130,7 @@ class Delegation extends BaseModule $identities[$key]['thumb'] = Contact::getAvatarUrlForId($self['id'], Proxy::SIZE_THUMB, $self['updated']); - $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getUserNickname()); + $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getLoggedInUserNickname()); $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Notification\Type::INTRO, Notification\Type::MAIL]; $params = ['distinct' => true, 'expression' => 'parent']; diff --git a/src/Module/HCard.php b/src/Module/HCard.php index c43e3975c3..3310749bc3 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -40,7 +40,7 @@ class HCard extends BaseModule if ((local_user()) && ($parameters['action'] ?? '') === 'view') { // A logged in user views a profile of a user - $nickname = $a->getUserNickname(); + $nickname = $a->getLoggedInUserNickname(); } elseif (empty($parameters['action'])) { // Show the profile hCard $nickname = $parameters['profile']; diff --git a/src/Module/Home.php b/src/Module/Home.php index 76c4736cf1..9d16e11aa7 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -42,7 +42,7 @@ class Home extends BaseModule Hook::callAll('home_init', $ret); - if (local_user() && ($app->getUserNickname())) { + if (local_user() && ($app->getLoggedInUserNickname())) { DI::baseUrl()->redirect('network'); } diff --git a/src/Module/Invite.php b/src/Module/Invite.php index 48926a1fbf..82b8c604a9 100644 --- a/src/Module/Invite.php +++ b/src/Module/Invite.php @@ -171,7 +171,7 @@ class Invite extends BaseModule DI::l10n()->t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linkTxt . "\r\n" . "\r\n" . (($inviteOnly) ? DI::l10n()->t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . DI::l10n()->t('Once you have registered, please connect with me via my profile page at:') - . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getUserNickname() + . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getLoggedInUserNickname() . "\r\n" . "\r\n" . DI::l10n()->t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n", ], '$submit' => DI::l10n()->t('Submit') diff --git a/src/Module/NoScrape.php b/src/Module/NoScrape.php index f293e26b1e..f156efb44f 100644 --- a/src/Module/NoScrape.php +++ b/src/Module/NoScrape.php @@ -45,7 +45,7 @@ class NoScrape extends BaseModule $which = $parameters['nick']; } elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') { // view infos about a known profile (needs a login) - $which = $a->getUserNickname(); + $which = $a->getLoggedInUserNickname(); } else { System::jsonError(403, 'Authentication required'); } diff --git a/src/Module/Profile/Schedule.php b/src/Module/Profile/Schedule.php index ee468f8157..e72b1c7a65 100644 --- a/src/Module/Profile/Schedule.php +++ b/src/Module/Profile/Schedule.php @@ -58,7 +58,7 @@ class Schedule extends BaseProfile $a = DI::app(); - $o = self::getTabsHTML($a, 'schedule', true, $a->getUserNickname(), false); + $o = self::getTabsHTML($a, 'schedule', true, $a->getLoggedInUserNickname(), false); $schedule = []; $delayed = DBA::select('delayed-post', [], ['uid' => local_user()]); diff --git a/src/Module/Settings/Profile/Photo/Crop.php b/src/Module/Settings/Profile/Photo/Crop.php index d6c89e237b..83722c8661 100644 --- a/src/Module/Settings/Profile/Photo/Crop.php +++ b/src/Module/Settings/Profile/Photo/Crop.php @@ -56,7 +56,7 @@ class Crop extends BaseSettings $selectionW = intval($_POST['width'] ?? 0); $selectionH = intval($_POST['height'] ?? 0); - $path = 'profile/' . DI::app()->getUserNickname(); + $path = 'profile/' . DI::app()->getLoggedInUserNickname(); $base_image = Photo::selectFirst([], ['resource-id' => $resource_id, 'uid' => local_user(), 'scale' => $scale]); if (DBA::isResult($base_image)) { @@ -184,7 +184,7 @@ class Crop extends BaseSettings info(DI::l10n()->t('Profile picture successfully updated.')); - DI::baseUrl()->redirect('profile/' . DI::app()->getUserNickname()); + DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname()); } $Image = Photo::getImageForPhoto($photos[0]); diff --git a/src/Module/Settings/Profile/Photo/Index.php b/src/Module/Settings/Profile/Photo/Index.php index 3b4d33a01b..1584fe8f63 100644 --- a/src/Module/Settings/Profile/Photo/Index.php +++ b/src/Module/Settings/Profile/Photo/Index.php @@ -133,7 +133,7 @@ class Index extends BaseSettings DI::l10n()->t('or'), ($newuser) ? '' . DI::l10n()->t('skip this step') . '' - : '' + : '' . DI::l10n()->t('select a photo from your photo albums') . '' ), ]); diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index fe3dd26905..03519b1130 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -100,17 +100,17 @@ class UserExport extends BaseSettings switch ($action) { case "backup": header("Content-type: application/json"); - header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '.' . $action . '"'); + header('Content-Disposition: attachment; filename="' . DI::app()->getLoggedInUserNickname() . '.' . $action . '"'); self::exportAll(local_user()); break; case "account": header("Content-type: application/json"); - header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '.' . $action . '"'); + header('Content-Disposition: attachment; filename="' . DI::app()->getLoggedInUserNickname() . '.' . $action . '"'); self::exportAccount(local_user()); break; case "contact": header("Content-type: application/csv"); - header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '-contacts.csv' . '"'); + header('Content-Disposition: attachment; filename="' . DI::app()->getLoggedInUserNickname() . '-contacts.csv' . '"'); self::exportContactsAsCSV(local_user()); break; } diff --git a/src/Object/EMail/ItemCCEMail.php b/src/Object/EMail/ItemCCEMail.php index ddaf766080..1fa2e94d77 100644 --- a/src/Object/EMail/ItemCCEMail.php +++ b/src/Object/EMail/ItemCCEMail.php @@ -41,14 +41,14 @@ class ItemCCEMail extends Email $disclaimer = '
' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $user['username']) . '
'; - $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->getUserNickname()) . EOL; + $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->getLoggedInUserNickname()) . EOL; $disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; if (!$item['title'] == '') { $subject = EmailProtocol::encodeHeader($item['title'], 'UTF-8'); } else { $subject = EmailProtocol::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $user['username']), 'UTF-8'); } - $link = '' . $user['username'] . '

'; + $link = '' . $user['username'] . '

'; $html = Item::prepareBody($item); $message = '' . $link . $html . $disclaimer . '';; diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index c810aff1cb..e357f2c043 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -27,7 +27,7 @@ function vier_init(App $a) $args = DI::args(); - if ($args->get(0) === 'profile' && $args->get(1) === ($a->getUserNickname() ?? '') || $args->get(0) === 'network' && local_user() + if ($args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '') || $args->get(0) === 'network' && local_user() ) { vier_community_info();