public static function getFiles($folder, $substoo) { $dir = JPATH_BASE . DIRECTORY_SEPARATOR . $folder; $files = array(); $subfiles = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..' && $file != 'CVS' && $file != 'index.html') { if (!is_dir($dir . DIRECTORY_SEPARATOR . $file)) { $files[] = $folder . DIRECTORY_SEPARATOR . $file; } elseif ($substoo != 0) { $newfolder = $folder . DIRECTORY_SEPARATOR . $file; $subfiles[] = modVsir::getFiles($newfolder, $substoo, $random); } } } } closedir($handle); sort($files); foreach ($subfiles as $subfile) { $files = array_merge($files, $subfile); } return $files; }