Skip to content

Commit

Permalink
Article module: Improve bugfix from previous PR (#1113)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 authored Nov 17, 2024
1 parent 4faefe8 commit 2da7c3d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
17 changes: 15 additions & 2 deletions application/modules/article/controllers/admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,22 @@ public function treatAction()
->to($redirect);
}

if ($this->getRequest()->getParam('id') && is_numeric($this->getRequest()->getParam('id'))) {
if ($this->getRequest()->getParam('id')) {
if (!is_numeric($this->getRequest()->getParam('id'))) {
$this->redirect()
->withMessage('articleNotFound', 'danger')
->to(['action' => 'index']);
}

$article = $articleMapper->getArticleByIdLocale($this->getRequest()->getParam('id'));
$groups = explode(',', $article ? $article->getReadAccess() : [1,2,3]);

if (!$article) {
$this->redirect()
->withMessage('articleNotFound', 'danger')
->to(['action' => 'index']);
}

$groups = explode(',', $article->getReadAccess());
} else {
$groups = [1,2,3];
}
Expand Down
3 changes: 2 additions & 1 deletion application/modules/article/translations/de.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @copyright Ilch 2.0
* @copyright Ilch 2
* @package ilch
*/

Expand Down Expand Up @@ -62,4 +62,5 @@
'unknownKeyword' => 'Keyword nicht vorhanden',
'clock' => 'Uhr',
'rssDesc' => 'Alle Neuigkeiten von %s',
'articleNotFound' => 'Artikel nicht gefunden.',
];
3 changes: 2 additions & 1 deletion application/modules/article/translations/en.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @copyright Ilch 2.0
* @copyright Ilch 2
* @package ilch
*/

Expand Down Expand Up @@ -62,4 +62,5 @@
'unknownKeyword' => 'Keyword not existing',
'clock' => 'o\'clock',
'rssDesc' => 'All articles from %s',
'articleNotFound' => 'Article not found.',
];

0 comments on commit 2da7c3d

Please sign in to comment.