aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-06-17 19:21:46 -0700
committerfriendica <info@friendica.com>2014-06-17 19:21:46 -0700
commit35d42f86265f9ce9dfaaae0298c35d056d0e9ed8 (patch)
treec347d4c15e2584e2a8bc0651855448e132b98dd0
parent6c1304c00052da3b2861923f645d7c4de42bb796 (diff)
downloadvolse-hubzilla-35d42f86265f9ce9dfaaae0298c35d056d0e9ed8.tar.gz
volse-hubzilla-35d42f86265f9ce9dfaaae0298c35d056d0e9ed8.tar.bz2
volse-hubzilla-35d42f86265f9ce9dfaaae0298c35d056d0e9ed8.zip
access control modification functions (item specific - we may need these for several data types)
-rwxr-xr-xinclude/items.php35
-rw-r--r--include/security.php1
2 files changed, 36 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index 275f5c05c..f71ebd503 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4302,3 +4302,38 @@ function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remo
}
+
+/**
+ * change access control for item with message_id $mid and channel_id $uid
+ */
+
+
+function item_add_cid($xchan_hash,$mid,$uid) {
+ $r = q("select id from item where mid = '%s' and uid = %d and allow_cid like '%s'",
+ dbesc($mid),
+ intval($uid),
+ dbesc('<' . $xchan_hash . '>')
+ );
+ if(! $r) {
+ $r = q("update item set allow_cid = concat(allow_cid,'%s') where mid = '%s' and uid = %d limit 1",
+ dbesc('<' . $xchan_hash . '>'),
+ dbesc($mid),
+ intval($uid)
+ );
+ }
+}
+
+function item_remove_cid($xchan_hash,$mid,$uid) {
+ $r = q("select allow_cid from item where mid = '%s' and uid = %d and allow_cid like '%s'",
+ dbesc($mid),
+ intval($uid),
+ dbesc('<' . $xchan_hash . '>')
+ );
+ if($r) {
+ $x = q("update item set allow_cid = '%s' where mid = '%s' and uid = %d limit 1",
+ dbesc(str_replace('<' . $xchan_hash . '>','',$r[0]['allow_cid'])),
+ dbesc($mid),
+ intval($uid)
+ );
+ }
+}
diff --git a/include/security.php b/include/security.php
index 53161e427..285c4a231 100644
--- a/include/security.php
+++ b/include/security.php
@@ -397,3 +397,4 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG);
return $str;
}
+