]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Logger Levels
[friendica.git] / mod / dfrn_request.php
index e611458281e8e64759882786ae7ec0233651f76d..674248be2292457859accc94d63c22d6d7347bc0 100644 (file)
@@ -15,6 +15,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -57,12 +58,12 @@ function dfrn_request_init(App $a)
 function dfrn_request_post(App $a)
 {
        if (($a->argc != 2) || (!count($a->profile))) {
-               logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
+               Logger::log('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
                return;
        }
 
        if (x($_POST, 'cancel')) {
-               goaway(System::baseUrl());
+               $a->internalRedirect();
        }
 
        /*
@@ -173,9 +174,9 @@ function dfrn_request_post(App $a)
                                                Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
                                        }
 
-                                       $forwardurl = System::baseUrl() . "/contacts/" . $r[0]['id'];
+                                       $forward_path = "contact/" . $r[0]['id'];
                                } else {
-                                       $forwardurl = System::baseUrl() . "/contacts";
+                                       $forward_path = "contact";
                                }
 
                                // Allow the blocked remote notification to complete
@@ -188,14 +189,14 @@ function dfrn_request_post(App $a)
                                }
 
                                // (ignore reply, nothing we can do it failed)
-                               goaway($forwardurl);
+                               $a->internalRedirect($forward_path);
                                return; // NOTREACHED
                        }
                }
 
                // invalid/bogus request
                notice(L10n::t('Unrecoverable protocol error.') . EOL);
-               goaway(System::baseUrl());
+               $a->internalRedirect();
                return; // NOTREACHED
        }
 
@@ -297,7 +298,7 @@ function dfrn_request_post(App $a)
                        $network = Protocol::DFRN;
                }
 
-               logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
+               Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, Logger::DEBUG);
 
                if ($network === Protocol::DFRN) {
                        $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
@@ -331,19 +332,19 @@ function dfrn_request_post(App $a)
                                $url = Network::isUrlValid($url);
                                if (!$url) {
                                        notice(L10n::t('Invalid profile URL.') . EOL);
-                                       goaway(System::baseUrl() . '/' . $a->cmd);
+                                       $a->internalRedirect($a->cmd);
                                        return; // NOTREACHED
                                }
 
                                if (!Network::isUrlAllowed($url)) {
                                        notice(L10n::t('Disallowed profile URL.') . EOL);
-                                       goaway(System::baseUrl() . '/' . $a->cmd);
+                                       $a->internalRedirect($a->cmd);
                                        return; // NOTREACHED
                                }
 
                                if (Network::isUrlBlocked($url)) {
                                        notice(L10n::t('Blocked domain') . EOL);
-                                       goaway(System::baseUrl() . '/' . $a->cmd);
+                                       $a->internalRedirect($a->cmd);
                                        return; // NOTREACHED
                                }
 
@@ -351,7 +352,7 @@ function dfrn_request_post(App $a)
 
                                if (!count($parms)) {
                                        notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
-                                       goaway(System::baseUrl() . '/' . $a->cmd);
+                                       $a->internalRedirect($a->cmd);
                                } else {
                                        if (!x($parms, 'fn')) {
                                                notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
@@ -433,10 +434,10 @@ function dfrn_request_post(App $a)
                        }
 
                        // "Homecoming" - send the requestor back to their site to record the introduction.
-                       $dfrn_url = bin2hex(System::baseUrl() . '/profile/' . $nickname);
+                       $dfrn_url = bin2hex($a->getBaseURL() . '/profile/' . $nickname);
                        $aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0);
 
-                       goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"
+                       System::externalRedirect($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"
                                . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
                                . '&confirm_key=' . $hash
                                . (($aes_allow) ? "&aes_allow=1" : "")
@@ -459,11 +460,11 @@ function dfrn_request_post(App $a)
 
                                $uri = urlencode($uri);
                        } else {
-                               $uri = System::baseUrl() . '/profile/' . $nickname;
+                               $uri = 'profile/' . $nickname;
                        }
 
                        $url = str_replace('{uri}', $uri, $url);
-                       goaway($url);
+                       System::externalRedirect($url);
                        // NOTREACHED
                        // END $network != Protocol::PHANTOM
                } else {