From 763ff827d5f4d0f1728746ddad334fb851d47448 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 27 May 2011 02:37:12 -0700 Subject: don't reset photo permissions unless photo has owner-only permissions --- mod/item.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 82f33eaeb..b07f26e32 100644 --- a/mod/item.php +++ b/mod/item.php @@ -204,13 +204,25 @@ function item_post(&$a) { continue; $image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image_uri,0, strpos($image_uri,'-')); + $srch = '<' . intval($profile_uid) . '>'; + $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' + AND `resource-id` = '%s' AND `uid` = %d LIMIT 1", + dbesc($srch), + dbesc($image_uri), + intval($profile_uid) + ); + if(! count($r)) + continue; + + $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' - WHERE `resource-id` = '%s' AND `album` = '%s' ", + WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ", dbesc($str_contact_allow), dbesc($str_group_allow), dbesc($str_contact_deny), dbesc($str_group_deny), dbesc($image_uri), + intval($profile_uid), dbesc( t('Wall Photos')) ); -- cgit v1.2.3