From cb0e691f0de8412f749a3bc5e85e4f6af381c8e0 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 7 Aug 2016 10:07:10 +0200 Subject: [PATCH] Remove packageName input remnants in StyleExportForm See 0daf121703f0a2c362548062d46e9929964b182f --- .../files/acp/templates/styleExport.tpl | 2 +- .../lib/acp/form/StyleExportForm.class.php | 39 ++----------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/styleExport.tpl b/wcfsetup/install/files/acp/templates/styleExport.tpl index b43dff9881..cd4d96cf4f 100644 --- a/wcfsetup/install/files/acp/templates/styleExport.tpl +++ b/wcfsetup/install/files/acp/templates/styleExport.tpl @@ -45,7 +45,7 @@

{lang}wcf.acp.style.exportStyle.asPackage{/lang}

{lang}wcf.acp.style.exportStyle.asPackage.description{/lang}

- +
diff --git a/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php index 9f903033d1..50369031b2 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php @@ -1,11 +1,9 @@ canExportImages && isset($_POST['exportImages'])) $this->exportImages = true; if ($this->canExportTemplates && isset($_POST['exportTemplates'])) $this->exportTemplates = true; - if (isset($_POST['exportAsPackage'])) { + if ($this->style->packageName && isset($_POST['exportAsPackage'])) { $this->exportAsPackage = true; - - if (isset($_POST['packageName'])) $this->packageName = StringUtil::trim($_POST['packageName']); - } - } - - /** - * @inheritDoc - */ - public function validate() { - parent::validate(); - - if ($this->exportAsPackage) { - if (empty($this->packageName)) { - throw new UserInputException('packageName'); - } - - if (!Package::isValidPackageName($this->packageName)) { - throw new UserInputException('packageName', 'notValid'); - } - - // 3rd party packages may never have com.woltlab.* as name - if (strpos($this->packageName, 'com.woltlab.') === 0) { - throw new UserInputException('packageName', 'reserved'); - } } } @@ -143,7 +111,7 @@ class StyleExportForm extends AbstractForm { header('Content-Type: application/x-gzip; charset=utf-8'); if ($this->exportAsPackage) { - header('Content-Disposition: attachment; filename="'.$this->packageName.'.tar.gz"'); + header('Content-Disposition: attachment; filename="'.$this->style->packageName.'.tar.gz"'); } else { header('Content-Disposition: attachment; filename="'.$filename.'-style.tgz"'); @@ -151,7 +119,7 @@ class StyleExportForm extends AbstractForm { // export style $styleEditor = new StyleEditor($this->style); - $styleEditor->export($this->exportTemplates, $this->exportImages, $this->packageName); + $styleEditor->export($this->exportTemplates, $this->exportImages, $this->style->packageName); // call saved event $this->saved(); @@ -171,7 +139,6 @@ class StyleExportForm extends AbstractForm { 'exportAsPackage' => $this->exportAsPackage, 'exportImages' => $this->exportImages, 'exportTemplates' => $this->exportTemplates, - 'packageName' => $this->packageName, 'style' => $this->style, 'styleID' => $this->styleID ]); -- 2.20.1