aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hostxrd.php2
-rw-r--r--include/items.php2
-rw-r--r--mod/dfrn_notify.php50
3 files changed, 24 insertions, 30 deletions
diff --git a/include/hostxrd.php b/include/hostxrd.php
index f3bf9e769..3279cea68 100644
--- a/include/hostxrd.php
+++ b/include/hostxrd.php
@@ -1,6 +1,6 @@
<?php
- $tpl = load_view_file('view/xrd_host.tpl');
+ $tpl = file_get_contents('view/xrd_host.tpl');
echo str_replace('$domain',$this->hostname,$tpl);
session_write_close();
exit();
diff --git a/include/items.php b/include/items.php
index ce354de9b..ac4e694be 100644
--- a/include/items.php
+++ b/include/items.php
@@ -718,7 +718,7 @@ function consume_feed($xml,$importer,$contact, &$hub) {
);
// who is the last child now?
$r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d
- ORDER BY `edited` DESC LIMIT 1",
+ ORDER BY `created` DESC LIMIT 1",
dbesc($item['parent-uri']),
intval($importer['uid'])
);
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index d82f80df8..d657b1f88 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -54,11 +54,25 @@ function dfrn_notify_post(&$a) {
if(! count($r)) {
xml_status(3);
- return; //NOTREACHED
+ //NOTREACHED
}
$importer = $r[0];
+
+ if($importer['readonly']) {
+ // We aren't receiving stuff from this person. But we will quietly ignore them
+ // rather than a blatant "go away" message.
+ xml_status(0);
+ //NOTREACHED
+ }
+
+ // Consume notification feed. This may differ from consuming a public feed in several ways
+ // - might contain email
+ // - might contain remote followup to our message
+ // - in which case we need to accept it and then notify other conversants
+ // - we may need to send various email notifications
+
$feed = new SimplePie();
$feed->set_raw_data($data);
$feed->enable_order_by_date(false);
@@ -69,13 +83,6 @@ function dfrn_notify_post(&$a) {
$rawmail = $feed->get_feed_tags( NAMESPACE_DFRN, 'mail' );
if(isset($rawmail[0]['child'][NAMESPACE_DFRN])) {
- if($importer['readonly']) {
- // We aren't receiving email from this person. But we will quietly ignore them
- // rather than a blatant "go away" message.
- xml_status(0);
- return; //NOTREACHED
- }
-
$ismail = true;
$base = $rawmail[0]['child'][NAMESPACE_DFRN];
@@ -118,15 +125,9 @@ function dfrn_notify_post(&$a) {
$email_tpl, 'From: ' . t('Administrator') . '@' . $a->get_hostname() );
}
xml_status(0);
- return; // NOTREACHED
+ // NOTREACHED
}
- if($importer['readonly']) {
-
- xml_status(0);
- return; // NOTREACHED
- }
-
foreach($feed->get_items() as $item) {
$deleted = false;
@@ -175,7 +176,7 @@ function dfrn_notify_post(&$a) {
);
// who is the last child now?
$r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d
- ORDER BY `edited` DESC LIMIT 1",
+ ORDER BY `created` DESC LIMIT 1",
dbesc($item['parent-uri']),
intval($importer['importer_uid'])
);
@@ -198,7 +199,6 @@ function dfrn_notify_post(&$a) {
$parent_uri = $rawthread[0]['attribs']['']['ref'];
}
-
if($is_reply) {
if($feed->get_item_quantity() == 1) {
// remote reply to our post. Import and then notify everybody else.
@@ -259,7 +259,7 @@ function dfrn_notify_post(&$a) {
}
}
xml_status(0);
- return;
+ // NOTREACHED
}
else {
@@ -357,13 +357,11 @@ function dfrn_notify_post(&$a) {
$datarray['contact-id'] = $importer['id'];
$r = item_store($datarray);
continue;
-
}
-
}
xml_status(0);
- killme();
+ // NOTREACHED
}
@@ -416,8 +414,6 @@ function dfrn_notify_content(&$a) {
break; // NOTREACHED
}
-
-
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1");
if(! count($r))
@@ -439,10 +435,8 @@ function dfrn_notify_content(&$a) {
$challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id);
- echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_notify><status>' .$status . '</status><dfrn_version>2.0</dfrn_version><dfrn_id>' . $encrypted_id . '</dfrn_id>' . '<challenge>' . $challenge . '</challenge></dfrn_notify>' . "\r\n" ;
- session_write_close();
- exit;
-
+ echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_notify><status>' . $status . '</status><dfrn_version>2.0</dfrn_version><dfrn_id>' . $encrypted_id . '</dfrn_id><challenge>' . $challenge . '</challenge></dfrn_notify>' . "\r\n" ;
+ killme();
}
-} \ No newline at end of file
+}