old boot.php functions replaced in src/module (3)

This commit is contained in:
Michael 2022-10-19 04:40:06 +00:00 committed by Hypolite Petovan
parent 83390d4b00
commit ae6d67ed1f
22 changed files with 158 additions and 147 deletions

View file

@ -66,7 +66,7 @@ class Advanced extends BaseModule
{
$cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => Session::getLocalUser()]);
if (empty($contact)) {
throw new BadRequestException($this->t('Contact not found.'));
}
@ -87,7 +87,7 @@ class Advanced extends BaseModule
'nurl' => $nurl,
'poll' => $poll,
],
['id' => $contact['id'], 'uid' => local_user()]
['id' => $contact['id'], 'uid' => Session::getLocalUser()]
);
if ($photo) {
@ -105,7 +105,7 @@ class Advanced extends BaseModule
{
$cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => Session::getLocalUser()]);
if (empty($contact)) {
throw new BadRequestException($this->t('Contact not found.'));
}

View file

@ -25,6 +25,7 @@ use Friendica\BaseModule;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Model;
use Friendica\Model\User;
@ -35,9 +36,7 @@ class Contacts extends BaseModule
{
protected function content(array $request = []): string
{
$app = DI::app();
if (!local_user()) {
if (!Session::getLocalUser()) {
throw new HTTPException\ForbiddenException();
}
@ -55,7 +54,7 @@ class Contacts extends BaseModule
throw new HTTPException\NotFoundException(DI::l10n()->t('Contact not found.'));
}
$localContactId = Model\Contact::getPublicIdByUserId(local_user());
$localContactId = Model\Contact::getPublicIdByUserId(Session::getLocalUser());
DI::page()['aside'] = Widget\VCard::getHTML($contact);

View file

@ -29,6 +29,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Session;
use Friendica\Core\Theme;
use Friendica\Model;
use Friendica\Module\Contact;
@ -67,13 +68,13 @@ class Conversations extends BaseModule
protected function content(array $request = []): string
{
if (!local_user()) {
if (!Session::getLocalUser()) {
return Login::form($_SERVER['REQUEST_URI']);
}
// Backward compatibility: Ensure to use the public contact when the user contact is provided
// Remove by version 2022.03
$data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), local_user());
$data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), Session::getLocalUser());
if (empty($data)) {
throw new NotFoundException($this->t('Contact not found.'));
}
@ -88,7 +89,7 @@ class Conversations extends BaseModule
throw new NotFoundException($this->t('Contact not found.'));
}
$localRelationship = $this->localRelationship->getForUserContact(local_user(), $contact['id']);
$localRelationship = $this->localRelationship->getForUserContact(Session::getLocalUser(), $contact['id']);
if ($localRelationship->rel === Model\Contact::SELF) {
$this->baseUrl->redirect('profile/' . $contact['nick']);
}

View file

@ -71,7 +71,7 @@ class Hovercard extends BaseModule
// Search for contact data
// Look if the local user has got the contact
if (Session::isAuthenticated()) {
$contact = Contact::getByURLForUser($contact_url, local_user());
$contact = Contact::getByURLForUser($contact_url, Session::getLocalUser());
} else {
$contact = Contact::getByURL($contact_url, false);
}