| @@ 381-387 (lines=7) @@ | ||
| 378 | $save_dir = getcwd(); |
|
| 379 | chdir($path); |
|
| 380 | $handle = opendir($path); |
|
| 381 | while ($element = readdir($handle)) { |
|
| 382 | if ($element == '.' || $element == '..') continue; |
|
| 383 | // Skip the current and parent directories |
|
| 384 | if (is_dir($element)) { |
|
| 385 | $dir_array[] = $path.'/'.$element; |
|
| 386 | } |
|
| 387 | } |
|
| 388 | closedir($handle); |
|
| 389 | // Recursive operation if subdirectories exist |
|
| 390 | $dir_number = sizeof($dir_array); |
|
| @@ 421-427 (lines=7) @@ | ||
| 418 | foreach ($dir_array as $directory) { |
|
| 419 | chdir($directory); |
|
| 420 | $handle = opendir($directory); |
|
| 421 | while ($element = readdir($handle)) { |
|
| 422 | if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
| 423 | // Skip the current and parent directories |
|
| 424 | if (!is_dir($element)) { |
|
| 425 | $element_array[] = $directory.'/'.$element; |
|
| 426 | } |
|
| 427 | } |
|
| 428 | closedir($handle); |
|
| 429 | chdir('..'); |
|
| 430 | chdir($save_dir); |
|
| @@ 2863-2868 (lines=6) @@ | ||
| 2860 | ||
| 2861 | if (is_dir($path)) { |
|
| 2862 | $handle = opendir($path); |
|
| 2863 | while ($file = readdir($handle)) { |
|
| 2864 | if ($file == '.' || $file == '..' || $file == '.htaccess' || is_dir($path.$file)) { |
|
| 2865 | continue; // skip current/parent directory and .htaccess |
|
| 2866 | } |
|
| 2867 | $file_list[] = $file; |
|
| 2868 | } |
|
| 2869 | if (count($file_list) > 0) { |
|
| 2870 | $return = "<h4>$course</h4>"; |
|
| 2871 | $return .= '<ul class="thumbnails">'; |
|