aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dfrn_poll.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-10-12 20:29:04 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-10-12 20:29:04 -0700
commit033935c19406c8468ed75fdd15a3a532f4e25319 (patch)
treead73289f296bf14d6cc6977e41af88fd2f1909d6 /mod/dfrn_poll.php
parent3c440f70c66953735d01841453fa6a7ed244ef1c (diff)
downloadvolse-hubzilla-033935c19406c8468ed75fdd15a3a532f4e25319.tar.gz
volse-hubzilla-033935c19406c8468ed75fdd15a3a532f4e25319.tar.bz2
volse-hubzilla-033935c19406c8468ed75fdd15a3a532f4e25319.zip
cleanup to ensure protocol version is passed properly. We will need it if/when any incompatible protocol changes are introduced.
Diffstat (limited to 'mod/dfrn_poll.php')
-rw-r--r--mod/dfrn_poll.php29
1 files changed, 18 insertions, 11 deletions
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index a65f6555d..f5a761983 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -14,7 +14,7 @@ function dfrn_poll_init(&$a) {
$type = $_GET['type'];
if(x($_GET,'last_update'))
$last_update = $_GET['last_update'];
- $dfrn_version = ((x($_GET,'dfrn_version')) ? $_GET['dfrn_version'] : '1.0');
+ $dfrn_version = (float) $_GET['dfrn_version'] ;
$destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : '');
@@ -115,11 +115,12 @@ function dfrn_poll_init(&$a) {
function dfrn_poll_post(&$a) {
- $dfrn_id = $_POST['dfrn_id'];
- $challenge = $_POST['challenge'];
- $url = $_POST['url'];
+ $dfrn_id = $_POST['dfrn_id'];
+ $challenge = $_POST['challenge'];
+ $url = $_POST['url'];
+ $dfrn_version = (float) $_POST['dfrn_version'];
- $direction = (-1);
+ $direction = (-1);
if(strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
@@ -199,7 +200,7 @@ function dfrn_poll_post(&$a) {
</reputation>
";
killme();
- return; // NOTREACHED
+ // NOTREACHED
}
else {
$o = get_feed_for($a,$dfrn_id, $a->argv[1], $last_update, $direction);
@@ -222,6 +223,8 @@ function dfrn_poll_content(&$a) {
if(x($_GET,'last_update'))
$last_update = $_GET['last_update'];
+ $dfrn_version = (float) $_GET['dfrn_version'];
+
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
@@ -293,11 +296,15 @@ function dfrn_poll_content(&$a) {
else {
$status = 1;
}
-
- echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_poll><status>' .$status . '</status><dfrn_version>2.0</dfrn_version><dfrn_id>' . $encrypted_id . '</dfrn_id>'
- . '<challenge>' . $challenge . '</challenge></dfrn_poll>' . "\r\n" ;
- session_write_close();
- exit;
+ header("Content-type: text/xml");
+ echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n"
+ . '<dfrn_poll>' . "\r\n"
+ . "\t" . '<status>' .$status . '</status>' . "\r\n"
+ . "\t" . '<dfrn_version>' . DFRN_PROTOCOL_VERSION . '</dfrn_version>' . "\r\n"
+ . "\t" . '<dfrn_id>' . $encrypted_id . '</dfrn_id>' . "\r\n"
+ . "\t" . '<challenge>' . $challenge . '</challenge>' . "\r\n"
+ . '</dfrn_poll>' . "\r\n" ;
+ killme();
}
}