]> git.mxchange.org Git - friendica.git/commitdiff
xrd cannot be called before db is open to get language
authorMike Macgirvin <mike@macgirvin.com>
Mon, 4 Oct 2010 11:22:34 +0000 (04:22 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 4 Oct 2010 11:22:34 +0000 (04:22 -0700)
include/hostxrd.php
include/items.php
mod/dfrn_notify.php

index f3bf9e769d593742f33101b4ee34743f133796ce..3279cea68e305934e95ba684216af966bd8786a2 100644 (file)
@@ -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();
index ce354de9b3c7ed8cfa7de6fe683e0f7cedd8f597..ac4e694beb9ee5afc421ec8a008cfabd3da8b9bd 100644 (file)
@@ -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'])
                                                        );
index d82f80df8b2763cba568c5132b5427d4d3dd1f10..d657b1f88e957c6767096355c197893534ffffe9 100644 (file)
@@ -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
+}