News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Suggested patch for jdownloadshelper.php in admin - [Fixed in 3.2.45]

Started by dr236, 11.05.2016 00:42:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dr236

When JDownloads checks for new directories within its download area (and automatically creates corresponding categories), the helper method searchdir() within administrator/components/com_jdownloads/helpers/jdownloadshelper.php runs
natcasesort($dirlist)
so the directory list is nicely sorted.
Unfortunately, this has no real effect, as natcasesort preserves the key=>value association of the array, and all subsequent loops through $dirlist use keys 0..count($dirlist)-1.
Something like this (trivial) patch
--------------------
--- jdownloadshelper.php.orig   2016-05-10 22:02:05.529879084 +0000
+++ jdownloadshelper.php    2016-05-10 22:22:01.212591241 +0000
@@ -1898,7 +1898,8 @@
            closedir ( $handle ) ;
        }
        if ( $d == 0 ) {
-           natcasesort ( $dirlist ) ;
+           natcasesort($dirlist);
+           $dirlist = array_values($dirlist);
        }
        return ( $dirlist ) ;
    }
--------------------

fixes this for me.

Thanks,
David
  •  

Arno

Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •