Hi there,
I had a little problem lately, I have a lot of files in different directories, and I wanted that the last file I upload was in first position in MCPUK to make the choice easier.
I added code to
GetForldersAndFiles.php at line 118 just after
<?php
/**
* The filenames are in the array $files
* SORT IT!
*/
natcasesort($files);
$files = array_values($files);
?>
My code
<?php
/*************************************
* Modification by G. EYDIEUX
* This code allow you to sort files by last modification when you a lot of file
* in the same folder, the last one you added will be in first position
* /!\ Set $debug to true if you want to see a debug file in manager\media\browser\mcpuk\connectors\php
* /!\ because echo won't work
*/
$debug = false;
if($debug)/* DEBUG */
{
$fp=fopen("debug_log.txt","a");
fwrite($fp,"Before modification :\n");
foreach($files as $key => $value)
fwrite($fp,"[$key] => $value\n");
fwrite($fp,"\n\nDuring modification :\n");
}
$temp_array = array();
for ($i=0;$i<sizeof($files);$i++)
{
$modif_time = filemtime($this->real_cwd."/".$files[$i]);
$temp_array[$modif_time] = $files[$i];
if($debug)/* DEBUG */
fwrite($fp,"modif_time = $modif_time - file = $files[$i]\n");
}
krsort($temp_array);
$files = array_values($temp_array);
if($debug)/* DEBUG */
{
fwrite($fp,"\n\nAfter modification :\n");
foreach($files as $key => $value)
fwrite($fp,"[$key] => $value\n");
fwrite($fp,"------------------------\n\n");
fclose($fp);
}
/*************************************/
?>
(The <?php and ?> are just here to have colors in code

)