]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_poll.php
Merge commit 'mike/master'
[friendica.git] / mod / dfrn_poll.php
index 22d2ee40fb7a4cd4fee037caeb44fd8367ad2eb0..334e103079da11956134602988bceaabdd183a1a 100644 (file)
@@ -26,8 +26,9 @@ function dfrn_poll_init(&$a) {
        }
 
        if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
+               logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] );
                header("Content-type: application/atom+xml");
-               $o = get_feed_for($a, '*', $a->argv[1],$last_update);
+               $o = get_feed_for($a, '', $a->argv[1],$last_update);
                echo $o;
                killme();
        }
@@ -73,6 +74,7 @@ function dfrn_poll_init(&$a) {
                                if((int) $xml->status == 1) {
                                        $_SESSION['authenticated'] = 1;
                                        $_SESSION['visitor_id'] = $r[0]['id'];
+                                       $_SESSION['visitor_home'] = $r[0]['url'];
                                        notice( $r[0]['username'] . t(' welcomes ') . $r[0]['name'] . EOL);
                                        // Visitors get 1 day session.
                                        $session_id = session_id();
@@ -99,18 +101,18 @@ function dfrn_poll_init(&$a) {
                                dbesc($sec)
                        );
                        if(! count($r)) {
-                               xml_status(3);
+                               xml_status(3, 'No ticket');
                                // NOTREACHED
                        }
                        $orig_id = $r[0]['dfrn_id'];
-                       if(strpos(':',$orig_id))
+                       if(strpos($orig_id, ':'))
                                $orig_id = substr($orig_id,2);
 
                        $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                                intval($r[0]['cid'])
                        );
                        if(! count($c)) {
-                               xml_status(3);
+                               xml_status(3, 'No profile');
                        }
                        $contact = $c[0];
 
@@ -134,9 +136,9 @@ function dfrn_poll_init(&$a) {
                                $final_dfrn_id = substr($final_dfrn_id,2);
 
                        if($final_dfrn_id != $orig_id) {
-
+                               logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
                                // did not decode properly - cannot trust this site 
-                               xml_status(3);
+                               xml_status(3, 'Bad decryption');
                        }
 
                        header("Content-type: text/xml");
@@ -386,6 +388,7 @@ function dfrn_poll_content(&$a) {
                                if(((int) $xml->status == 0) && ($xml->challenge == $hash)  && ($xml->sec == $sec)) {
                                        $_SESSION['authenticated'] = 1;
                                        $_SESSION['visitor_id'] = $r[0]['id'];
+                                       $_SESSION['visitor_home'] = $r[0]['url'];
                                        notice( $r[0]['username'] . t(' welcomes ') . $r[0]['name'] . EOL);
                                        // Visitors get 1 day session.
                                        $session_id = session_id();