From a3edbf7e5d0d89e99c2249cf30657b1fbc57982a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 28 Jun 2012 17:43:29 -0700 Subject: [PATCH] create third privacy state - public post but not searchable or publicly visible --- include/conversation.php | 12 ++++++------ include/delivery.php | 4 ++-- include/items.php | 10 +++++----- include/notifier.php | 2 +- include/text.php | 5 +++-- mod/events.php | 2 +- mod/item.php | 2 +- mod/lockview.php | 2 +- mod/share.php | 2 +- 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index c2113dead4..f2fb2e97b4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -427,12 +427,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { // We've already parsed out like/dislike for special treatment. We can ignore them now if(((activity_match($item['verb'],ACTIVITY_LIKE)) - || (activity_match($item['verb'],ACTIVITY_DISLIKE)))) -// && ($item['id'] != $item['parent'])) + || (activity_match($item['verb'],ACTIVITY_DISLIKE))) + && ($item['id'] != $item['parent'])) continue; $toplevelpost = (($item['id'] == $item['parent']) ? true : false); - $toplevelprivate = false; + // Take care of author collapsing and comment collapsing // (author collapsing is currently disabled) @@ -440,7 +440,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { // If there are more than two comments, squash all but the last 2. if($toplevelpost) { - $toplevelprivate = (($toplevelpost && $item['private']) ? true : false); + $item_writeable = (($item['writable'] || $item['self']) ? true : false); $comments_seen = 0; @@ -485,7 +485,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ; - $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? t('Private Message') : false); @@ -546,7 +546,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { } $likebuttons = ''; - $shareable = ((($profile_owner == local_user()) && ((! $item['private']) || $item['network'] === NETWORK_FEED)) ? true : false); + $shareable = ((($profile_owner == local_user()) && (! $item['private'] == 1)) ? true : false); if($page_writeable) { /* if($toplevelpost) { */ diff --git a/include/delivery.php b/include/delivery.php index 8152876683..1328771a67 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -280,7 +280,7 @@ function delivery_run($argv, $argc){ continue; // private emails may be in included in public conversations. Filter them. - if(($public_message) && $item['private']) + if(($public_message) && $item['private'] == 1) continue; $item_contact = get_item_contact($item,$icontacts); @@ -383,7 +383,7 @@ function delivery_run($argv, $argc){ continue; // private emails may be in included in public conversations. Filter them. - if(($public_message) && $item['private']) + if(($public_message) && $item['private'] == 1) continue; $item_contact = get_item_contact($item,$icontacts); diff --git a/include/items.php b/include/items.php index 7d3ed4fa9d..494a547341 100755 --- a/include/items.php +++ b/include/items.php @@ -466,8 +466,8 @@ function get_atom_elements($feed,$item) { $res['last-child'] = 0; $private = $item->get_item_tags(NAMESPACE_DFRN,'private'); - if($private && $private[0]['data'] == 1) - $res['private'] = 1; + if($private && intval($private[0]['data']) > 0) + $res['private'] = intval($private[0]['data']); else $res['private'] = 0; @@ -814,7 +814,7 @@ function item_store($arr,$force_parent = false) { // email correspondents to be private even if the overall thread is not. if($r[0]['private']) - $arr['private'] = 1; + $arr['private'] = $r[0]['private']; // Edge case. We host a public forum that was originally posted to privately. // The original author commented, but as this is a comment, the permissions @@ -1890,7 +1890,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) $datarray['last-child'] = 0; } if($contact['network'] === NETWORK_FEED) - $datarray['private'] = 1; + $datarray['private'] = 2; // This is my contact on another system, but it's really me. // Turn this into a wall post. @@ -3035,7 +3035,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { $o .= '' . xmlify($item['coord']) . '' . "\r\n"; if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - $o .= '1' . "\r\n"; + $o .= '' . (($item['private']) ? $item['private'] : 1) . '' . "\r\n"; if($item['extid']) $o .= '' . xmlify($item['extid']) . '' . "\r\n"; diff --git a/include/notifier.php b/include/notifier.php index 443cc30141..f54efba31d 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -399,7 +399,7 @@ function notifier_run($argv, $argc){ // private emails may be in included in public conversations. Filter them. - if(($public_message) && $item['private']) + if(($public_message) && $item['private'] == 1) continue; diff --git a/include/text.php b/include/text.php index 0b3ebdf854..3b0050d387 100644 --- a/include/text.php +++ b/include/text.php @@ -1059,12 +1059,13 @@ function feed_salmonlinks($nick) { if(! function_exists('get_plink')) { function get_plink($item) { $a = get_app(); - if (x($item,'plink') && ((! $item['private']) || ($item['network'] === NETWORK_FEED))){ + if (x($item,'plink') && ($item['private'] != 1)) { return array( 'href' => $item['plink'], 'title' => t('link to source'), ); - } else { + } + else { return false; } }} diff --git a/mod/events.php b/mod/events.php index 4a6d3f100e..7940e79a42 100755 --- a/mod/events.php +++ b/mod/events.php @@ -120,7 +120,7 @@ function events_post(&$a) { $datarray['allow_gid'] = $str_group_allow; $datarray['deny_cid'] = $str_contact_deny; $datarray['deny_gid'] = $str_group_deny; - $datarray['private'] = $private_event; + $datarray['private'] = (($private_event) ? 1 : 0); $datarray['id'] = $event_id; $datarray['created'] = $created; $datarray['edited'] = $edited; diff --git a/mod/item.php b/mod/item.php index aa022d37d8..554e97fe46 100644 --- a/mod/item.php +++ b/mod/item.php @@ -228,7 +228,7 @@ function item_post(&$a) { || strlen($parent_item['allow_gid']) || strlen($parent_item['deny_cid']) || strlen($parent_item['deny_gid'])) { - $private = 1; + $private = (($parent_item['private']) ? $parent_item['private'] : 1); } $str_contact_allow = $parent_item['allow_cid']; diff --git a/mod/lockview.php b/mod/lockview.php index 9e64e2608b..a832629f19 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -33,7 +33,7 @@ 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'])) + if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) { echo t('Remote privacy information not available.') . '
'; diff --git a/mod/share.php b/mod/share.php index 08c63105e3..29d31f6b51 100644 --- a/mod/share.php +++ b/mod/share.php @@ -15,7 +15,7 @@ function share_init(&$a) { intval($post_id), intval(local_user()) ); - if(! count($r) || ($r[0]['private'] && ($r[0]['network'] != NETWORK_FEED))) + if(! count($r) || ($r[0]['private'] == 1)) killme(); $o = ''; -- 2.39.5