Bugfix: "remove_baseurl" wasn't work correct if called statically

This commit is contained in:
rabuzarus 2016-11-16 01:14:14 +01:00
parent 7729e6cfb4
commit 262a149cab

View file

@ -1041,7 +1041,7 @@ class App {
/** /**
* @brief Removes the baseurl from an url. This avoids some mixed content problems. * @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 * @return string The cleaned url
*/ */
@ -1049,13 +1049,13 @@ class App {
// Is the function called statically? // Is the function called statically?
if (!is_object($this)) { if (!is_object($this)) {
return(self::$a->remove_baseurl($url)); return(self::$a->remove_baseurl($orig_url));
} }
// Remove the hostname from the url if it is an internal link // Remove the hostname from the url if it is an internal link
$url = normalise_link($orig_url); $nurl = normalise_link($orig_url);
$base = normalise_link($this->get_baseurl()); $base = normalise_link($this->get_baseurl());
$url = str_replace($base."/", "", $url); $url = str_replace($base."/", "", $nurl);
// if it is an external link return the orignal value // if it is an external link return the orignal value
if ($url == normalise_link($orig_url)) { if ($url == normalise_link($orig_url)) {