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

@ -19,7 +19,6 @@
*
*/
use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
@ -34,7 +33,7 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
function message_init(App $a)
function message_init()
{
$tabs = '';
@ -61,7 +60,7 @@ function message_init(App $a)
]);
}
function message_post(App $a)
function message_post()
{
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
@ -104,7 +103,7 @@ function message_post(App $a)
}
}
function message_content(App $a)
function message_content()
{
$o = '';
Nav::setSelected('messages');
@ -114,7 +113,7 @@ function message_content(App $a)
return Login::form();
}
$myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname();
$myprofile = DI::baseUrl() . '/profile/' . DI::userSession()->getLocalUserNickname();
$tpl = Renderer::getMarkupTemplate('mail_head.tpl');
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') {
@ -177,7 +176,7 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$nickname' => $a->getLoggedInUserNickname(),
'$nickname' => DI::userSession()->getLocalUserNickname(),
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
]);
@ -282,7 +281,7 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$nickname' => $a->getLoggedInUserNickname(),
'$nickname' => DI::userSession()->getLocalUserNickname(),
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
]);
@ -415,12 +414,10 @@ function get_messages(int $uid, int $start, int $limit): array
function render_messages(array $msg, string $t): string
{
$a = DI::app();
$tpl = Renderer::getMarkupTemplate($t);
$rslt = '';
$myprofile = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname();
$myprofile = DI::baseUrl() . '/profile/' . DI::userSession()->getLocalUserNickname();
foreach ($msg as $rr) {
if ($rr['unknown']) {

View file

@ -46,7 +46,7 @@ function notes_content(App $a, bool $update = false)
return;
}
$o = BaseProfile::getTabsHTML('notes', true, $a->getLoggedInUserNickname(), false);
$o = BaseProfile::getTabsHTML('notes', true, DI::userSession()->getLocalUserNickname(), false);
if (!$update) {
$o .= '<h3>' . DI::l10n()->t('Personal Notes') . '</h3>';

View file

@ -19,11 +19,9 @@
*
*/
use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
@ -53,7 +51,7 @@ use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use Friendica\Util\XML;
function photos_init(App $a)
function photos_init()
{
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
return;
@ -67,8 +65,6 @@ function photos_init(App $a)
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$is_owner = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner['uid']));
$albums = Photo::getAlbums($owner['uid']);
$albums_visible = ((intval($owner['hidewall']) && !DI::userSession()->isAuthenticated()) ? false : true);
@ -125,7 +121,7 @@ function photos_init(App $a)
return;
}
function photos_post(App $a)
function photos_post()
{
$user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) {
@ -200,7 +196,7 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
DI::baseUrl()->redirect('photos/' . $a->getLoggedInUserNickname() . '/album/' . bin2hex($newalbum));
DI::baseUrl()->redirect('photos/' . DI::userSession()->getLocalUserNickname() . '/album/' . bin2hex($newalbum));
return; // NOTREACHED
}
@ -559,7 +555,7 @@ function photos_post(App $a)
}
}
function photos_content(App $a)
function photos_content()
{
// URLs:
// photos/name/upload
@ -714,7 +710,7 @@ function photos_content(App $a)
$tpl = Renderer::getMarkupTemplate('photos_upload.tpl');
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()));
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML(DI::page(), DI::userSession()->getLocalUserId()));
$o .= Renderer::replaceMacros($tpl, [
'$pagename' => DI::l10n()->t('Upload Photos'),
@ -728,7 +724,7 @@ function photos_content(App $a)
'$selname' => $selname,
'$permissions' => DI::l10n()->t('Permissions'),
'$aclselect' => $aclselect_e,
'$lockstate' => ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'$lockstate' => ACL::getLockstateForUserId(DI::userSession()->getLocalUserId()) ? '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 : ''),
@ -1074,7 +1070,7 @@ function photos_content(App $a)
$album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc'];
$aclselect_e = ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), false, ACL::getDefaultUserPermissions($ph[0]));
$aclselect_e = ACL::getFullSelectorHTML(DI::page(), DI::userSession()->getLocalUserId(), false, ACL::getDefaultUserPermissions($ph[0]));
$edit = Renderer::replaceMacros($edit_tpl, [
'$id' => $ph[0]['id'],