From: Tim Düsterhus Date: Thu, 19 Jan 2017 15:29:27 +0000 (+0100) Subject: Make ImageProxy compatible with non-GNU operating systems X-Git-Tag: 3.0.1~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5fe7469d4b113139de85a233114c9c9fb9595373;p=GitHub%2FWoltLab%2FWCF.git Make ImageProxy compatible with non-GNU operating systems --- diff --git a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php index 10cce82c49..19bcd46c43 100644 --- a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php @@ -57,10 +57,15 @@ class ImageProxyAction extends AbstractAction { } // check whether we already downloaded the image - $files = glob($dir.'/'.$fileName.'.{png,gif,jpg}', GLOB_BRACE | GLOB_NOSORT); - if ($files === false) throw new IllegalLinkException(); + $fileLocation = null; + foreach (['png','jpg','gif'] as $extension) { + if (is_file($dir.'/'.$fileName.'.'.$extension)) { + $fileLocation = $dir.'/'.$fileName.'.'.$extension; + break; + } + } - if (empty($files)) { + if ($fileLocation === null) { try { // download image try { @@ -116,10 +121,7 @@ class ImageProxyAction extends AbstractAction { // update mtime for correct expiration calculation @touch($fileLocation); } - else { - $fileLocation = $files[0]; - } - + $path = FileUtil::getRelativePath(WCF_DIR, dirname($fileLocation)).basename($fileLocation); $this->executed();