diff options
author | Friendika <info@friendika.com> | 2011-08-15 17:14:51 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-08-15 17:14:51 -0700 |
commit | 44918e27367d00d3625daaf751a05b166ecd2fc1 (patch) | |
tree | fe6789952ea48673924f2d83c6a217185c908c7c | |
parent | 805770521eebdd0bc6ddfb2f174a76e0646557fc (diff) | |
download | volse-hubzilla-44918e27367d00d3625daaf751a05b166ecd2fc1.tar.gz volse-hubzilla-44918e27367d00d3625daaf751a05b166ecd2fc1.tar.bz2 volse-hubzilla-44918e27367d00d3625daaf751a05b166ecd2fc1.zip |
turn diaspora posts into x-www-form-urlencoded
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/diaspora.php | 14 | ||||
-rw-r--r-- | mod/receive.php | 18 |
3 files changed, 18 insertions, 16 deletions
@@ -7,7 +7,7 @@ require_once('include/text.php'); require_once("include/pgettext.php"); -define ( 'FRIENDIKA_VERSION', '2.2.1072' ); +define ( 'FRIENDIKA_VERSION', '2.2.1073' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1079 ); diff --git a/include/diaspora.php b/include/diaspora.php index 74aa32f5c..dd0debe69 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -533,12 +533,9 @@ function diaspora_share($me,$contact) { '$recipient' => $theiraddr )); - $slap = diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey']); + $slap = 'xml=' . urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey'])); - post_url($contact['notify'],$slap, array( - 'Content-type: application/magic-envelope+xml', - 'Content-length: ' . strlen($slap) - )); + post_url($contact['notify'],$slap); $return_code = $a->get_curl_code(); return $return_code; } @@ -567,12 +564,9 @@ function diaspora_send_status($item,$owner,$contact) { logger('diaspora_send_status: base message: ' . $msg, LOGGER_DATA); - $slap = diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey']); + $slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])); - post_url($contact['notify'],$slap, array( - 'Content-type: application/magic-envelope+xml', - 'Content-length: ' . strlen($slap) - )); + post_url($contact['notify'],$slap); $return_code = $a->get_curl_code(); logger('diaspora_send_status: returns: ' . $return_code); return $return_code; diff --git a/mod/receive.php b/mod/receive.php index 43f8c7bbc..46b1f2745 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -26,6 +26,9 @@ function receive_post(&$a) { $importer = $r[0]; + // I really don't know why we need urldecode - PHP should be doing this for us. + // It is an application/x-www-form-urlencoded + $xml = urldecode($_POST['xml']); logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA); @@ -34,6 +37,9 @@ function receive_post(&$a) { http_status_exit(500); $msg = diaspora_decode($importer,$xml); + + logger('mod-diaspora: decoded msg: ' . $msg, LOGGER_DATA); + if(! $msg) http_status_exit(500); @@ -58,21 +64,23 @@ function receive_post(&$a) { // is this a follower? Or have we ignored the person? // If so we can not accept this post. // However we will accept a sharing e.g. friend request + // or a retraction of same. - if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { - if(! $xmlbase->request) { + + $allow_blocked = (($xmlbase->request || ($xmlbase->retraction && $xmlbase->retraction->type == 'Person')) ? true : false); + + if((count($r)) + && (($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']) || ($r[0]['readonly'])) + && (! $allow_blocked)) { logger('mod-diaspora: Ignoring this author.'); http_status_exit(202); // NOTREACHED - } } require_once('include/items.php'); $contact = ((count($r)) ? $r[0] : null); - logger('diaspora msg: ' . $msg, LOGGER_DATA); - if($xmlbase->request) { diaspora_request($importer,$contact,$xmlbase->request); } |