Plik libraries/joomla/filesystem/folder.php linia 408 zamiast użytej oryginalnie funkcji wstaw:
Kod PHP:
function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
{
// Initialize variables
$arr = array();
$czas = array();
// Check to make sure the path valid and clean
$path = JPath::clean($path);
// Is the path a folder?
if (!is_dir($path)) {
JError::raiseWarning(21, 'JFolder::files: ' . JText::_('Path is not a folder'), 'Path: ' . $path);
return false;
}
// read the source directory
$handle = opendir($path);
while (($file = readdir($handle)) !== false)
{
if (($file != '.') && ($file != '..') && (!in_array($file, $exclude))) {
$dir = $path . DS . $file;
$isDir = is_dir($dir);
if ($isDir) {
if ($recurse) {
if (is_integer($recurse)) {
$arr2 = JFolder::files($dir, $filter, $recurse - 1, $fullpath);
} else {
$arr2 = JFolder::files($dir, $filter, $recurse, $fullpath);
}
$arr = array_merge($arr, $arr2);
}
} else {
if (preg_match("/$filter/", $file)) {
if ($fullpath) {
$arr[] = $path . DS . $file;
$czas[] = date ('y-m-d H:i',filemtime($path . DS . $file));
} else {
$arr[] = $file;
$czas[] = date ('y-m-d H:i',filemtime($path . DS . $file));
}
}
}
}
}
closedir($handle);
//
array_multisort($czas, SORT_DESC, SORT_STRING, $arr);
// asort($arr);
return $arr;
}
Najpierw jednak kopia pliku.
Musisz również wiedzieć, że taka modyfikacja skutkuje zmianą sortowania dla wszystkich plików.
Sortowanie (wybór) można zmodyfikować dodając warunek do:
Kod PHP:
array_multisort($czas, SORT_DESC, SORT_STRING, $arr);
co odpowiada za sortowanie wg daty; oryginalnie: