mirror of
https://github.com/friendica/friendica
synced 2024-12-23 17:20:16 +00:00
turn diaspora posts into x-www-form-urlencoded
This commit is contained in:
parent
805770521e
commit
44918e2736
3 changed files with 18 additions and 16 deletions
2
boot.php
2
boot.php
|
@ -7,7 +7,7 @@ require_once('include/text.php');
|
||||||
require_once("include/pgettext.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 ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1079 );
|
define ( 'DB_UPDATE_VERSION', 1079 );
|
||||||
|
|
||||||
|
|
|
@ -533,12 +533,9 @@ function diaspora_share($me,$contact) {
|
||||||
'$recipient' => $theiraddr
|
'$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(
|
post_url($contact['notify'],$slap);
|
||||||
'Content-type: application/magic-envelope+xml',
|
|
||||||
'Content-length: ' . strlen($slap)
|
|
||||||
));
|
|
||||||
$return_code = $a->get_curl_code();
|
$return_code = $a->get_curl_code();
|
||||||
return $return_code;
|
return $return_code;
|
||||||
}
|
}
|
||||||
|
@ -567,12 +564,9 @@ function diaspora_send_status($item,$owner,$contact) {
|
||||||
|
|
||||||
logger('diaspora_send_status: base message: ' . $msg, LOGGER_DATA);
|
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(
|
post_url($contact['notify'],$slap);
|
||||||
'Content-type: application/magic-envelope+xml',
|
|
||||||
'Content-length: ' . strlen($slap)
|
|
||||||
));
|
|
||||||
$return_code = $a->get_curl_code();
|
$return_code = $a->get_curl_code();
|
||||||
logger('diaspora_send_status: returns: ' . $return_code);
|
logger('diaspora_send_status: returns: ' . $return_code);
|
||||||
return $return_code;
|
return $return_code;
|
||||||
|
|
|
@ -26,6 +26,9 @@ function receive_post(&$a) {
|
||||||
|
|
||||||
$importer = $r[0];
|
$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']);
|
$xml = urldecode($_POST['xml']);
|
||||||
|
|
||||||
logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
|
logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
|
||||||
|
@ -34,6 +37,9 @@ function receive_post(&$a) {
|
||||||
http_status_exit(500);
|
http_status_exit(500);
|
||||||
|
|
||||||
$msg = diaspora_decode($importer,$xml);
|
$msg = diaspora_decode($importer,$xml);
|
||||||
|
|
||||||
|
logger('mod-diaspora: decoded msg: ' . $msg, LOGGER_DATA);
|
||||||
|
|
||||||
if(! $msg)
|
if(! $msg)
|
||||||
http_status_exit(500);
|
http_status_exit(500);
|
||||||
|
|
||||||
|
@ -58,21 +64,23 @@ function receive_post(&$a) {
|
||||||
// is this a follower? Or have we ignored the person?
|
// is this a follower? Or have we ignored the person?
|
||||||
// If so we can not accept this post.
|
// If so we can not accept this post.
|
||||||
// However we will accept a sharing e.g. friend request
|
// 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.');
|
logger('mod-diaspora: Ignoring this author.');
|
||||||
http_status_exit(202);
|
http_status_exit(202);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
|
|
||||||
$contact = ((count($r)) ? $r[0] : null);
|
$contact = ((count($r)) ? $r[0] : null);
|
||||||
|
|
||||||
logger('diaspora msg: ' . $msg, LOGGER_DATA);
|
|
||||||
|
|
||||||
if($xmlbase->request) {
|
if($xmlbase->request) {
|
||||||
diaspora_request($importer,$contact,$xmlbase->request);
|
diaspora_request($importer,$contact,$xmlbase->request);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue