Dashboard: show as much drafts as configured.

The dashboard will show up to $dashboardLimit future
entries; if the number of future entries is still
less than $dashboardDraftLimit, it will add drafts
up to $dashboardDraftLimit.

If there are _no_ future entries, $entries is no
array, but has a value of "1"; count($entries)
will then be one, too, so one draft less will
be shown.

Closes #465.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2017-04-08 12:38:52 +02:00
parent 2bedc9243e
commit 0b85c80ac9

View File

@ -104,7 +104,10 @@ $entries = serendipity_fetchEntries(
'e.timestamp >= ' . serendipity_serverOffsetHour() . $efilter
);
$entriesAmount = count($entries);
$entriesAmount = 0;
if (is_array($entries)) {
$entriesAmount = count($entries);
};
if ($entriesAmount < (int)$serendipity['dashboardDraftLimit']) {
// there is still space for drafts
$drafts = serendipity_fetchEntries(