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

This commit is contained in:
Michael 2022-10-19 04:35:37 +00:00 committed by Hypolite Petovan
parent b36d4eb0dd
commit c9f17e1ef5
21 changed files with 102 additions and 88 deletions

View file

@ -28,6 +28,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
@ -61,13 +62,13 @@ class Posts 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.'));
}
@ -82,7 +83,7 @@ class Posts 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']);
}