From a50e555515f9635610c28a5756875ae8629f4eb9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 7 Jun 2016 16:23:14 -0700 Subject: 'recent photos' query was buggered, also fix issue #163 by adding configurable sort order to the album widget - default is album name ascending --- Zotlabs/Module/Photos.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'Zotlabs/Module/Photos.php') diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index ada7b4ef1..1bdc23897 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -510,7 +510,7 @@ class Photos extends \Zotlabs\Web\Controller { - function get() { + function get() { // URLs: // photos/name @@ -1277,11 +1277,9 @@ class Photos extends \Zotlabs\Web\Controller { \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 `album` != '%s' + $r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", intval(\App::$data['channel']['channel_id']), - dbesc('Contact Photos'), - dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe) @@ -1291,15 +1289,13 @@ class Photos extends \Zotlabs\Web\Controller { \App::set_pager_itemspage(60); } - $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.album, p.imgscale, p.created FROM photo as p - INNER JOIN ( SELECT resource_id, max(imgscale) as imgscale FROM photo + $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.album, p.imgscale, p.created FROM photo p + INNER JOIN ( SELECT resource_id, max(imgscale) imgscale FROM photo WHERE uid = %d AND photo_usage IN ( %d, %d ) - AND is_nsfw = %d $sql_extra group by resource_id ) as ph + AND is_nsfw = %d $sql_extra group by resource_id ) ph ON (p.resource_id = ph.resource_id and p.imgscale = ph.imgscale) ORDER by p.created DESC LIMIT %d OFFSET %d", intval(\App::$data['channel']['channel_id']), - dbesc('Contact Photos'), - dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), -- cgit v1.2.3