mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
Merge pull request #14155 from annando/deprecated
Many deprecated function calls are replaced
This commit is contained in:
commit
bd6616e84f
28 changed files with 61 additions and 71 deletions
|
@ -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']) {
|
||||
|
|
|
@ -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>';
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -410,7 +410,7 @@ abstract class BaseModule implements ICanHandleRequests
|
|||
public static function checkFormSecurityTokenRedirectOnError(string $err_redirect, string $typename = '', string $formname = 'form_security_token')
|
||||
{
|
||||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
|
||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::userSession()->getLocalUserNickname() . ' - form element ' . $typename);
|
||||
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
|
||||
DI::sysmsg()->addNotice(self::getFormSecurityStandardErrorMessage());
|
||||
DI::baseUrl()->redirect($err_redirect);
|
||||
|
@ -420,7 +420,7 @@ abstract class BaseModule implements ICanHandleRequests
|
|||
public static function checkFormSecurityTokenForbiddenOnError(string $typename = '', string $formname = 'form_security_token')
|
||||
{
|
||||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
|
||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::userSession()->getLocalUserNickname() . ' - form element ' . $typename);
|
||||
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
|
||||
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
|
|
|
@ -57,7 +57,7 @@ class Avatar
|
|||
return $fields;
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($avatar) || empty($avatar)) {
|
||||
if (DI::baseUrl()->isLocalUrl($avatar) || empty($avatar)) {
|
||||
self::deleteCache($contact);
|
||||
return $fields;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class Avatar
|
|||
return $fields;
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($contact['avatar']) || empty($contact['avatar'])) {
|
||||
if (DI::baseUrl()->isLocalUrl($contact['avatar']) || empty($contact['avatar'])) {
|
||||
self::deleteCache($contact);
|
||||
return $fields;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ class APContact
|
|||
DI::cache()->set($cachekey, System::callstack(20), Duration::FIVE_MINUTES);
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($url) && ($local_uid = User::getIdForURL($url))) {
|
||||
if (DI::baseUrl()->isLocalUrl($url) && ($local_uid = User::getIdForURL($url))) {
|
||||
try {
|
||||
$data = Transmitter::getProfile($local_uid);
|
||||
$local_owner = User::getOwnerDataById($local_uid);
|
||||
|
|
|
@ -335,7 +335,7 @@ class Attach
|
|||
{
|
||||
preg_match_all("/\[attachment\](.*?)\[\/attachment\]/ism", $post['body'], $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $attachment) {
|
||||
if (Network::isLocalLink($attachment[1]) && preg_match('|.*?/attach/(\d+)|', $attachment[1], $match)) {
|
||||
if (DI::baseUrl()->isLocalUrl($attachment[1]) && preg_match('|.*?/attach/(\d+)|', $attachment[1], $match)) {
|
||||
$fields = [
|
||||
'allow_cid' => $post['allow_cid'], 'allow_gid' => $post['allow_gid'],
|
||||
'deny_cid' => $post['deny_cid'], 'deny_gid' => $post['deny_gid']
|
||||
|
@ -349,7 +349,7 @@ class Attach
|
|||
{
|
||||
preg_match_all("/\[attachment\](.*?)\[\/attachment\]/ism", $body, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $attachment) {
|
||||
if (Network::isLocalLink($attachment[1]) && preg_match('|.*?/attach/(\d+)|', $attachment[1], $match)) {
|
||||
if (DI::baseUrl()->isLocalUrl($attachment[1]) && preg_match('|.*?/attach/(\d+)|', $attachment[1], $match)) {
|
||||
$attach = self::getById($match[1], $uid);
|
||||
if (empty($attach)) {
|
||||
return $body;
|
||||
|
|
|
@ -1793,7 +1793,7 @@ class Contact
|
|||
return;
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($contact['url'])) {
|
||||
if (DI::baseUrl()->isLocalUrl($contact['url'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1910,7 +1910,7 @@ class Contact
|
|||
return $contact;
|
||||
}
|
||||
|
||||
$local = !empty($contact['url']) && Network::isLocalLink($contact['url']);
|
||||
$local = !empty($contact['url']) && DI::baseUrl()->isLocalUrl($contact['url']);
|
||||
|
||||
if (!$local && !empty($contact['id']) && !empty($contact['avatar'])) {
|
||||
self::updateAvatar($contact['id'], $contact['avatar'], true);
|
||||
|
@ -2300,7 +2300,7 @@ class Contact
|
|||
if (($uid == 0) && !$force && empty($contact['thumb']) && empty($contact['micro']) && !$create_cache) {
|
||||
if (($contact['avatar'] != $avatar) || empty($contact['blurhash'])) {
|
||||
$update_fields = ['avatar' => $avatar];
|
||||
if (!Network::isLocalLink($avatar)) {
|
||||
if (!DI::baseUrl()->isLocalUrl($avatar)) {
|
||||
try {
|
||||
$fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
|
||||
|
||||
|
@ -2348,7 +2348,7 @@ class Contact
|
|||
$cache_avatar = DI::config()->get('system', 'cache_contact_avatar');
|
||||
|
||||
// Local contact avatars don't need to be cached
|
||||
if ($cache_avatar && Network::isLocalLink($contact['url'])) {
|
||||
if ($cache_avatar && DI::baseUrl()->isLocalUrl($contact['url'])) {
|
||||
$cache_avatar = !DBA::exists('contact', ['nurl' => $contact['nurl'], 'self' => true]);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ class Item
|
|||
'owner-id', 'owner-link', 'owner-alias', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated', 'owner-gsid',
|
||||
'causer-id', 'causer-link', 'causer-alias', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network', 'causer-gsid',
|
||||
'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar',
|
||||
'writable', 'restrictions', 'self', 'cid', 'alias',
|
||||
'writable', 'restrictions', 'self', 'cid', 'alias', 'post-reason',
|
||||
'event-created', 'event-edited', 'event-start', 'event-finish',
|
||||
'event-summary', 'event-desc', 'event-location', 'event-type',
|
||||
'event-nofinish', 'event-ignore', 'event-id',
|
||||
|
@ -3988,7 +3988,7 @@ class Item
|
|||
{
|
||||
if (!empty($item['plink']) && Network::isValidHttpUrl($item['plink'])) {
|
||||
$plink = $item['plink'];
|
||||
} elseif (!empty($item['uri']) && Network::isValidHttpUrl($item['uri']) && !Network::isLocalLink($item['uri'])) {
|
||||
} elseif (!empty($item['uri']) && Network::isValidHttpUrl($item['uri']) && !DI::baseUrl()->isLocalUrl($item['uri'])) {
|
||||
$plink = $item['uri'];
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class Media
|
|||
*/
|
||||
public static function fetchAdditionalData(array $media): array
|
||||
{
|
||||
if (Network::isLocalLink($media['url'])) {
|
||||
if (DI::baseUrl()->isLocalUrl($media['url'])) {
|
||||
$media = self::fetchLocalData($media);
|
||||
if (preg_match('|.*?/search\?(.+)|', $media['url'], $matches)) {
|
||||
return $media;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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, [
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -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'),
|
||||
]);
|
||||
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class Edit extends BaseModule
|
|||
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot-header.tpl'), [
|
||||
'$ispublic' => ' ',
|
||||
'$geotag' => '',
|
||||
'$nickname' => $this->app->getLoggedInUserNickname(),
|
||||
'$nickname' => $this->session->getLocalUserNickname(),
|
||||
'$is_mobile' => $this->mode->isMobile(),
|
||||
]);
|
||||
|
||||
|
|
|
@ -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()]);
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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>'
|
||||
),
|
||||
]);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Navigation\Notifications\Factory;
|
||||
|
||||
use Exception;
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\BaseFactory;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
|
@ -58,7 +57,7 @@ class Introduction extends BaseFactory
|
|||
/** @var string */
|
||||
private $nick;
|
||||
|
||||
public function __construct(LoggerInterface $logger, Database $dba, BaseURL $baseUrl, L10n $l10n, App $app, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session)
|
||||
public function __construct(LoggerInterface $logger, Database $dba, BaseURL $baseUrl, L10n $l10n, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session)
|
||||
{
|
||||
parent::__construct($logger);
|
||||
|
||||
|
@ -67,7 +66,7 @@ class Introduction extends BaseFactory
|
|||
$this->l10n = $l10n;
|
||||
$this->pConfig = $pConfig;
|
||||
$this->session = $session;
|
||||
$this->nick = $app->getLoggedInUserNickname() ?? '';
|
||||
$this->nick = $session->getLocalUserNickname() ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -347,7 +347,7 @@ class Images
|
|||
return $data;
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($url) && ($data = Photo::getResourceData($url))) {
|
||||
if (DI::baseUrl()->isLocalUrl($url) && ($data = Photo::getResourceData($url))) {
|
||||
$photo = Photo::selectFirst([], ['resource-id' => $data['guid'], 'scale' => $data['scale']]);
|
||||
if (!empty($photo)) {
|
||||
$img_str = Photo::getImageDataForPhoto($photo);
|
||||
|
|
|
@ -101,7 +101,7 @@ class Proxy
|
|||
return true;
|
||||
}
|
||||
|
||||
return Network::isLocalLink($url);
|
||||
return DI::baseUrl()->isLocalUrl($url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -856,7 +856,7 @@ class Notifier
|
|||
foreach ($inboxes as $inbox => $receivers) {
|
||||
$contacts = array_merge($contacts, $receivers);
|
||||
|
||||
if ((count($receivers) == 1) && Network::isLocalLink($inbox)) {
|
||||
if ((count($receivers) == 1) && DI::baseUrl()->isLocalUrl($inbox)) {
|
||||
$contact = Contact::getById($receivers[0], ['url']);
|
||||
if (!in_array($cmd, [Delivery::RELOCATION, Delivery::SUGGESTION, Delivery::MAIL]) && ($target_uid = User::getIdForURL($contact['url']))) {
|
||||
if ($cmd == Delivery::DELETION) {
|
||||
|
@ -876,7 +876,7 @@ class Notifier
|
|||
}
|
||||
continue;
|
||||
}
|
||||
} elseif ((count($receivers) >= 1) && Network::isLocalLink($inbox)) {
|
||||
} elseif ((count($receivers) >= 1) && DI::baseUrl()->isLocalUrl($inbox)) {
|
||||
Logger::info('Is this a thing?', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ use Friendica\Util\Strings;
|
|||
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||
*/
|
||||
|
||||
function vier_init(App $a)
|
||||
function vier_init()
|
||||
{
|
||||
Renderer::setActiveTemplateEngine('smarty3');
|
||||
|
||||
|
@ -49,7 +49,7 @@ function vier_init(App $a)
|
|||
if (
|
||||
DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
|
||||
&& (
|
||||
$args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
|
||||
$args->get(0) === 'profile' && $args->get(1) === (DI::userSession()->getLocalUserNickname() ?? '')
|
||||
|| $args->get(0) === 'network' && DI::userSession()->getLocalUserId()
|
||||
)
|
||||
) {
|
||||
|
@ -337,23 +337,21 @@ function vier_community_info()
|
|||
}
|
||||
|
||||
/**
|
||||
* @param int|null $uid
|
||||
* @return null
|
||||
* @see \Friendica\Core\Theme::getBackgroundColor()
|
||||
* @TODO Implement this function
|
||||
*/
|
||||
function vier_get_background_color(int $uid = null)
|
||||
function vier_get_background_color()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $uid
|
||||
* @return null
|
||||
* @see \Friendica\Core\Theme::getThemeColor()
|
||||
* @TODO Implement this function
|
||||
*/
|
||||
function vier_get_theme_color(int $uid = null)
|
||||
function vier_get_theme_color()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue