]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_poll.php
linkify - need at least one character after ://
[friendica.git] / mod / dfrn_poll.php
index a8c27efc17e32c0077a41a889622f48fb9e1bfe4..1061cdb899d10529279b1d4b93d1f8285f3bbe2e 100644 (file)
@@ -1,11 +1,14 @@
 <?php
 
+
+
 require_once('include/items.php');
 require_once('include/auth.php');
 
 
 function dfrn_poll_init(&$a) {
 
+
        $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
        $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
        $last_update     = ((x($_GET,'last_update'))     ? $_GET['last_update']          : '');
@@ -70,6 +73,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();
@@ -96,18 +100,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];
 
@@ -131,9 +135,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");
@@ -383,6 +387,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();