aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorpafcu <pafcu@iki.fi>2015-01-12 21:07:54 +0200
committerpafcu <pafcu@iki.fi>2015-01-12 21:07:54 +0200
commita0134de28abdaf820d14a161a05578c16911cdbd (patch)
treeb2b71519398dbd68e9f641719bc334d087d267a3 /include/items.php
parent55eb6be30885919882f05162f53ea2216ecffac3 (diff)
parentadc9564b5cc5f1fc410220514285927052cdfe4a (diff)
downloadvolse-hubzilla-a0134de28abdaf820d14a161a05578c16911cdbd.tar.gz
volse-hubzilla-a0134de28abdaf820d14a161a05578c16911cdbd.tar.bz2
volse-hubzilla-a0134de28abdaf820d14a161a05578c16911cdbd.zip
Merge pull request #844 from pafcu/moretagging
Refactor mention code to make it more reusable
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index e7cc15878..4c533aedc 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4715,3 +4715,34 @@ function item_remove_cid($xchan_hash,$mid,$uid) {
);
}
}
+
+// Set item permissions based on results obtained from linkify_tags()
+function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow, $profile_uid, $parent_item = false) {
+ $first_access_tag = true;
+ foreach($linkified as $x) {
+ $access_tag = $x['access_tag'];
+ if(($access_tag) && (! $parent_item)) {
+ logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
+ if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) {
+
+ // This is a tough call, hence configurable. The issue is that one can type in a @!privacy mention
+ // and also have a default ACL (perhaps from viewing a collection) and could be suprised that the
+ // privacy mention wasn't the only recipient. So the default is to wipe out the existing ACL if a
+ // private mention is found. This can be over-ridden if you wish private mentions to be in
+ // addition to the current ACL settings.
+
+ $str_contact_allow = '';
+ $str_group_allow = '';
+ $first_access_tag = false;
+ }
+ if(strpos($access_tag,'cid:') === 0) {
+ $str_contact_allow .= '<' . substr($access_tag,4) . '>';
+ $access_tag = '';
+ }
+ elseif(strpos($access_tag,'gid:') === 0) {
+ $str_group_allow .= '<' . substr($access_tag,4) . '>';
+ $access_tag = '';
+ }
+ }
+ }
+}