From 7e9a9b502b247475f448fd7a47674b16fb1b9775 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Tue, 20 Sep 2005 14:46:21 +0000 Subject: [PATCH] Fix to unset $serendipity['GET']['id'] if an URL is called of an entry that is unvisible. Plugins like "Entry's links" shall nto show up in that case. --- docs/NEWS | 4 ++++ include/genpage.inc.php | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/NEWS b/docs/NEWS index a0b84f6..1b494d3 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,10 @@ Version 0.9 () ------------------------------------------------------------------------ + * Fix showing any entry-id related sidebar plugins, when a selected + entry is not visible (permissions/drafts/...) by unsetting the + global $serendipity['GET']['id'] in that case. (garvinhicking) + * Spamblock plugin can now define required comment fields. Also fix parameter order in mt_rand() call, thanks to Jens Kubieziel (garvinhicking) diff --git a/include/genpage.inc.php b/include/genpage.inc.php index 09d6c52..ba50bd5 100644 --- a/include/genpage.inc.php +++ b/include/genpage.inc.php @@ -28,7 +28,13 @@ if ($serendipity['smarty_raw_mode']) { // User wants to read the diary case 'read': if (isset($serendipity['GET']['id'])) { - serendipity_printEntries(array(serendipity_fetchEntry('id', $serendipity['GET']['id'])), 1); + $entry = serendipity_fetchEntry('id', $serendipity['GET']['id']); + if (!is_array($entry) || count($entry) < 1) { + unset($serendipity['GET']['id']); + $entry = array(); + } + + serendipity_printEntries($entry, 1); } else { serendipity_printEntries(serendipity_fetchEntries($serendipity['range'], true, $serendipity['fetchLimit'])); } -- 2.39.5