Many deprecated function calls are replaced

This commit is contained in:
Michael 2024-05-13 16:19:19 +00:00
parent cfad5809ff
commit 60f5fd8188
28 changed files with 61 additions and 71 deletions

View file

@ -55,7 +55,7 @@ class Show extends BaseModule
protected function rawContent(array $request = [])
{
$nickname = $this->parameters['nickname'] ?? $this->app->getLoggedInUserNickname();
$nickname = $this->parameters['nickname'] ?? $this->session->getLocalUserNickname();
if (!$nickname) {
throw new HTTPException\UnauthorizedException();
}

View file

@ -91,7 +91,7 @@ class Show extends BaseModule
$this->page->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
$this->page->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
$is_owner = $nickname == $this->app->getLoggedInUserNickname();
$is_owner = $nickname == $this->session->getLocalUserNickname();
$htpl = Renderer::getMarkupTemplate('calendar/calendar_head.tpl');
$this->page['htmlhead'] .= Renderer::replaceMacros($htpl, [

View file

@ -37,7 +37,7 @@ class HCard extends BaseModule
{
if (DI::userSession()->getLocalUserId() && ($this->parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user
$nickname = DI::app()->getLoggedInUserNickname();
$nickname = DI::userSession()->getLocalUserNickname();
} elseif (empty($this->parameters['action'])) {
// Show the profile hCard
$nickname = $this->parameters['profile'];

View file

@ -51,7 +51,7 @@ class Home extends BaseModule
Hook::callAll('home_init', $ret);
if (DI::userSession()->getLocalUserId() && ($app->getLoggedInUserNickname())) {
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserNickname())) {
DI::baseUrl()->redirect('network');
}

View file

@ -75,7 +75,7 @@ class Browser extends BaseModule
'$folders' => false,
'$files' => $fileArray,
'$cancel' => $this->t('Cancel'),
'$nickname' => $this->app->getLoggedInUserNickname(),
'$nickname' => $this->session->getLocalUserNickname(),
'$upload' => $this->t('Upload'),
]);

View file

@ -86,7 +86,7 @@ class Browser extends BaseModule
'$folders' => $albums,
'$files' => $photosArray,
'$cancel' => $this->t('Cancel'),
'$nickname' => $this->app->getLoggedInUserNickname(),
'$nickname' => $this->session->getLocalUserNickname(),
'$upload' => $this->t('Upload'),
]);
@ -115,7 +115,7 @@ class Browser extends BaseModule
$scale = $photo['scale'] ?? $record['loq'];
return [
sprintf('%s/photos/%s/image/%s', $this->baseUrl, $this->app->getLoggedInUserNickname(), $record['resource-id']),
sprintf('%s/photos/%s/image/%s', $this->baseUrl, $this->session->getLocalUserNickname(), $record['resource-id']),
$filename_e,
sprintf('%s/photo/%s-%s%s', $this->baseUrl, $record['resource-id'], $scale, $ext),
$record['desc'],

View file

@ -43,7 +43,7 @@ class NoScrape extends BaseModule
$which = $this->parameters['nick'];
} elseif (DI::userSession()->getLocalUserId() && isset($this->parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login)
$which = $a->getLoggedInUserNickname();
$which = DI::userSession()->getLocalUserNickname();
} else {
$this->jsonError(403, 'Authentication required');
}

View file

@ -285,7 +285,7 @@ class Photo extends BaseApi
return false;
}
if (Network::isLocalLink($url) && preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $url, $matches)) {
if (DI::baseUrl()->isLocalUrl($url) && preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $url, $matches)) {
return MPhoto::getPhoto($matches[1], $matches[2], self::getCurrentUserID());
}
@ -296,7 +296,7 @@ class Photo extends BaseApi
return false;
}
if (Network::isLocalLink($media['url']) && preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['url'], $matches)) {
if (DI::baseUrl()->isLocalUrl($media['url']) && preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['url'], $matches)) {
return MPhoto::getPhoto($matches[1], $matches[2], self::getCurrentUserID());
}
@ -316,7 +316,7 @@ class Photo extends BaseApi
}
// For local users directly use the photo record that is marked as the profile
if (Network::isLocalLink($contact['url'])) {
if (DI::baseUrl()->isLocalUrl($contact['url'])) {
$contact = Contact::selectFirst($fields, ['nurl' => $contact['nurl'], 'self' => true]);
if (!empty($contact)) {
if ($customsize <= Proxy::PIXEL_MICRO) {
@ -355,7 +355,7 @@ class Photo extends BaseApi
}
// If it is a local link, we save resources by just redirecting to it.
if (!empty($url) && Network::isLocalLink($url)) {
if (!empty($url) && DI::baseUrl()->isLocalUrl($url)) {
System::externalRedirect($url);
}
@ -404,7 +404,7 @@ class Photo extends BaseApi
} else {
$url = Contact::getDefaultAvatar($contact ?: [], Proxy::SIZE_SMALL);
}
if (Network::isLocalLink($url)) {
if (DI::baseUrl()->isLocalUrl($url)) {
System::externalRedirect($url);
}
}
@ -416,7 +416,7 @@ class Photo extends BaseApi
return false;
}
if (Network::isLocalLink($contact['url'])) {
if (DI::baseUrl()->isLocalUrl($contact['url'])) {
$header_uid = User::getIdForURL($contact['url']);
if (empty($header_uid)) {
throw new HTTPException\NotFoundException();
@ -431,7 +431,7 @@ class Photo extends BaseApi
$url = $contact['header'];
} else {
$url = Contact::getDefaultHeader($contact);
if (Network::isLocalLink($url)) {
if (DI::baseUrl()->isLocalUrl($url)) {
System::externalRedirect($url);
}
}
@ -467,7 +467,7 @@ class Photo extends BaseApi
$default = Contact::getDefaultAvatar($contact, Proxy::SIZE_THUMB);
}
if (Network::isLocalLink($default)) {
if (DI::baseUrl()->isLocalUrl($default)) {
System::externalRedirect($default);
}

View file

@ -105,7 +105,7 @@ class Edit extends BaseModule
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot-header.tpl'), [
'$ispublic' => '&nbsp;',
'$geotag' => '',
'$nickname' => $this->app->getLoggedInUserNickname(),
'$nickname' => $this->session->getLocalUserNickname(),
'$is_mobile' => $this->mode->isMobile(),
]);

View file

@ -58,7 +58,7 @@ class Schedule extends BaseProfile
$a = DI::app();
$o = self::getTabsHTML('schedule', true, $a->getLoggedInUserNickname(), false);
$o = self::getTabsHTML('schedule', true, DI::userSession()->getLocalUserNickname(), false);
$schedule = [];
$delayed = DBA::select('delayed-post', [], ['uid' => DI::userSession()->getLocalUserId()]);

View file

@ -398,7 +398,7 @@ class Account extends BaseSettings
$username = $user['username'];
$email = $user['email'];
$nickname = $a->getLoggedInUserNickname();
$nickname = DI::userSession()->getLocalUserNickname();
$timezone = $user['timezone'];
$language = $user['language'];
$notify = $user['notify-flags'];

View file

@ -55,7 +55,7 @@ class Crop extends BaseSettings
$selectionW = intval($_POST['width'] ?? 0);
$selectionH = intval($_POST['height'] ?? 0);
$path = 'profile/' . DI::app()->getLoggedInUserNickname();
$path = 'profile/' . DI::userSession()->getLocalUserNickname();
$base_image = Photo::selectFirst([], ['resource-id' => $resource_id, 'uid' => DI::userSession()->getLocalUserId(), 'scale' => $scale]);
if (DBA::isResult($base_image)) {
@ -195,7 +195,7 @@ class Crop extends BaseSettings
DI::sysmsg()->addInfo(DI::l10n()->t('Profile picture successfully updated.'));
DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname());
DI::baseUrl()->redirect('profile/' . DI::userSession()->getLocalUserNickname());
}
$Image = Photo::getImageForPhoto($photos[0]);

View file

@ -131,7 +131,7 @@ class Index extends BaseSettings
DI::l10n()->t('or'),
($newuser) ?
'<a href="' . DI::baseUrl() . '">' . DI::l10n()->t('skip this step') . '</a>'
: '<a href="' . DI::baseUrl() . '/profile/' . DI::app()->getLoggedInUserNickname() . '/photos">'
: '<a href="' . DI::baseUrl() . '/profile/' . DI::userSession()->getLocalUserNickname() . '/photos">'
. DI::l10n()->t('select a photo from your photo albums') . '</a>'
),
]);