aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-01-10 23:17:51 +0000
committerz0rglub <z0rglub@piwigo.org>2004-01-10 23:17:51 +0000
commit1592a942f025c347efc104bd5b05f73f53637a10 (patch)
treeca7e1b1c7d439de503d30c9c96f738d2cc193d03
parent185b2c2596620be193879eb1b425727274dba0b5 (diff)
add get_category_directories function
git-svn-id: http://piwigo.org/svn/branches/release-1_3@270 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/include/functions.php27
1 files changed, 27 insertions, 0 deletions
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;
+}
?>