Skip to content

Commit 5d9bb5a

Browse files
authored
Merge pull request #151 from FriendsOfREDAXO/copilot/fix-145
Fix InvalidArgumentException when Entry has no author (author_id = 0)
2 parents 822cd05 + 234433d commit 5d9bb5a

File tree

7 files changed

+6
-9
lines changed

7 files changed

+6
-9
lines changed

fragments/neues/entry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<?php if (null !== $post->getAuthor()) : ?>
2828
<?php if ('' !== $post->getAuthor()->getName()) : ?>
2929
von <span><?= htmlspecialchars($post->getAuthor()->getName()) ?></span>
30-
<?php elseif(null !== $post->getAuthor()->getNickname()): ?>
30+
<?php elseif (null !== $post->getAuthor()->getNickname()): ?>
3131
von <span><?= htmlspecialchars($post->getAuthor()->getNickname()) ?></span>
3232
<?php endif ?>
3333
<?php endif ?>

fragments/neues/list.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<!-- Entry list -->
1515
<div class="container">
1616
<div class="row row-cols-1 row-cols-md-2 g-3">
17-
<?php if(0 < count($posts)) { ?>
17+
<?php if (0 < count($posts)) { ?>
1818
<?php foreach ($posts as $post) : ?>
1919
<div class="col">
2020
<?php
@@ -26,7 +26,7 @@
2626
<?php endforeach ?>
2727
<?php } else { ?>
2828
<div class="placeholder">
29-
<?php if(null !== rex_config::get('neues', 'no_entries_placeholder')) { ?>
29+
<?php if (null !== rex_config::get('neues', 'no_entries_placeholder')) { ?>
3030
<p><?= rex_i18n::msg('no_entries_placeholder') ?></p>
3131
<?php } ?>
3232
</div>

fragments/neues/pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</li>
4343

4444
<!-- Pages -->
45-
<?php for($i = 0; $i < $pager->getPageCount(); ++$i): ?>
45+
<?php for ($i = 0; $i < $pager->getPageCount(); ++$i): ?>
4646
<li class="page-item">
4747
<?php if (0 === $page) : ?>
4848
<a class="page-link <?= $currentPage === $i ? 'active' : '' ?>"

install.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace FriendsOfRedaxo\Neues;
44

5-
use FriendsOfRedaxo\Neues\Cronjob\Publish;
65
use rex;
76
use rex_addon;
87
use rex_config;

lib/Entry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace FriendsOfRedaxo\Neues;
44

5+
use Alexplusde\ManagerResponsive\Media;
56
use IntlDateFormatter;
67
use rex_addon;
78
use rex_config;
@@ -11,7 +12,6 @@
1112
use rex_formatter;
1213
use rex_i18n;
1314
use rex_media;
14-
use Alexplusde\ManagerResponsive\Media;
1515
use rex_url;
1616
use rex_yform;
1717
use rex_yform_list;
@@ -177,7 +177,7 @@ static function ($a) {
177177
*/
178178
public function getAuthor(): ?Author
179179
{
180-
if ($this->hasValue('author_id')) {
180+
if ($this->hasValue('author_id') && $this->getValue('author_id') > 0) {
181181
return Author::get($this->getValue('author_id'));
182182
}
183183
return null;

lib/neues.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace FriendsOfRedaxo\Neues;
44

5-
use rex;
65
use rex_be_controller;
76
use rex_be_page;
87
use rex_csrf_token;

pages/yform.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static function (rex_extension_point $ep) {
7676
}
7777

7878
if (version_compare(rex_addon::get('yform')->getVersion(), '5.0.0', '<')) {
79-
8079
include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');
8180
} else {
8281
include rex_path::addon('yform', 'pages/manager.data_edit.php');

0 commit comments

Comments
 (0)