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

@ -24,6 +24,7 @@ namespace Friendica\Module\Filer;
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Post;
@ -55,7 +56,7 @@ class RemoveTag extends BaseModule
protected function content(array $request = []): string
{
if (!local_user()) {
if (!Session::getLocalUser()) {
throw new HTTPException\ForbiddenException();
}
@ -107,7 +108,7 @@ class RemoveTag extends BaseModule
return 404;
}
if (!Post\Category::deleteFileByURIId($item['uri-id'], local_user(), $type, $term)) {
if (!Post\Category::deleteFileByURIId($item['uri-id'], Session::getLocalUser(), $type, $term)) {
$this->systemMessages->addNotice($this->l10n->t('Item was not removed'));
return 500;
}

View file

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
@ -43,7 +44,7 @@ class SaveTag extends BaseModule
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
if (!local_user()) {
if (!Session::getLocalUser()) {
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
@ -62,11 +63,11 @@ class SaveTag extends BaseModule
if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException();
}
Model\Post\Category::storeFileByURIId($item['uri-id'], local_user(), Model\Post\Category::FILE, $term);
Model\Post\Category::storeFileByURIId($item['uri-id'], Session::getLocalUser(), Model\Post\Category::FILE, $term);
}
// return filer dialog
$filetags = Model\Post\Category::getArray(local_user(), Model\Post\Category::FILE);
$filetags = Model\Post\Category::getArray(Session::getLocalUser(), Model\Post\Category::FILE);
$tpl = Renderer::getMarkupTemplate("filer_dialog.tpl");
echo Renderer::replaceMacros($tpl, [