Force positive values for fetchLimits.

The number of entries shown on the title
page and in the feed has to be at least "1",
as s9y can't cope with "0" or negative
values (and it shouldn't).

May be related to #636.

Backported from master.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2019-10-13 17:22:59 +02:00
parent cad25673cf
commit 66494fdbe3
2 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,11 @@ Version 2.3.3-beta1 ()
published blog entries and ability to prepend a mail body. published blog entries and ability to prepend a mail body.
Also fixes missing "keep strip tags" configuration option Also fixes missing "keep strip tags" configuration option
* Fix: Force positive limits for number of entries shown on
title page and in RSS feed. s9y doesn't work with 0 or
negative numbers, so force our default (15) in this case,
(#646)
Version 2.3.2 (October 16th, 2019) Version 2.3.2 (October 16th, 2019)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -376,9 +376,11 @@ if (isset($_SESSION['serendipityAuthorid'])) {
$serendipity['lang'] = serendipity_getPostAuthSessionLanguage(); $serendipity['lang'] = serendipity_getPostAuthSessionLanguage();
} }
// Ensure that these limits do not contain strings // Ensure that these limits do not contain strings and have positive values
$serendipity['fetchLimit'] = (int)$serendipity['fetchLimit']; $serendipity['fetchLimit'] = (int)$serendipity['fetchLimit'];
if ($serendipity['fetchLimit'] < 1) $serendipity['fetchLimit'] = 1;
$serendipity['RSSfetchLimit'] = (int)$serendipity['RSSfetchLimit']; $serendipity['RSSfetchLimit'] = (int)$serendipity['RSSfetchLimit'];
if ($serendipity['RSSfetchLimit'] < 1) $serendipity['RSSfetchLimit'] = 1;
// Try to fix some path settings. It seems common users have this setting wrong // Try to fix some path settings. It seems common users have this setting wrong
// when s9y is installed into the root directory, especially 0.7.1 upgrade users. // when s9y is installed into the root directory, especially 0.7.1 upgrade users.