aboutsummaryrefslogtreecommitdiffstats
path: root/mod
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 /mod
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 'mod')
-rw-r--r--mod/display.php4
-rw-r--r--mod/item.php12
-rw-r--r--mod/lockview.php7
-rw-r--r--mod/network.php6
-rw-r--r--mod/profile.php4
5 files changed, 23 insertions, 10 deletions
diff --git a/mod/display.php b/mod/display.php
index 92034d9ae..ec036de62 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -142,8 +142,8 @@ function display_content(&$a) {
&& ($item['id'] != $item['parent']))
continue;
- $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
- || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+ $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+ || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');
diff --git a/mod/item.php b/mod/item.php
index 504856d7d..ea88e6c31 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -53,6 +53,8 @@ function item_post(&$a) {
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
+ $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
+
$title = notags(trim($_POST['title']));
$body = escape_tags(trim($_POST['body']));
$location = notags(trim($_POST['location']));
@@ -195,8 +197,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`,
- `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
- VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private` )
+ VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
intval($profile_uid),
dbesc($post_type),
intval($wall),
@@ -222,7 +224,8 @@ function item_post(&$a) {
dbesc($str_contact_allow),
dbesc($str_group_allow),
dbesc($str_contact_deny),
- dbesc($str_group_deny)
+ dbesc($str_group_deny),
+ intval($private)
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri));
@@ -241,12 +244,13 @@ function item_post(&$a) {
// Inherit ACL's from the parent item.
// TODO merge with subsequent UPDATE operation and save a db write
- $r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
+ $r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d
WHERE `id` = %d LIMIT 1",
dbesc($parent_item['allow_cid']),
dbesc($parent_item['allow_gid']),
dbesc($parent_item['deny_cid']),
dbesc($parent_item['deny_gid']),
+ intval($parent_item['private']),
intval($post_id)
);
diff --git a/mod/lockview.php b/mod/lockview.php
index b8f4318df..a886effeb 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -22,6 +22,13 @@ function lockview_content(&$a) {
$deny_users = expand_acl($item['deny_cid']);
$deny_groups = expand_acl($item['deny_gid']);
+ if(($item['private']) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
+ && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
+
+ echo t('Remote privacy information not available.') . '<br />';
+ killme();
+ }
+
$o = t('Visible to:') . '<br />';
$l = array();
diff --git a/mod/network.php b/mod/network.php
index 7a81fd1a2..c52bb74fc 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -165,11 +165,13 @@ function network_content(&$a, $update = 0) {
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
continue;
- $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
- || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+
+ $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+ || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');
+
// Top-level wall post not written by the wall owner (wall-to-wall)
// First figure out who owns it.
diff --git a/mod/profile.php b/mod/profile.php
index 9bd56044e..d09e0187b 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -305,8 +305,8 @@ function profile_content(&$a, $update = 0) {
&& ($item['id'] != $item['parent']))
continue;
- $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
- || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+ $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+ || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');