comparison includes/file.inc @ 11:589fb7c02327 6.5

Drupal 6.5
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:32:19 +0100
parents acef7ccb09b5
children 8b6c45761e01
comparison
equal deleted inserted replaced
10:6f15c9d74937 11:589fb7c02327
1 <?php 1 <?php
2 // $Id: file.inc,v 1.121.2.3 2008/08/13 23:59:12 drumm Exp $ 2 // $Id: file.inc,v 1.121.2.4 2008/09/17 08:13:07 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * API for handling file uploads and server file management. 6 * API for handling file uploads and server file management.
7 */ 7 */
882 function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) { 882 function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
883 $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename'); 883 $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
884 $files = array(); 884 $files = array();
885 885
886 if (is_dir($dir) && $handle = opendir($dir)) { 886 if (is_dir($dir) && $handle = opendir($dir)) {
887 while (false !== ($file = readdir($handle))) { 887 while (FALSE !== ($file = readdir($handle))) {
888 if (!in_array($file, $nomask) && $file[0] != '.') { 888 if (!in_array($file, $nomask) && $file[0] != '.') {
889 if (is_dir("$dir/$file") && $recurse) { 889 if (is_dir("$dir/$file") && $recurse) {
890 // Give priority to files in this folder by merging them in after any subdirectory files. 890 // Give priority to files in this folder by merging them in after any subdirectory files.
891 $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files); 891 $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
892 } 892 }