Skip to content

Commit

Permalink
Fix SQL error in plugin_history.
Browse files Browse the repository at this point in the history
Since merging s9y#665 `serendipity_plugin_history`
breaks with a SQL error message on every archive
page but the first one; see s9y#693 for reason
and context.

Unset `$serendipity['GET']['page']` before
calling `serendipity_fetchEntries(`)` (and
reset afterwards) to fix that. That's the
correct way, I think, as
`serendipity_fetchEntries()` is not called
in page context here.

Signed-off-by: Thomas Hochstein <thh@inter.net>
  • Loading branch information
th-h committed Apr 11, 2020
1 parent aff7f2e commit 4010d57
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,19 @@ function generate_content(&$title)
}

$oldLim = $serendipity['fetchLimit'];
if (isset($serendipity['GET']['page'])) {
$oldPage = $serendipity['GET']['page'];
unset($serendipity['GET']['page']);
}
$nowts = serendipity_serverOffsetHour();
$maxts = mktime(23, 59, 59, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
$mints = mktime(0, 0, 0, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
$e = serendipity_fetchEntries(array(($mints-$max_age*86400),
($maxts-$min_age*86400)), $full, $max_entries);
$serendipity['fetchLimit'] = $oldLim;
if (isset($oldPage)) {
$serendipity['GET']['page'] = $oldPage;
}
echo (empty($intro)) ? '' : '<div class="serendipity_history_intro">' . $intro . '</div>' . "\n";

if (!is_array($e)) {
Expand Down

0 comments on commit 4010d57

Please sign in to comment.