mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user