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.
This commit is contained in:
Matt Pass
2013-02-20 09:34:29 +00:00
parent 8fcbdc8ea0
commit 5d6b057361

View File

@@ -12,11 +12,12 @@
<body onLoad="top.ICEcoder.fileManager()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
<?php
// Function to sort given values alphabetically
function alphasort($a, $b) {
return strcasecmp($a->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