]> git.mjollnir.org Git - s9y.git/commitdiff
Added PHP 5.1.3 ext/filter awareness by Toby
authorgarvinhicking <garvinhicking>
Tue, 7 Feb 2006 09:04:55 +0000 (09:04 +0000)
committergarvinhicking <garvinhicking>
Tue, 7 Feb 2006 09:04:55 +0000 (09:04 +0000)
Proper sorting of templates

docs/NEWS
include/compat.inc.php
include/functions.inc.php

index 1fbae730a9f053c65f0def33bc51fa7ef4955708..1aad063dfc254ab9b693d3f86c24621a92c3a018 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 1.0-beta2 ()
 ------------------------------------------------------------------------
 
+   * Added PHP 5.1.3 filter awareness (Tobias Schlitt)
+
+   * Properly sort template listings alphabetically, if using themes
+     in subdirectories (garvinhicking)
+
    * Add new plugin API method "performConfig" for performing expensive
      configuration options that shall not impact the usual blog
      performance. Enhance mailentry plugin to send mails depending
index 8523b4ed3251f5f536a0f41cfb38e2461d7825b7..3c910c346d9f00a2d75d46a74899714d33fd5137 100644 (file)
@@ -96,6 +96,15 @@ if (!isset($_SERVER)) {
     $_SERVER = &$HTTP_SERVER_VARS;
 }
 
+if (extension_loaded('filter') && ini_get('filter.default') !== FILTER_UNSAFE_RAW) {
+    foreach ($_POST as $key => $value) {
+        $_POST[$key] = input_get(INPUT_POST, $key, FILTER_UNSAFE_RAW);
+    }
+    foreach ($_GET as $key => $value) {
+        $_GET[$key] = input_get(INPUT_GET, $key, FILTER_UNSAFE_RAW);
+    }
+}
+
 /*
  *  Avoid magic_quotes_gpc issues
  *  courtesy of iliaa@php.net
index 1afdf8f21c8ef5c62ac98dd94445a40fa519dd62..ba6eb4492c23d4ae3679b0fa720bc9d37dc911b0 100644 (file)
@@ -140,7 +140,11 @@ function serendipity_fetchTemplates($dir = '') {
     while (($file = readdir($cdir)) !== false) {
         if (is_dir($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file) && !ereg('^(\.|CVS)', $file) && !file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file . '/inactive.txt')) {
             if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file . '/info.txt')) {
-                $rv[] = $dir . $file;
+                $key = strtolower($file);
+                if (isset($rv[$key])) {
+                    $key = $dir . $key;
+                }
+                $rv[$key] = $dir . $file;
             } else {
                 $temp = serendipity_fetchTemplates($dir . $file . '/');
                 if (count($temp) > 0) {
@@ -150,7 +154,7 @@ function serendipity_fetchTemplates($dir = '') {
         }
     }
     closedir($cdir);
-    natcasesort($rv);
+    ksort($rv);
     return $rv;
 }