From 2abbd81ce1760cdfd4098ae1d5cda29e608eb021 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Feb 2012 18:29:09 -0800 Subject: [PATCH] a few fixes for offsite community members --- include/delivery.php | 7 +++++++ include/items.php | 24 +++++++++++++++++++----- include/notifier.php | 10 +++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index 03199b0105..677d893889 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -312,6 +312,13 @@ function delivery_run($argv, $argc){ ); if(count($x)) { + if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) { + q("update contact set writable = 1 where id = %d limit 1", + intval($x[0]['id']) + ); + $x[0]['writable'] = 1; + } + require_once('library/simplepie/simplepie.inc'); logger('mod-delivery: local delivery'); local_delivery($x[0],$atom); diff --git a/include/items.php b/include/items.php index 5e3f9a60a2..1bf73bc360 100755 --- a/include/items.php +++ b/include/items.php @@ -999,7 +999,16 @@ function tag_deliver($uid,$item_id) { // now change this copy of the post to a forum head message and deliver to all the tgroup members - q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", + $c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1", + intval($u[0]['uid']) + ); + if(! count($c)) + return; + + q("update item set wall = 1, origin = 1, forum_mode = 1, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s' where id = %d limit 1", + dbesc($c[0]['name']), + dbesc($c[0]['url']), + dbesc($c[0]['thumb']), intval($item_id) ); @@ -1016,8 +1025,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $a = get_app(); - if((! strlen($contact['issued-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY))) - return 3; +// if((! strlen($contact['issued-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY))) +// return 3; $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); @@ -1068,7 +1077,9 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $final_dfrn_id = ''; - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { + if(($contact['duplex'] && strlen($contact['pubkey'])) + || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey'])) + || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) { openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); } @@ -1111,7 +1122,10 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if($dfrn_version >= 2.1) { - if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) { + if(($contact['duplex'] && strlen($contact['pubkey'])) + || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey'])) + || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) { + openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); } else { diff --git a/include/notifier.php b/include/notifier.php index 70fd1d52c9..37bc6dae51 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -264,7 +264,7 @@ function notifier_run($argv, $argc){ $deny_people = expand_acl($parent['deny_cid']); $deny_groups = expand_groups(expand_acl($parent['deny_gid'])); - // if our parent is a forum, uplink to the origonal author causing + // if our parent is a forum, uplink to the origional author causing // a delivery fork if(intval($parent['forum_mode']) && (! $top_level) && ($cmd !== 'uplink')) { @@ -526,6 +526,14 @@ function notifier_run($argv, $argc){ ); if(count($x)) { + + if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) { + q("update contact set writable = 1 where id = %d limit 1", + intval($x[0]['id']) + ); + $x[0]['writable'] = 1; + } + require_once('library/simplepie/simplepie.inc'); logger('mod-delivery: local delivery'); local_delivery($x[0],$atom);