aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Photos.php2
-rw-r--r--include/photos.php9
2 files changed, 10 insertions, 1 deletions
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index d993c481e..18d7abc48 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -689,7 +689,7 @@ class Photos extends \Zotlabs\Web\Controller {
(SELECT resource_id, max(imgscale) imgscale FROM photo left join attach on folder = '%s' and photo.resource_id = attach.hash WHERE attach.uid = %d AND imgscale <= 4 AND photo_usage IN ( %d, %d ) 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 created $order LIMIT %d OFFSET %d",
- dbesc($datum),
+ dbesc($x['hash']),
intval($owner_uid),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE),
diff --git a/include/photos.php b/include/photos.php
index 6ea444e2e..f5d5fdb48 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -593,6 +593,15 @@ function photos_album_exists($channel_id, $observer_hash, $album) {
intval($channel_id)
);
+ // partial backward compatibility with Hubzilla < 2.4 when we used the filename only
+ // (ambiguous which would get chosen if you had two albums of the same name in different directories)
+ if(!$r) {
+ $r = q("SELECT folder, hash, is_dir, filename, os_path, display_path FROM attach WHERE filename = '%s' AND is_dir = 1 AND uid = %d $sql_extra limit 1",
+ dbesc(hex2bin($album)),
+ intval($channel_id)
+ );
+ }
+
return (($r) ? $r[0] : false);
}