aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-09-18 19:53:07 +0000
committerMario <mario@mariovavti.com>2024-09-18 19:53:07 +0000
commit5309c032dbda6f69c2d8f52de1e37a28fa24f6e9 (patch)
tree0bacf0f02f87ade04395000db55d782357d3317d /include/items.php
parent176298ffeb81481e9b48e032a20d75601e959017 (diff)
downloadvolse-hubzilla-5309c032dbda6f69c2d8f52de1e37a28fa24f6e9.tar.gz
volse-hubzilla-5309c032dbda6f69c2d8f52de1e37a28fa24f6e9.tar.bz2
volse-hubzilla-5309c032dbda6f69c2d8f52de1e37a28fa24f6e9.zip
Adjust fix_attached_permissions() so that if we got a token, we will just add the token to the original ACL instead of rewriting the ACL to theitem ACL - it probably makes much more sense that way
Diffstat (limited to 'include/items.php')
-rw-r--r--include/items.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/items.php b/include/items.php
index a667bc1bc..23222892f 100644
--- a/include/items.php
+++ b/include/items.php
@@ -5005,7 +5005,7 @@ function fix_attached_permissions($uid, $body, $str_contact_allow, $str_group_al
$attach = array_shift($attach_q);
- $new_public = !(($str_contact_allow || $str_group_allow || $str_contact_deny || $str_group_deny));
+ //$new_public = !(($str_contact_allow || $str_group_allow || $str_contact_deny || $str_group_deny));
$existing_public = !(($attach['allow_cid'] || $attach['allow_gid'] || $attach['deny_cid'] || $attach['deny_gid']));
if ($existing_public) {
@@ -5020,10 +5020,11 @@ function fix_attached_permissions($uid, $body, $str_contact_allow, $str_group_al
continue;
}
- $item_private = 0;
-
- if ($new_public === false) {
- $item_private = (($str_group_allow || ($str_contact_allow && substr_count($str_contact_allow,'<') > 2)) ? 1 : 2);
+ if ($token) {
+ $str_contact_allow = $attach['allow_cid'];
+ $str_group_allow = $attach['allow_gid'];
+ $str_contact_deny = $attach['deny_cid'];
+ $str_group_deny = $attach['deny_gid'];
// preserve any existing tokens that may have been set for this file
$token_matches = null;
@@ -5051,7 +5052,7 @@ function fix_attached_permissions($uid, $body, $str_contact_allow, $str_group_al
);
if ($attach['is_photo']) {
- $r = q("UPDATE photo SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s'
+ q("UPDATE photo SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s'
WHERE resource_id = '%s' AND uid = %d ",
dbesc($str_contact_allow),
dbesc($str_group_allow),
@@ -5061,7 +5062,16 @@ function fix_attached_permissions($uid, $body, $str_contact_allow, $str_group_al
intval($uid)
);
- $r = q("UPDATE item SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d
+ $item_private = 0;
+
+ if ($str_group_allow || $str_contact_deny || $str_group_deny) {
+ $item_private = 1;
+ }
+ elseif ($str_contact_allow) {
+ $item_private = 2;
+ }
+
+ q("UPDATE item SET allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d
WHERE resource_id = '%s' AND 'resource_type' = 'photo' AND uid = %d",
dbesc($str_contact_allow),
dbesc($str_group_allow),