mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 16:34:33 +02:00
UserSession class [5] - Refactor src/Module/ files with DI
This commit is contained in:
parent
a729f3255d
commit
eecc456e0c
78 changed files with 455 additions and 530 deletions
|
@ -28,7 +28,6 @@ use Friendica\Content\Widget;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
|
@ -57,7 +56,7 @@ class Advanced extends BaseModule
|
|||
$this->dba = $dba;
|
||||
$this->page = $page;
|
||||
|
||||
if (!Session::isAuthenticated()) {
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
throw new ForbiddenException($this->t('Permission denied.'));
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ class Advanced extends BaseModule
|
|||
{
|
||||
$cid = $this->parameters['id'];
|
||||
|
||||
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => Session::getLocalUser()]);
|
||||
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
if (empty($contact)) {
|
||||
throw new BadRequestException($this->t('Contact not found.'));
|
||||
}
|
||||
|
@ -87,7 +86,7 @@ class Advanced extends BaseModule
|
|||
'nurl' => $nurl,
|
||||
'poll' => $poll,
|
||||
],
|
||||
['id' => $contact['id'], 'uid' => Session::getLocalUser()]
|
||||
['id' => $contact['id'], 'uid' => DI::userSession()->getLocalUserId()]
|
||||
);
|
||||
|
||||
if ($photo) {
|
||||
|
@ -105,7 +104,7 @@ class Advanced extends BaseModule
|
|||
{
|
||||
$cid = $this->parameters['id'];
|
||||
|
||||
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => Session::getLocalUser()]);
|
||||
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
if (empty($contact)) {
|
||||
throw new BadRequestException($this->t('Contact not found.'));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue