From 7da7f7cc6e4a9284942482691129a0e1e749b4d5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 12 Sep 2011 18:20:08 +0200 Subject: [PATCH] Fixed icons during WCFSetup It is now possible to fetch images (jpg, png or svg) and CSS via install.php --- wcfsetup/install.php | 50 +- wcfsetup/setup/template/footer.tpl | 2 +- wcfsetup/setup/template/header.tpl | 1043 +--------------------------- 3 files changed, 50 insertions(+), 1045 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index aaa1d44a50..94a16960d0 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -19,10 +19,12 @@ set_error_handler('handleError', E_ALL); // define list of needed file $neededFilesPattern = array( '!^setup/.*!', + '!^install/files/acp/images/wcfLogo.*!', + '!^install/files/acp/style/.*!', '!^install/files/lib/data/.*!', + '!^install/files/icon/.*!', '!^install/files/lib/system/.*!', '!^install/files/lib/util/.*!', - '!^install/files/acp/images/setup.*!', '!^install/lang/.*!', '!^install/packages/.*!'); @@ -706,16 +708,50 @@ define('TMP_FILE_PREFIX', $prefix); // try to find the temp folder define('TMP_DIR', BasicFileUtil::getTempFolder()); -// show image from temp folder -if (isset($_GET['showImage'])) { - if (preg_match('~[\w\-]+\.(jpg|png)~', $_GET['showImage'], $match)) { - if ($match[1] == 'jpg') header('Content-Type: image/jpg'); - else header('Content-Type: image/png'); - readfile(TMP_DIR . 'install/files/acp/images/' . $_GET['showImage']); +/** + * Reads a file resource from temp folder. + * + * @param string $key + * @param string $directory + */ +function readFileResource($key, $directory) { + if (preg_match('~[\w\-]+\.(css|jpg|png|svg)~', $_GET[$key], $match)) { + switch ($match[1]) { + case 'css': + header('Content-Type: text/css'); + break; + + case 'jpg': + header('Content-Type: image/jpg'); + break; + + case 'png': + header('Content-Type: image/png'); + break; + + case 'svg': + header('Content-Type: image/svg+xml'); + break; + } + + readfile($directory . $_GET[$key]); } exit; } +// show image from temp folder +if (isset($_GET['showImage'])) { + readFileResource('showImage', TMP_DIR . 'install/files/acp/images/'); +} +// show icon from temp folder +if (isset($_GET['showIcon'])) { + readFileResource('showIcon', TMP_DIR . 'install/files/icon/'); +} +// show css from temp folder +if (isset($_GET['showCSS'])) { + readFileResource('showCSS', TMP_DIR . 'install/files/acp/style/'); +} + // check whether setup files are already unzipped if (!file_exists(TMP_DIR . 'install/files/lib/system/WCFSetup.class.php')) { // try to unzip all setup files into temp folder diff --git a/wcfsetup/setup/template/footer.tpl b/wcfsetup/setup/template/footer.tpl index 219b53ddaa..0138112641 100644 --- a/wcfsetup/setup/template/footer.tpl +++ b/wcfsetup/setup/template/footer.tpl @@ -9,7 +9,7 @@
diff --git a/wcfsetup/setup/template/header.tpl b/wcfsetup/setup/template/header.tpl index 3e2318498f..11470b7fa5 100644 --- a/wcfsetup/setup/template/header.tpl +++ b/wcfsetup/setup/template/header.tpl @@ -5,1038 +5,7 @@ {lang}wcf.global.progressBar{/lang} - {lang}wcf.global.pageTitle{/lang} - - + @@ -1049,7 +18,7 @@ @@ -1061,7 +30,7 @@ @@ -1078,9 +47,9 @@
- {* ToDo: Installation Icon - - /Installation Icon *} + {* ToDo: Installation Icon *} + + {* /Installation Icon *}

{lang}wcf.global.title{/lang}

{lang}wcf.global.title.subtitle{/lang}

-- 2.20.1