diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-22 16:11:38 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-29 14:13:10 +0200 |
commit | f1da00302091c6b9005083d41686934385e97cf8 (patch) | |
tree | 7dc0f22186f8efdc346f254d3f05d780f049e172 /include/photos.php | |
parent | ea5a7180c7a6ae992a661c43db9503f085d41d6d (diff) | |
download | volse-hubzilla-f1da00302091c6b9005083d41686934385e97cf8.tar.gz volse-hubzilla-f1da00302091c6b9005083d41686934385e97cf8.tar.bz2 volse-hubzilla-f1da00302091c6b9005083d41686934385e97cf8.zip |
some more photo issues
Diffstat (limited to 'include/photos.php')
-rw-r--r-- | include/photos.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/photos.php b/include/photos.php index e73428478..a3869a72e 100644 --- a/include/photos.php +++ b/include/photos.php @@ -459,23 +459,24 @@ function photos_albums_list($channel, $observer, $sort_key = 'display_path', $di $sort_key = dbesc($sort_key); $direction = dbesc($direction); - $r = q("select display_path, hash from attach where is_dir = 1 and uid = %d order by $sort_key $direction", + $r = q("select display_path, hash from attach where is_dir = 1 and uid = %d $sql_extra order by $sort_key $direction", intval($channel_id) ); + array_unshift($r,[ 'display_path' => '/', 'hash' => '' ]); $str = ids_to_querystr($r,'hash',true); $albums = []; if($str) { - $x = q("select count( distinct hash ) as total, folder from attach where is_photo = 1 and uid = %d and folder in ( $str ) group by folder ", + $x = q("select count( distinct hash ) as total, folder from attach where is_photo = 1 and uid = %d and folder in ( $str ) $sql_extra group by folder ", intval($channel_id) ); if($x) { foreach($r as $rv) { foreach($x as $xv) { if($xv['folder'] === $rv['hash']) { - if($xv['total'] != 0) { + if($xv['total'] != 0 && attach_can_view_folder($channel_id,$observer_xchan,$xv['folder'])) { $albums[] = [ 'album' => $rv['display_path'], 'folder' => $xv['folder'], 'total' => $xv['total'] ]; } continue; |