From 60ba5380a38917b65d335e81992097955026db37 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Tue, 7 Feb 2006 09:04:55 +0000 Subject: [PATCH] Added PHP 5.1.3 ext/filter awareness by Toby Proper sorting of templates --- docs/NEWS | 5 +++++ include/compat.inc.php | 9 +++++++++ include/functions.inc.php | 8 ++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 1fbae73..1aad063 100644 --- 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 diff --git a/include/compat.inc.php b/include/compat.inc.php index 8523b4e..3c910c3 100644 --- a/include/compat.inc.php +++ b/include/compat.inc.php @@ -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 diff --git a/include/functions.inc.php b/include/functions.inc.php index 1afdf8f..ba6eb44 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -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; } -- 2.39.5