]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_poll.php
Fixes:
[friendica.git] / mod / dfrn_poll.php
index 7d5418c364533b4f27c073b9e3dfe0822453bca7..fa9ad13f5679d1b0b4978d3232818c5409853fe1 100644 (file)
@@ -3,10 +3,12 @@
 /**
  * @file mod/dfrn_poll.php
  */
+
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Module\Login;
 use Friendica\Protocol\DFRN;
@@ -119,6 +121,7 @@ function dfrn_poll_init(App $a)
                                        $_SESSION['visitor_home'] = $r[0]['url'];
                                        $_SESSION['visitor_handle'] = $r[0]['addr'];
                                        $_SESSION['visitor_visiting'] = $r[0]['uid'];
+                                       $_SESSION['my_url'] = $r[0]['url'];
                                        if (!$quiet) {
                                                info(L10n::t('%1$s welcomes %2$s', $r[0]['username'], $r[0]['name']) . EOL);
                                        }
@@ -140,7 +143,7 @@ function dfrn_poll_init(App $a)
 
        if ($type === 'profile-check' && $dfrn_version < 2.2) {
                if ((strlen($challenge)) && (strlen($sec))) {
-                       q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
                                dbesc($sec)
                        );
@@ -205,7 +208,7 @@ function dfrn_poll_init(App $a)
                                        break;
                        }
 
-                       q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
                                dbesc($dfrn_id));
                        if (DBM::is_result($r)) {
@@ -232,7 +235,7 @@ function dfrn_poll_post(App $a)
                if (strlen($challenge) && strlen($sec)) {
                        logger('dfrn_poll: POST: profile-check');
 
-                       q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
+                       DBA::delete('profile_check', ["`expire` < ?", time()]);
                        $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
                                dbesc($sec)
                        );
@@ -305,11 +308,7 @@ function dfrn_poll_post(App $a)
        $type = $r[0]['type'];
        $last_update = $r[0]['last_update'];
 
-       $r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s'",
-               dbesc($dfrn_id),
-               dbesc($challenge)
-       );
-
+       DBA::delete('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge]);
 
        $sql_extra = '';
        switch ($direction) {
@@ -414,7 +413,7 @@ function dfrn_poll_content(App $a)
 
                $status = 0;
 
-               $r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
+               DBA::delete('challenge', ["`expire` < ?", time()]);
 
                if ($type !== 'profile') {
                        $r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
@@ -539,6 +538,7 @@ function dfrn_poll_content(App $a)
                                        $_SESSION['visitor_id'] = $r[0]['id'];
                                        $_SESSION['visitor_home'] = $r[0]['url'];
                                        $_SESSION['visitor_visiting'] = $r[0]['uid'];
+                                       $_SESSION['my_url'] = $r[0]['url'];
                                        if (!$quiet) {
                                                info(L10n::t('%1$s welcomes %2$s', $r[0]['username'], $r[0]['name']) . EOL);
                                        }