]> git.mjollnir.org Git - s9y.git/commitdiff
Make serendipity parse its permalinks before creating directories.
authorgarvinhicking <garvinhicking>
Wed, 22 Jun 2005 09:08:56 +0000 (09:08 +0000)
committergarvinhicking <garvinhicking>
Wed, 22 Jun 2005 09:08:56 +0000 (09:08 +0000)
This gets rid of a PATH_ARCHIVES directory created by the installer.
Didn't hurt, but didn't look right. ;)

include/functions_installer.inc.php
include/functions_permalinks.inc.php
serendipity_config.inc.php

index 9f79805801b4570bca5afbd014f1e26b22ae3cd0..49be3df860ac8a076edac7188b724fdfd3dbb794 100644 (file)
@@ -530,6 +530,8 @@ function serendipity_checkInstallation() {
 
     $errs = array();
 
+    serendipity_initPermalinks();
+
     // Check dirs
     if (!is_dir($_POST['serendipityPath'])) {
         $errs[] = sprintf(DIRECTORY_NON_EXISTANT, $_POST['serendipityPath']);
index c43f78627c61ca00b6ade406761cb3daae85dbca..238bac97104426d8ccdb12bc06a07681269d9048 100644 (file)
@@ -104,6 +104,94 @@ function serendipity_makeFilename($str) {
     return $str;
 }
 
+function serendipity_initPermalinks() {
+    global $serendipity;
+
+    if (!isset($serendipity['permalinkStructure'])) {
+        $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html';
+    }
+    
+    if (!isset($serendipity['permalinkFeedCategoryStructure'])) {
+        $serendipity['permalinkFeedCategoryStructure'] = 'feeds/categories/%id%-%name%.rss';
+    }
+    
+    if (!isset($serendipity['permalinkCategoryStructure'])) {
+        $serendipity['permalinkCategoryStructure'] = 'categories/%id%-%name%';
+    }
+    
+    if (!isset($serendipity['permalinkAuthorStructure'])) {
+        $serendipity['permalinkAuthorStructure'] = 'authors/%id%-%realname%';
+    }
+    
+    if (!isset($serendipity['permalinkArchivesPath'])) {
+        $serendipity['permalinkArchivesPath'] = 'archives';
+    }
+    
+    if (!isset($serendipity['permalinkArchivePath'])) {
+        $serendipity['permalinkArchivePath'] = 'archive';
+    }
+    
+    if (!isset($serendipity['permalinkCategoriesPath'])) {
+        $serendipity['permalinkCategoriesPath'] = 'categories';
+    }
+    
+    if (!isset($serendipity['permalinkUnsubscribePath'])) {
+        $serendipity['permalinkUnsubscribePath'] = 'unsubscribe';
+    }
+    
+    if (!isset($serendipity['permalinkDeletePath'])) {
+        $serendipity['permalinkDeletePath'] = 'delete';
+    }
+    
+    if (!isset($serendipity['permalinkApprovePath'])) {
+        $serendipity['permalinkApprovePath'] = 'approve';
+    }
+    
+    if (!isset($serendipity['permalinkFeedsPath'])) {
+        $serendipity['permalinkFeedsPath'] = 'feeds';
+    }
+    
+    if (!isset($serendipity['permalinkPluginPath'])) {
+        $serendipity['permalinkPluginPath'] = 'plugin';
+    }
+    
+    if (!isset($serendipity['permalinkAdminPath'])) {
+        $serendipity['permalinkAdminPath'] = 'admin';
+    }
+    
+    if (!isset($serendipity['permalinkSearchPath'])) {
+        $serendipity['permalinkSearchPath'] = 'search';
+    }
+    
+    /* URI paths
+     * These could be defined in the language headers, except that would break
+     * backwards URL compatibility
+     */
+    @define('PATH_ARCHIVES',    $serendipity['permalinkArchivesPath']);
+    @define('PATH_ARCHIVE',     $serendipity['permalinkArchivePath']);
+    @define('PATH_CATEGORIES',  $serendipity['permalinkCategoriesPath']);
+    @define('PATH_UNSUBSCRIBE', $serendipity['permalinkUnsubscribePath']);
+    @define('PATH_DELETE',      $serendipity['permalinkDeletePath']);
+    @define('PATH_APPROVE',     $serendipity['permalinkApprovePath']);
+    @define('PATH_FEEDS',       $serendipity['permalinkFeedsPath']);
+    @define('PATH_PLUGIN',      $serendipity['permalinkPluginPath']);
+    @define('PATH_ADMIN',       $serendipity['permalinkAdminPath']);
+    @define('PATH_SEARCH',      $serendipity['permalinkSearchPath']);
+    
+    /* URI patterns
+     * Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts
+     * like \d or \s, since mod_rewrite will use the regexps as well and chokes on them.
+     * If you add new patterns, remember to add the new rules to the *.tpl files and
+     * function serendipity_installFiles().
+     */
+    @define('PAT_FILENAME',   '0-9a-z\.\_!;,\+\-');
+    @define('PAT_CSS',        '@/(serendipity\.css|serendipity_admin\.css)@');
+    @define('PAT_FEED',       '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
+    @define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
+
+    return true;
+}
+
 function &serendipity_permalinkPatterns($return = false) {
     global $serendipity;
     
index 9b679e9c4c2d8c0f7a869b97dc0b8623f9abd460..abdc912b6520c29dafcb65cfb046db5c5d6b60d7 100644 (file)
@@ -189,87 +189,7 @@ if (empty($serendipity['serendipityHTTPPath'])) {
 }
 
 /* Changing this is NOT recommended, rewrite rules does not take them into account - yet */
-if (!isset($serendipity['permalinkStructure'])) {
-    $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html';
-}
-
-if (!isset($serendipity['permalinkFeedCategoryStructure'])) {
-    $serendipity['permalinkFeedCategoryStructure'] = 'feeds/categories/%id%-%name%.rss';
-}
-
-if (!isset($serendipity['permalinkCategoryStructure'])) {
-    $serendipity['permalinkCategoryStructure'] = 'categories/%id%-%name%';
-}
-
-if (!isset($serendipity['permalinkAuthorStructure'])) {
-    $serendipity['permalinkAuthorStructure'] = 'authors/%id%-%realname%';
-}
-
-if (!isset($serendipity['permalinkArchivesPath'])) {
-    $serendipity['permalinkArchivesPath'] = 'archives';
-}
-
-if (!isset($serendipity['permalinkArchivePath'])) {
-    $serendipity['permalinkArchivePath'] = 'archive';
-}
-
-if (!isset($serendipity['permalinkCategoriesPath'])) {
-    $serendipity['permalinkCategoriesPath'] = 'categories';
-}
-
-if (!isset($serendipity['permalinkUnsubscribePath'])) {
-    $serendipity['permalinkUnsubscribePath'] = 'unsubscribe';
-}
-
-if (!isset($serendipity['permalinkDeletePath'])) {
-    $serendipity['permalinkDeletePath'] = 'delete';
-}
-
-if (!isset($serendipity['permalinkApprovePath'])) {
-    $serendipity['permalinkApprovePath'] = 'approve';
-}
-
-if (!isset($serendipity['permalinkFeedsPath'])) {
-    $serendipity['permalinkFeedsPath'] = 'feeds';
-}
-
-if (!isset($serendipity['permalinkPluginPath'])) {
-    $serendipity['permalinkPluginPath'] = 'plugin';
-}
-
-if (!isset($serendipity['permalinkAdminPath'])) {
-    $serendipity['permalinkAdminPath'] = 'admin';
-}
-
-if (!isset($serendipity['permalinkSearchPath'])) {
-    $serendipity['permalinkSearchPath'] = 'search';
-}
-
-/* URI paths
- * These could be defined in the language headers, except that would break
- * backwards URL compatibility
- */
-@define('PATH_ARCHIVES',    $serendipity['permalinkArchivesPath']);
-@define('PATH_ARCHIVE',     $serendipity['permalinkArchivePath']);
-@define('PATH_CATEGORIES',  $serendipity['permalinkCategoriesPath']);
-@define('PATH_UNSUBSCRIBE', $serendipity['permalinkUnsubscribePath']);
-@define('PATH_DELETE',      $serendipity['permalinkDeletePath']);
-@define('PATH_APPROVE',     $serendipity['permalinkApprovePath']);
-@define('PATH_FEEDS',       $serendipity['permalinkFeedsPath']);
-@define('PATH_PLUGIN',      $serendipity['permalinkPluginPath']);
-@define('PATH_ADMIN',       $serendipity['permalinkAdminPath']);
-@define('PATH_SEARCH',      $serendipity['permalinkSearchPath']);
-
-/* URI patterns
- * Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts
- * like \d or \s, since mod_rewrite will use the regexps as well and chokes on them.
- * If you add new patterns, remember to add the new rules to the *.tpl files and
- * function serendipity_installFiles().
- */
-@define('PAT_FILENAME',   '0-9a-z\.\_!;,\+\-');
-@define('PAT_CSS',        '@/(serendipity\.css|serendipity_admin\.css)@');
-@define('PAT_FEED',       '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
-@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
+serendipity_initPermalinks();
 
 // Apply constants/definitions from custom permalinks
 serendipity_permalinkPatterns();