]> git.mxchange.org Git - friendica.git/blobdiff - mod/redir.php
Merge pull request #6225 from annando/http-error
[friendica.git] / mod / redir.php
index 088a5f55e30754ddf34d4c273dd4b5a00b4b956c..9f579a9dc445f3657fb2a3b6e2b249713d2174f3 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
+use Friendica\Util\Strings;
 
 function redir_init(App $a) {
 
@@ -42,7 +43,7 @@ function redir_init(App $a) {
 
                if ($contact['uid'] == 0 && local_user()) {
                        // Let's have a look if there is an established connection
-                       // between the puplic contact we have found and the local user.
+                       // between the public contact we have found and the local user.
                        $contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
 
                        if (DBA::isResult($contact)) {
@@ -66,7 +67,7 @@ function redir_init(App $a) {
                        // for authentification everytime he/she is visiting a profile page of the local
                        // contact.
                        if ($host == $remotehost
-                               && x($_SESSION, 'remote')
+                               && !empty($_SESSION['remote'])
                                && is_array($_SESSION['remote']))
                        {
                                foreach ($_SESSION['remote'] as $v) {
@@ -93,7 +94,7 @@ function redir_init(App $a) {
                                $dfrn_id = '0:' . $orig_id;
                        }
 
-                       $sec = random_string();
+                       $sec = Strings::getRandomHex();
 
                        $fields = ['uid' => local_user(), 'cid' => $cid, 'dfrn_id' => $dfrn_id,
                                'sec' => $sec, 'expire' => time() + 45];
@@ -115,7 +116,7 @@ function redir_init(App $a) {
        if (!empty($url)) {
                $my_profile = Profile::getMyURL();
 
-               if (!empty($my_profile) && !link_compare($my_profile, $url)) {
+               if (!empty($my_profile) && !Strings::compareLink($my_profile, $url)) {
                        $separator = strpos($url, '?') ? '&' : '?';
 
                        $url .= $separator . 'zrl=' . urlencode($my_profile);