From 5d6b057361c2e61799efae4856f094aeb365f3cd Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 20 Feb 2013 09:34:29 +0000 Subject: [PATCH] Replace URL special chars when folder sorting When sorting folders into order, special chars such as $, -, _ etc were causing sorting issues while other chars such as _ worked OK. This is all due to the char's ref in relation to a-z, 0-9 and A-Z chars in the char table. By replacing these URL special chars (defined in RFC 1738 specification) with a \ (the only char not allowed in a file/folder name), we are levelling these chars out, so we can safely focus on alphanum sorting only. --- files.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files.php b/files.php index afdfdfc..e1ed67d 100644 --- a/files.php +++ b/files.php @@ -12,11 +12,12 @@
- + getPathname(), $b->getPathname()); + $specialChars = array("$","-","_",".","+","!","*","'","(",")",","); + return strcasecmp(str_replace($specialChars,"\\",$a->getPathname()), str_replace($specialChars,"\\",$b->getPathname())); } // Class to put forward the values for sorting