]> git.mjollnir.org Git - s9y.git/commitdiff
Allow ?p=X and ?serendipity[id]=X URLs
authorgarvinhicking <garvinhicking>
Tue, 28 Aug 2007 07:56:36 +0000 (07:56 +0000)
committergarvinhicking <garvinhicking>
Tue, 28 Aug 2007 07:56:36 +0000 (07:56 +0000)
docs/NEWS
index.php

index 8101dbe5a1511e14bc4e98455d87159c0820f8d4..e381bb22007deb375a6f50430e8181aec2795039 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 1.3 ()
 ------------------------------------------------------------------------
 
+    * Made short-urls index.php?serendipity[id]=X or index.php?p=X
+      properly show a single entry view (garvinhicking)
+
     * Extended spam blocking plugin to handle pingbacks like trackbacks.
       (brockhaus)
 
index 417f6ee8bde7e9b2bf513be622b6fae17160fd49..3de482bd401befb30a0bb7469aeae6730f3b6c2b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -250,10 +250,18 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
 
     echo $data;
 } else if ( preg_match(PAT_COMMENTSUB, $uri, $matches) ||
-            preg_match(PAT_PERMALINK, $uri, $matches) ) {
+            preg_match(PAT_PERMALINK, $uri, $matches) ||
+            isset($serendipity['GET']['id']) ||
+            isset($_GET['p']) ) {
     $serendipity['view'] = 'entry';
 
-    $matches[1] = serendipity_searchPermalink($serendipity['permalinkStructure'], $uri, (!empty($matches[2]) ? $matches[2] : $matches[1]), 'entry');
+    if (isset($serendipity['GET']['id'])) {
+        $matches[1] = (int)$serendipity['GET']['id'];
+    } elseif (isset($_GET['p'])) {
+        $matches[1] = $_GET['p'];
+    } else {
+        $matches[1] = serendipity_searchPermalink($serendipity['permalinkStructure'], $uri, (!empty($matches[2]) ? $matches[2] : $matches[1]), 'entry');
+    }
     serendipity_rememberComment();
 
     if (!empty($serendipity['POST']['submit']) && !isset($_REQUEST['serendipity']['csuccess'])) {