From e146a67f4b34a067229f008e9f6ddff95da18e67 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 23 May 2022 18:56:09 +0000 Subject: fix photo permission if a photo description is available and use the filename as default photo description if uploading via the editor --- include/items.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index d93b9aaaf..d4c27ab28 100644 --- a/include/items.php +++ b/include/items.php @@ -4831,7 +4831,10 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body, $match = null; // match img and zmg image links if(preg_match_all("/\[[zi]mg(.*?)\](.*?)\[\/[zi]mg\]/",$body,$match)) { - $images = $match[2]; + + // The URI can be in both places + $images = array_merge($match[1], $match[2]); + if($images) { foreach($images as $image) { if(! stristr($image,z_root() . '/photo/')) @@ -4849,6 +4852,7 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body, dbesc($image_uri), intval($uid) ); + if($r && $r[0]['folder']) { $f = q("select * from attach where hash = '%s' and is_dir = 1 and uid = %d limit 1", dbesc($r[0]['folder']), -- cgit v1.2.3