mirror of
https://github.com/friendica/friendica
synced 2025-04-25 09:50:11 +00: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
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module\Item;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -38,7 +37,7 @@ class Pin extends BaseModule
|
|||
{
|
||||
$l10n = DI::l10n();
|
||||
|
||||
if (!Session::isAuthenticated()) {
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
|
||||
}
|
||||
|
||||
|
@ -53,16 +52,16 @@ class Pin extends BaseModule
|
|||
throw new HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
if (!in_array($item['uid'], [0, Session::getLocalUser()])) {
|
||||
if (!in_array($item['uid'], [0, DI::userSession()->getLocalUserId()])) {
|
||||
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
|
||||
}
|
||||
|
||||
$pinned = !$item['featured'];
|
||||
|
||||
if ($pinned) {
|
||||
Post\Collection::add($item['uri-id'], Post\Collection::FEATURED, $item['author-id'], Session::getLocalUser());
|
||||
Post\Collection::add($item['uri-id'], Post\Collection::FEATURED, $item['author-id'], DI::userSession()->getLocalUserId());
|
||||
} else {
|
||||
Post\Collection::remove($item['uri-id'], Post\Collection::FEATURED, Session::getLocalUser());
|
||||
Post\Collection::remove($item['uri-id'], Post\Collection::FEATURED, DI::userSession()->getLocalUserId());
|
||||
}
|
||||
|
||||
// See if we've been passed a return path to redirect to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue