]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Removed commented code
[friendica.git] / boot.php
index 88f7ad7829fff1e30d40290b2794d2834fd089a1..7e76df87e36c0b2fed34f19e39ea5b31a257fdee 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1041,20 +1041,28 @@ class App {
        /**
         * @brief Removes the baseurl from an url. This avoids some mixed content problems.
         *
-        * @param string $url
+        * @param string $orig_url
         *
         * @return string The cleaned url
         */
-       function remove_baseurl($url){
+       function remove_baseurl($orig_url){
 
                // Is the function called statically?
-               if (!is_object($this))
-                       return(self::$a->remove_baseurl($url));
+               if (!is_object($this)) {
+                       return(self::$a->remove_baseurl($orig_url));
+               }
 
-               $url = normalise_link($url);
+               // Remove the hostname from the url if it is an internal link
+               $nurl = normalise_link($orig_url);
                $base = normalise_link($this->get_baseurl());
-               $url = str_replace($base."/", "", $url);
-               return $url;
+               $url = str_replace($base."/", "", $nurl);
+
+               // if it is an external link return the orignal value
+               if ($url == normalise_link($orig_url)) {
+                       return $orig_url;
+               } else {
+                       return $url;
+               }
        }
 
        /**