From 1592a942f025c347efc104bd5b05f73f53637a10 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sat, 10 Jan 2004 23:17:51 +0000 Subject: add get_category_directories function git-svn-id: http://piwigo.org/svn/branches/release-1_3@270 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/admin/include/functions.php b/admin/include/functions.php index 5f1578fa9..2f45ce905 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -927,4 +927,31 @@ function is_user_allowed( $category_id, $restrictions ) // no restriction found : the user is allowed to access this category return 0; } + +/** + * returns an array containing sub-directories which can be a category + * + * directories nammed "thumbnail" are omitted + * + * @param string $basedir + * @return array + */ +function get_category_directories( $basedir ) +{ + $sub_dirs = array(); + + if ( $opendir = opendir( $basedir ) ) + { + while ( $file = readdir( $opendir ) ) + { + if ( $file != '.' and $file != '..' + and is_dir( $basedir.'/'.$file ) + and $file != 'thumbnail' ) + { + array_push( $sub_dirs, $file ); + } + } + } + return $sub_dirs; +} ?> -- cgit v1.2.3