Remove the favicon/corsProxy.php
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 May 2022 11:00:29 +0000 (13:00 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 May 2022 12:24:41 +0000 (14:24 +0200)
This was required for multi-domain setups.

wcfsetup/install/files/images/favicon/corsProxy.php [deleted file]
wcfsetup/install/files/lib/data/style/Style.class.php

diff --git a/wcfsetup/install/files/images/favicon/corsProxy.php b/wcfsetup/install/files/images/favicon/corsProxy.php
deleted file mode 100644 (file)
index 9adb7b9..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/**
- * Serves the manifest.json to properly allow cross-domain (CORS) fetching.
- *
- * @author  Alexander
- * @copyright   2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- */
-
-$types = [
-    'manifest' => [
-        'filename' => 'manifest.json',
-        'type' => 'application/json; charset=UTF-8',
-    ],
-];
-if (!empty($_GET['type']) || !isset($types[$_GET['type']])) {
-    // get parameters
-    $type = $_GET['type'];
-    $styleID = (!empty($_GET['styleID'])) ? \intval($_GET['styleID']) : 'default';
-    if ($styleID === 'default' || $styleID > 0) {
-        if ($styleID === 'default') {
-            $filename = 'default.' . $types[$type]['filename'];
-        } else {
-            $filename = '../style-' . $styleID . '/' . $types[$type]['filename'];
-        }
-        if (\file_exists($filename)) {
-            $filemtime = \filemtime($filename);
-
-            $etag = '"' . \md5($filemtime . $filename) . '"';
-            $clientEtag = (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) ? \trim($_SERVER['HTTP_IF_NONE_MATCH']) : '';
-            $clientLastModified = (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? \trim($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0;
-            $clientLastModified = @\strtotime($clientLastModified);
-
-            // ignore request if client seems to already have fetched this file
-            if (($clientLastModified && $clientEtag) ? (($clientLastModified == $filemtime) && ($clientEtag == $etag)) : ($clientLastModified == $filemtime)) {
-                \header("HTTP/1.1 304 Not Modified");
-
-                exit;
-            }
-
-            $data = \file_get_contents($filename);
-
-            if ($styleID !== 'default') {
-                $data = \str_replace('src": "', 'src": "../style-' . $styleID . "/", $data);
-            }
-
-            // send cache and type headers
-            // allow font fetching from all domains (CORS)
-            \header('Access-Control-Allow-Origin: *');
-            \header('Content-Type: ' . $types[$type]['type']);
-            \header('Cache-Control: max-age=31536000, private');
-            \header('ETag: ' . $etag);
-            \header('Expires: ' . \gmdate("D, d M Y H:i:s", \time() + 31536000) . ' GMT');
-            \header('Last-Modified: ' . \gmdate('D, d M Y H:i:s', $filemtime) . ' GMT');
-            \header('Content-Length: ' . \strlen($data));
-
-            exit($data);
-        }
-
-        \header("HTTP/1.1 404 Not Found");
-
-        exit("Unknown file '" . $filename . "' requested.");
-    }
-
-    \header("HTTP/1.1 400 Bad Request");
-
-    exit("Invalid styleID '" . $styleID . "' given");
-}
-
-\header("HTTP/1.1 400 Bad Request");
-
-exit("Missing type parameter");
index 7449aca53671a105cb435e44f86c1a78ed46a702..2f676d488f0fa51a8d686f71312e4c1279f4ee14 100644 (file)
@@ -3,7 +3,6 @@
 namespace wcf\data\style;
 
 use wcf\data\DatabaseObject;
-use wcf\system\application\ApplicationHandler;
 use wcf\system\style\StyleCompiler;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
@@ -414,12 +413,6 @@ class Style extends DatabaseObject
      */
     protected function getFaviconPath($filename, $absolutePath = true)
     {
-        if ($filename === 'manifest.json') {
-            if (ApplicationHandler::getInstance()->getActiveApplication()->domainName !== ApplicationHandler::getInstance()->getApplicationByID(1)->domainName) {
-                return WCF::getPath() . 'images/favicon/corsProxy.php?type=manifest' . ($this->hasFavicon ? '&amp;styleID=' . $this->styleID : '');
-            }
-        }
-
         if ($this->hasFavicon) {
             $path = FileUtil::getRelativePath(WCF_DIR, $this->getAssetPath()) . $filename;
         } else {