Mercurial > hg > mgallery
changeset 64:9a01e14b27ef
Implement hide_contents setting for galleries, which hides contents of an album.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 13 Sep 2016 00:20:20 +0300 |
parents | 1c32ece9acde |
children | 7019d87bc479 |
files | mgtool.php |
diffstat | 1 files changed, 28 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/mgtool.php Tue Sep 13 00:09:46 2016 +0300 +++ b/mgtool.php Tue Sep 13 00:20:20 2016 +0300 @@ -368,35 +368,39 @@ $albums = []; $output = []; - foreach ($entries as $ename => &$edata) + // If we are hiding contents of an album, generate no data + if (!$parentEntry["hide_contents"]) { - if ($edata["hide"]) - continue; + foreach ($entries as $ename => &$edata) + { + if ($edata["hide"]) + continue; - unset($edata["hide"]); - if ($edata["type"] == 0) - $images[$ename] = &$edata; - else - $albums[$ename] = &$edata; + unset($edata["hide"]); + if ($edata["type"] == 0) + $images[$ename] = &$edata; + else + $albums[$ename] = &$edata; - $output[$ename] = &$edata; - } + $output[$ename] = &$edata; + } - uasort($images, "mgSortFunc"); - krsort($albums); + uasort($images, "mgSortFunc"); + krsort($albums); - // Choose gallery album image - if (count($images) > 0) - { - end($images); - $parentEntry["image"] = key($images); - } - else - foreach ($albums as $aid => &$adata) - if (isset($adata["image"])) - { - $parentEntry["image"] = &$adata; - break; + // Choose gallery album image + if (count($images) > 0) + { + end($images); + $parentEntry["image"] = key($images); + } + else + foreach ($albums as $aid => &$adata) + if (isset($adata["image"])) + { + $parentEntry["image"] = &$adata; + break; + } } $str =