From 689f5bd0585f8bbef82b3521914179bf081f4d7d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 10 May 2013 00:29:38 +0200 Subject: [PATCH] Fixed style import Fixes #1266 --- .../lib/acp/form/StyleImportForm.class.php | 20 +++++++------------ wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php index 30ab01af77..1b64ee66ca 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php @@ -62,11 +62,12 @@ class StyleImportForm extends AbstractForm { throw new UserInputException('source', 'uploadFailed'); } - // get filename - $this->source['name'] = FileUtil::getTemporaryFilename('style_', preg_replace('!^.*(?=\.(?:tar\.gz|tgz|tar)$)!i', '', basename($this->source['name']))); - - if (!@move_uploaded_file($this->source['tmp_name'], $this->source['name'])) { - throw new UserInputException('source', 'uploadFailed'); + try { + $this->style = StyleEditor::import($this->source['tmp_name']); + } + catch (\Exception $e) { + @unlink($this->source['tmp_name']); + throw new UserInputException('source', 'importFailed'); } } @@ -76,14 +77,7 @@ class StyleImportForm extends AbstractForm { public function save() { parent::save(); - try { - $this->style = StyleEditor::import($this->source['name']); - } - catch (\Exception $e) { - @unlink($this->source['name']); - } - - @unlink($this->source['name']); + @unlink($this->source['tmp_name']); $this->saved(); WCF::getTPL()->assign('success', true); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 83ada74428..3249586ef1 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -631,6 +631,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index dbe285b0d2..65193576e6 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -631,6 +631,7 @@ + -- 2.20.1