]> git.mxchange.org Git - friendica.git/commitdiff
Improved url detection for redirects
authorMichael <heluecht@pirati.ca>
Fri, 30 Nov 2018 11:27:17 +0000 (11:27 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 30 Nov 2018 11:27:17 +0000 (11:27 +0000)
src/App.php
src/Module/Magic.php

index 845560a4d676df27d4d3548eb8d1b88b1123bd15..9af56680e0869e15c62a15003fdb2b232cc835d9 100644 (file)
@@ -1880,7 +1880,7 @@ class App
         */
        public function internalRedirect($toUrl = '', $ssl = false)
        {
-               if (filter_var($toUrl, FILTER_VALIDATE_URL)) {
+               if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) {
                        throw new InternalServerErrorException("'$toUrl is not a relative path, please use System::externalRedirectTo");
                }
 
@@ -1897,7 +1897,7 @@ class App
         */
        public function redirect($toUrl)
        {
-               if (filter_var($toUrl, FILTER_VALIDATE_URL)) {
+               if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) {
                        Core\System::externalRedirect($toUrl);
                } else {
                        $this->internalRedirect($toUrl);
index ecfe18e596b528b3587af7be1ae9b06b7201663a..694af23208fb025d3b74266272def9ab560748bf 100644 (file)
@@ -43,7 +43,7 @@ class Magic extends BaseModule
                }
 
                if (!$cid) {
-                       Logger::log('No contact record found: ' . print_r($_REQUEST, true), Logger::DEBUG);
+                       Logger::log('No contact record found: ' . json_encode($_REQUEST), Logger::DEBUG);
                        // @TODO Finding a more elegant possibility to redirect to either internal or external URL
                        $a->redirect($dest);
                }