X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FProxy.php;h=9309887409eb423e06675f5c8ca871411f23bd83;hb=cc8a6c85ae939c0fc9258d7a11276bc7c2e59bc0;hp=0bb7537f78bda42a52edb9535d43a4eea453ab7a;hpb=67afa069abc97e3e00b78993a92881dc4afde9d7;p=friendica.git diff --git a/src/Util/Proxy.php b/src/Util/Proxy.php index 0bb7537f78..9309887409 100644 --- a/src/Util/Proxy.php +++ b/src/Util/Proxy.php @@ -2,13 +2,10 @@ namespace Friendica\Util; -use Friendica\BaseModule; use Friendica\BaseObject; use Friendica\Core\Config; use Friendica\Core\System; -require_once 'include/security.php'; - /** * @brief Proxy utilities class */ @@ -61,6 +58,7 @@ class Proxy * @param string $size One of the ProxyUtils::SIZE_* constants * * @return string The proxyfied URL or relative path + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function proxifyUrl($url, $writemode = false, $size = '') { @@ -78,7 +76,7 @@ class Proxy // Only continue if it isn't a local image and the isn't deactivated if (self::isLocalImage($url)) { - $url = str_replace(normalise_link(System::baseUrl()) . '/', System::baseUrl() . '/', $url); + $url = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $url); return $url; } @@ -139,10 +137,11 @@ class Proxy * @param string $html Un-proxified HTML code * * @return string Proxified HTML code + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function proxifyHtml($html) { - $html = str_replace(normalise_link(System::baseUrl()) . '/', System::baseUrl() . '/', $html); + $html = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $html); return preg_replace_callback('/(]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html); } @@ -152,6 +151,7 @@ class Proxy * * @param string $url * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function isLocalImage($url) { @@ -164,8 +164,8 @@ class Proxy } // links normalised - bug #431 - $baseurl = normalise_link(System::baseUrl()); - $url = normalise_link($url); + $baseurl = Strings::normaliseLink(System::baseUrl()); + $url = Strings::normaliseLink($url); return (substr($url, 0, strlen($baseurl)) == $baseurl); } @@ -191,6 +191,7 @@ class Proxy * * @param array $matches Matches from preg_replace_callback() * @return string Proxified HTML image tag + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function replaceUrl(array $matches) {