]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Proxy.php
Merge pull request #6340 from MrPetovan/bug/1495-fix-admin-theme-settings
[friendica.git] / src / Util / Proxy.php
index bb26185f4656595098ff47f6983badbd09a19d3e..be70077f15d98b7eb4d14d40a7c71db193a2f4d3 100644 (file)
@@ -6,8 +6,7 @@ use Friendica\BaseModule;
 use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Core\System;
-
-require_once 'include/security.php';
+use Friendica\Util\Strings;
 
 /**
  * @brief Proxy utilities class
@@ -78,7 +77,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;
                }
 
@@ -91,7 +90,7 @@ class Proxy
                $url = html_entity_decode($url, ENT_NOQUOTES, 'utf-8');
 
                // Creating a sub directory to reduce the amount of files in the cache directory
-               $basepath = $a->get_basepath() . '/proxy';
+               $basepath = $a->getBasePath() . '/proxy';
 
                $shortpath = hash('md5', $url);
                $longpath = substr($shortpath, 0, 2);
@@ -142,7 +141,7 @@ class Proxy
         */
        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('/(<img [^>]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html);
        }
@@ -164,8 +163,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);
        }
@@ -180,16 +179,8 @@ class Proxy
        {
                $query = parse_url($url, PHP_URL_QUERY);
                $query = html_entity_decode($query);
-               $query_list = explode('&', $query);
-
-               $arr = [];
-
-               foreach ($query_list as $key_value) {
-                       $key_value_list = explode('=', $key_value);
-                       $arr[$key_value_list[0]] = $key_value_list[1];
-               }
 
-               unset($url, $query_list, $url);
+               parse_str($query, $arr);
 
                return $arr;
        }