crash backup
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled

This commit is contained in:
Dennis Eichhorn 2025-03-21 02:48:19 +00:00
parent ca4e7e16c2
commit 077fee5032
4 changed files with 12 additions and 12 deletions

View File

@ -127,7 +127,7 @@ final class ApiController extends Controller
public function apiNewsUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
/** @var \Modules\News\Models\NewsArticle $old */
$old = NewsArticleMapper::get()->where('id', (int) $request->getData('id'))->execute();
$old = NewsArticleMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute();
$new = $this->updateNewsFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, NewsArticleMapper::class, 'news', $request->getOrigin());
@ -310,7 +310,7 @@ final class ApiController extends Controller
*/
public function apiNewsGet(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
$news = NewsArticleMapper::get()->where('id', (int) $request->getData('id'))->execute();
$news = NewsArticleMapper::get()->where('id', $request->getDataInt('id') ?? 0)->execute();
$this->createStandardReturnResponse($request, $response, $news);
}
@ -329,7 +329,7 @@ final class ApiController extends Controller
*/
public function apiNewsDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
$news = NewsArticleMapper::get()->with('files')->with('tags')->where('id', (int) $request->getData('id'))->execute();
$news = NewsArticleMapper::get()->with('files')->with('tags')->where('id', $request->getDataInt('id') ?? 0)->execute();
$this->deleteModel($request->header->account, $news, NewsArticleMapper::class, 'news', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $news);
}

View File

@ -157,7 +157,7 @@ final class BackendController extends Controller implements DashboardElementInte
->where('status', NewsStatus::VISIBLE)
->where('publish', new \DateTime('now'), '<=')
->where('tags/title/language', $response->header->l11n->language)
->where('id', (int) $request->getData('id'))
->where('id', $request->getDataInt('id') ?? 0)
->execute();
$accountId = $request->header->account;
@ -181,14 +181,14 @@ final class BackendController extends Controller implements DashboardElementInte
/** @var \Modules\News\Models\NewsSeen $seen */
$seen = NewsSeenMapper::get()
->where('news', (int) $request->getData('id'))
->where('news', $request->getDataInt('id') ?? 0)
->where('seenBy', $request->header->account)
->execute();
if ($seen->id === 0) {
$seen = new NewsSeen();
$seen->seenBy = (int) $request->header->account;
$seen->news = (int) $request->getData('id');
$seen->news = $request->getDataInt('id') ?? 0;
$seen->seenAt = new \DateTime('now');
NewsSeenMapper::create()->execute($seen);

View File

@ -19,7 +19,7 @@ use Modules\News\Models\NullNewsArticle;
use phpOMS\Uri\UriFactory;
/** @var \Modules\News\Models\NewsArticle $news */
$news = $this->getData('news') ?? new NullNewsArticle();
$news = $this->data['news'] ?? new NullNewsArticle();
$isNewArticle = $news->id === 0;
$languages = \phpOMS\Localization\ISO639Enum::getConstants();
@ -43,7 +43,7 @@ echo $this->data['nav']->render(); ?>
<section class="portlet">
<div class="portlet-body">
<?= $this->data['editor']->getData('text')->render('iNews', 'plain', 'docForm', $news->plain, $news->content); ?>
<?= $this->data['editor']->data['text']->render('iNews', 'plain', 'docForm', $news->plain, $news->content); ?>
</div>
</section>
</div>
@ -129,7 +129,7 @@ echo $this->data['nav']->render(); ?>
@todo Implement Tags for news
<div class="form-group">
<?= $this->getHtml('Tags', 'Tag'); ?>
<?= $this->getData('tagSelector')->render('iTag', 'tag', 'fEditor', false); ?>
<?= $this->data['tagSelector']->render('iTag', 'tag', 'fEditor', false); ?>
</div>
-->
</div>
@ -143,7 +143,7 @@ echo $this->data['nav']->render(); ?>
@todo add form this belongs to
@todo make auto save on change for already created news article
@todo add default values (some can be removed/overwritten and some not?)
<?= ''; //$this->getData('accGrpSelector')->render('iReceiver', 'receiver', false); ?>
<?= ''; //$this->data['accGrpSelector']->render('iReceiver', 'receiver', false); ?>
</div>
</div>
</section>

View File

@ -68,11 +68,11 @@ echo $this->data['nav']->render(); ?>
<?php
$commentList = $news->comments;
if ($this->data['commentPermissions']['write'] && $commentList?->status === CommentListStatus::ACTIVE) :
echo $this->getData('commentCreate')->render(1);
echo $this->data['commentCreate']->render(1);
endif;
if ($this->data['commentPermissions']['list_modify']
|| ($this->data['commentPermissions']['list_read'] && $commentList->status !== CommentListStatus::INACTIVE)
) :
echo $this->getData('commentList')->render($commentList);
echo $this->data['commentList']->render($commentList);
endif;