News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

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!
  •