Fix to unset $serendipity['GET']['id'] if an URL is called of an entry that is unvisi...
authorgarvinhicking <garvinhicking>
Tue, 20 Sep 2005 14:46:21 +0000 (14:46 +0000)
committergarvinhicking <garvinhicking>
Tue, 20 Sep 2005 14:46:21 +0000 (14:46 +0000)
docs/NEWS
include/genpage.inc.php

index a0b84f60f94b0a8da2170dea28032147179e2844..1b494d3dbd7ad20a80a55c526b778b5e3e3d90d2 100644 (file)
--- 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)
index 09d6c529214964a3bf3cd8652eef37ef940fc41d..ba50bd55ff073398367a8df5dc55d4fff52c5e39 100644 (file)
@@ -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']));
             }