sync photo permissions with the attached item whenever they change.
This commit is contained in:
parent
6a9e86e540
commit
9d718ac529
@ -1087,12 +1087,15 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
|
|||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$r = q("UPDATE item SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s'
|
$private = (($str_contact_allow || $str_group_allow || $str_contact_deny || $str_group_deny) ? true : false);
|
||||||
|
|
||||||
|
$r = q("UPDATE item SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d
|
||||||
WHERE id = %d AND uid = %d limit 1",
|
WHERE id = %d AND uid = %d limit 1",
|
||||||
dbesc($str_contact_allow),
|
dbesc($str_contact_allow),
|
||||||
dbesc($str_group_allow),
|
dbesc($str_group_allow),
|
||||||
dbesc($str_contact_deny),
|
dbesc($str_contact_deny),
|
||||||
dbesc($str_group_deny),
|
dbesc($str_group_deny),
|
||||||
|
intval($private),
|
||||||
intval($r[0]['id']),
|
intval($r[0]['id']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -303,6 +303,9 @@ function photos_post(&$a) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$item_private = (($str_contact_allow || $str_group_allow || $str_contact_deny || $str_group_deny) ? true : false);
|
||||||
|
|
||||||
|
|
||||||
/* Don't make the item visible if the only change was the album name */
|
/* Don't make the item visible if the only change was the album name */
|
||||||
|
|
||||||
$visibility = 0;
|
$visibility = 0;
|
||||||
@ -320,11 +323,23 @@ function photos_post(&$a) {
|
|||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if($r) {
|
||||||
$old_tag = $r[0]['tag'];
|
$old_tag = $r[0]['tag'];
|
||||||
$old_inform = $r[0]['inform'];
|
$old_inform = $r[0]['inform'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure the linked item has the same permissions as the photo regardless of any other changes
|
||||||
|
$x = q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d
|
||||||
|
where id = %d limit 1",
|
||||||
|
dbesc($str_contact_allow),
|
||||||
|
dbesc($str_group_allow),
|
||||||
|
dbesc($str_contact_deny),
|
||||||
|
dbesc($str_group_deny),
|
||||||
|
intval($item_private),
|
||||||
|
intval($item_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if(strlen($rawtags)) {
|
if(strlen($rawtags)) {
|
||||||
|
|
||||||
$str_tags = '';
|
$str_tags = '';
|
||||||
|
Reference in New Issue
Block a user