aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Photos.php15
-rw-r--r--include/photos.php15
2 files changed, 17 insertions, 13 deletions
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" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$cmd) . '" title="oembed" />' . "\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']);
diff --git a/include/photos.php b/include/photos.php
index 8496c2c86..7ddbe43b9 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -464,10 +464,15 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction
$sort_key = dbesc($sort_key);
$direction = dbesc($direction);
- $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction",
- intval($channel_id),
- intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ //$albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction",
+ // intval($channel_id),
+ // intval(PHOTO_NORMAL),
+ // intval(PHOTO_PROFILE)
+ //);
+
+ // this query provides the same results but might perform better
+ $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and os_storage = 1 $sql_extra group by album order by $sort_key $direction",
+ intval($channel_id)
);
// add various encodings to the array so we can just loop through and pick them out in a template
@@ -490,6 +495,8 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction
}
}
+ App::$data['albums'] = $ret;
+
return $ret;
}