diff --git a/conf/config.php b/conf/config.php index eb6ab64..2d56c2d 100644 --- a/conf/config.php +++ b/conf/config.php @@ -22,6 +22,6 @@ $conf['defpage'] = 1; // Images per Page if not specified $conf['defslice'] = 34; // Default Subdirectory if none given -$conf['defdir'] = 'r34'; +$conf['defdir'] = ''; ?> \ No newline at end of file diff --git a/img/folder.png b/img/folder.png new file mode 100644 index 0000000..29757b8 Binary files /dev/null and b/img/folder.png differ diff --git a/index.php b/index.php index ba9e8c1..4f584f7 100644 --- a/index.php +++ b/index.php @@ -36,7 +36,11 @@ if (isset($_SESSION['files']) { $files = $_SESSION['files']; } else { - $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), array('..', '.')); + $dirs = glob($imagedir.$dir.'/*' , GLOB_ONLYDIR); + $rmdirs = $dirs; + $rmdirs[] = '.'; + $rmdirs[] = '..'; + $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs); $_SESSION['files'] = $files; $_SESSION['dir'] = $dir; $_SESSION['cachetime'] = time(); @@ -60,7 +64,7 @@ $files = array_reverse($files); // Get Files for current Page $curfiles = array_slice($files, ($page-1)*$slice ,$slice, true); -if (count($curfiles) > 0) { +if (count($curfiles) > 0 | count($dirs) > 0) { // Prepare Generic Data for Template $data['galleryname'] = $galleryname; $data['startpage'] = $_SERVER['PHP_SELF']; @@ -83,6 +87,7 @@ if (count($curfiles) > 0) { $tmp['i'] = $index+1; $tmp['t'] = $thumburl.$t->get_thumb($image); $data['images'][] = $tmp; + $data['dirs'] = $dirs; } Template::view('tpl/gallery.html', $data); } else { diff --git a/tpl/gallery.html b/tpl/gallery.html index 071109a..2b8b785 100644 --- a/tpl/gallery.html +++ b/tpl/gallery.html @@ -16,6 +16,13 @@
+ {% foreach($dirs as $d): %} +
+ + {{ $d }} + +
+ {% endforeach %} {% foreach($images as $image): %}