X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FProxy.php;h=29e0f4f52f4903c151419133d661a8a4335f9507;hb=3f85ee3ef8348dd2200c7bb05be6701689a649d5;hp=7983e01f7aad95b1b69727886d7fc63e1aeb2c1e;hpb=cad5c1b69e6b41c85d015c21dcd7faf32b09c64a;p=friendica.git diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php index 7983e01f7a..29e0f4f52f 100644 --- a/src/Module/Proxy.php +++ b/src/Module/Proxy.php @@ -8,6 +8,7 @@ namespace Friendica\Module; use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Config; +use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Photo; @@ -16,8 +17,6 @@ use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\Proxy as ProxyUtils; -require_once 'include/security.php'; - /** * @brief Module Proxy */ @@ -70,7 +69,7 @@ class Proxy extends BaseModule $thumb = false; $size = 1024; $sizetype = ''; - $basepath = $a->get_basepath(); + $basepath = $a->getBasePath(); // If the cache path isn't there, try to create it if (!is_dir($basepath . '/proxy') && is_writable($basepath)) { @@ -104,7 +103,7 @@ class Proxy extends BaseModule $sizetype = ':thumb'; $url = substr($url, 0, -6); } elseif (substr($url, -6) == ':small') { - $size = 175; + $size = 300; $url = substr($url, 0, -6); $sizetype = ':small'; } elseif (substr($url, -7) == ':medium') { @@ -187,7 +186,8 @@ class Proxy extends BaseModule // It shouldn't happen but it does - spaces in URL $_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']); $redirects = 0; - $img_str = Network::fetchUrl($_REQUEST['url'], true, $redirects, 10); + $fetchResult = Network::fetchUrlFull($_REQUEST['url'], true, $redirects, 10); + $img_str = $fetchResult->getBody(); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); @@ -195,7 +195,7 @@ class Proxy extends BaseModule unlink($tempfile); // If there is an error then return a blank image - if ((substr($a->get_curl_code(), 0, 1) == '4') || (!$img_str)) { + if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || (!$img_str)) { $img_str = file_get_contents('images/blank.png'); $mime = 'image/png'; $cachefile = ''; // Clear the cachefile so that the dummy isn't stored