From 8ef84e2aa74bdc280b6a450a553d71ba492a01cc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 13 Jan 2017 11:22:50 +0100 Subject: possibly improve the album list query and save the result in App::$data --- Zotlabs/Module/Photos.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'Zotlabs/Module/Photos.php') diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index c0fce1007..ef1eee399 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -691,20 +691,17 @@ class Photos extends \Zotlabs\Web\Controller { } $album = (($datum) ? hex2bin($datum) : ''); - - + \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - - $r = q("SELECT resource_id, max(imgscale) AS imgscale FROM photo WHERE uid = %d AND album = '%s' - AND imgscale <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id", + + //check if the album exists and if we have perms + $r = q("SELECT album FROM photo WHERE uid = %d AND album = '%s' and is_nsfw = %d $sql_extra LIMIT 1", intval($owner_uid), dbesc($album), - intval(PHOTO_NORMAL), - intval(PHOTO_PROFILE), intval($unsafe) ); - if(count($r)) { - \App::set_pager_total(count($r)); + + if($r) { \App::set_pager_itemspage(60); } else { goaway(z_root() . '/photos/' . \App::$data['channel']['channel_address']); -- cgit v1.2.3