From 5595e7cc54eb627eae4fd6a189b27fd40ce309da Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 12 Aug 2015 19:03:47 +0200 Subject: [PATCH] Revert "Save state" This reverts commit 545165e312a4391d36f6075edfe9fc4f43f55fac. --- .../lib/action/ImageProxyAction.class.php | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 wcfsetup/install/files/lib/action/ImageProxyAction.class.php diff --git a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php deleted file mode 100644 index f2d5e0a0e6..0000000000 --- a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php +++ /dev/null @@ -1,90 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage action - * @category Community Framework - */ -class ImageProxyAction extends AbstractAction { - /** - * hashed image proxy secret and image url - * @var string - */ - public $hash = ''; - - /** - * url-encoded image url - * @var string - */ - public $url = ''; - - /** - * @see \wcf\action\IAction::readParameters() - */ - public function readParameters() { - parent::readParameters(); - - if (isset($_REQUEST['url'])) $this->url = StringUtil::trim($_REQUEST['url']); - if (isset($_REQUEST['hash'])) $this->hash = StringUtil::trim($_REQUEST['hash']); - } - - /** - * @see \wcf\action\IAction::execute() - */ - public function execute() { - parent::execute(); - - $url = urldecode($this->url); - $hash = sha1(IMAGE_PROXY_SECRET.$url); - if ($this->hash != $hash) { - throw new IllegalLinkException(); - } - - try { - $request = new HTTPRequest($url); - $request->execute(); - $reply = $request->getReply(); - - $fileExtension = ''; - if (($position = mb_strrpos($url, '.')) !== false) { - $fileExtension = mb_strtolower(mb_substr($url, $position + 1)); - } - - // check if requested content is image - if (!isset($reply['headers']['Content-Type']) || !StringUtil::startsWith($reply['headers']['Content-Type'], 'image/')) { - throw new IllegalLinkException(); - } - - // save image - $fileLocation = WCF_DIR.'images/proxy/'.substr($hash, 0, 2).'/'.$hash.($fileExtension ? '.'.$fileExtension : ''); - $dir = dirname($fileLocation); - if (!@file_exists($dir)) { - FileUtil::makePath($dir, 0777); - } - file_put_contents($fileLocation, $reply['body']); - - // update mtime for correct expiration calculation - @touch($fileLocation); - - $this->executed(); - - @header('Content-Type: '.$reply['headers']['Content-Type']); - @readfile($fileLocation); - exit; - } - catch (SystemException $e) { - throw new IllegalLinkException(); - } - } -} -- 2.20.1