]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Bugfix: "remove_baseurl" accidentally normalized all links
[friendica.git] / boot.php
index 74609b89685801c52db655bf833e0d96b0a7f045..230cbc1e3a43a7f24fe1a10f6cff3ed2dddc3518 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1045,16 +1045,24 @@ class App {
         *
         * @return string The cleaned url
         */
-       function remove_baseurl($url){
+       function remove_baseurl($orig_url){
 
                // Is the function called statically?
-               if (!is_object($this))
+               if (!is_object($this)) {
                        return(self::$a->remove_baseurl($url));
+               }
 
-               $url = normalise_link($url);
+               // Remove the hostname from the url if it is an internal link
+               $url = normalise_link($orig_url);
                $base = normalise_link($this->get_baseurl());
                $url = str_replace($base."/", "", $url);
-               return $url;
+
+               // if it is an external link return the orignal value
+               if ($url == normalise_link($orig_url)) {
+                       return $orig_url;
+               } else {
+                       return $url;
+               }
        }
 
        /**
@@ -1377,7 +1385,7 @@ class App {
        function proc_run($args) {
 
                // Add the php path if it is a php call
-               if (count($args) && ($args[0] === 'php' OR is_int($args[0]))) {
+               if (count($args) && ($args[0] === 'php' OR !is_string($args[0]))) {
 
                        // If the last worker fork was less than 10 seconds before then don't fork another one.
                        // This should prevent the forking of masses of workers.