aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-12-07 20:47:53 -0800
committerFriendika <info@friendika.com>2010-12-07 20:47:53 -0800
commita42b9ea3dea5e1490dd4aa4852760354d569ea51 (patch)
treec0a99dd7bbc6b479b040a8ef08cabee5f0f56e38 /include
parente241c401cf21108f39f67e54f64f50ad139af221 (diff)
downloadvolse-hubzilla-a42b9ea3dea5e1490dd4aa4852760354d569ea51.tar.gz
volse-hubzilla-a42b9ea3dea5e1490dd4aa4852760354d569ea51.tar.bz2
volse-hubzilla-a42b9ea3dea5e1490dd4aa4852760354d569ea51.zip
display the fact that a conversation is private without disclosing the details of who can/cannot see it.
Diffstat (limited to 'include')
-rw-r--r--include/items.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php
index a4d3953f9..bb1b4f16b 100644
--- a/include/items.php
+++ b/include/items.php
@@ -367,6 +367,12 @@ function get_atom_elements($feed,$item) {
else
$res['last-child'] = 0;
+ $private = $item->get_item_tags(NAMESPACE_DFRN,'private');
+ if($private && $private[0]['data'] == 1)
+ $res['private'] = 1;
+ else
+ $res['private'] = 0;
+
$rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'published');
if($rawcreated)
$res['created'] = unxmlify($rawcreated[0]['data']);
@@ -549,6 +555,7 @@ function item_store($arr) {
$arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : '');
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
+ $arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0 );
$arr['body'] = ((x($arr,'body')) ? escape_tags(trim($arr['body'])) : '');
// The content body has been through a lot of filtering and transport escaping by now.
@@ -631,15 +638,21 @@ function item_store($arr) {
if($arr['parent-uri'] === $arr['uri'])
$parent_id = $current_post;
+ if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
+ $private = 1;
+ else
+ $private = $arr['private'];
+
// Set parent id - and also make sure to inherit the parent's ACL's.
$r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
- `deny_cid` = '%s', `deny_gid` = '%s' WHERE `id` = %d LIMIT 1",
+ `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d WHERE `id` = %d LIMIT 1",
intval($parent_id),
dbesc($allow_cid),
dbesc($allow_gid),
dbesc($deny_cid),
dbesc($deny_gid),
+ intval($private),
intval($current_post)
);
@@ -1256,6 +1269,9 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
if($item['coord'])
$o .= '<georss:point>' . xmlify($item['coord']) . '</georss:point>' . "\r\n";
+ if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+ $o .= '<dfrn:private>1</dfrn:private>' . "\r\n";
+
$verb = construct_verb($item);
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
$actobj = construct_activity_object($item);