(2003-2009) * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Functions * */ /** * Returns an array of found directories * * This function checks every found directory if they match either $uid or $gid, if they do * the found directory is valid. It uses recursive-iterators to find subdirectories. * * @param string $path the path to start searching in * @param int $uid the uid which must match the found directories * @param int $gid the gid which must match the found direcotries * * @return array Array of found valid pathes */ function findDirs($path, $uid, $gid) { $_fileList = array (); $path = makeCorrectDir($path); // valid directory? if (is_dir($path)) { // create RecursiveIteratorIterator $its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); // check every file foreach ($its as $fullFileName => $it) { if ($it->isDir() && (fileowner($fullFileName) == $uid || filegroup($fullFileName) == $gid) ) { $_fileList[] = makeCorrectDir(dirname($fullFileName)); } } } return array_unique($_fileList); }