X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FProxy.php;h=839442797ef8ed3b7a29bb3df63874266952fe7e;hb=e519b782fd2180d326ffbd9fc8f1d6fca111ce98;hp=e104073f0331e6f22cd9dfcdce9b829e39bb309a;hpb=2c56d2f3360c08e312e5c167261af8e5d4b87af4;p=friendica.git diff --git a/src/Util/Proxy.php b/src/Util/Proxy.php index e104073f03..839442797e 100644 --- a/src/Util/Proxy.php +++ b/src/Util/Proxy.php @@ -1,6 +1,6 @@ getBasePath() . '/proxy'; - $shortpath = hash('md5', $url); $longpath = substr($shortpath, 0, 2); - if (is_dir($basepath) && $writemode && !is_dir($basepath . '/' . $longpath)) { - mkdir($basepath . '/' . $longpath); - chmod($basepath . '/' . $longpath, 0777); - } - $longpath .= '/' . strtr(base64_encode($url), '+/', '-_'); // Extract the URL extension @@ -133,13 +133,8 @@ class Proxy } // Too long files aren't supported by Apache - // Writemode in combination with long files shouldn't be possible - if ((strlen($proxypath) > 250) && $writemode) { - return $shortpath; - } elseif (strlen($proxypath) > 250) { + if (strlen($proxypath) > 250) { return DI::baseUrl() . '/proxy/' . $shortpath . '?url=' . urlencode($url); - } elseif ($writemode) { - return $longpath; } else { return $proxypath . $size; } @@ -170,7 +165,7 @@ class Proxy * @return boolean * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - private static function isLocalImage($url) + public static function isLocalImage($url) { if (substr($url, 0, 1) == '/') { return true;