Remove packageName input remnants in StyleExportForm
authorMatthias Schmidt <gravatronics@live.com>
Sun, 7 Aug 2016 08:07:10 +0000 (10:07 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 7 Aug 2016 08:07:10 +0000 (10:07 +0200)
See 0daf121703f0a2c362548062d46e9929964b182f

wcfsetup/install/files/acp/templates/styleExport.tpl
wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php

index b43dff98819d3cd5e36f511a2812022593590ccb..cd4d96cf4fce63bbfb68bead45b2249465714cb6 100644 (file)
@@ -45,7 +45,7 @@
                                <h2 class="sectionTitle">{lang}wcf.acp.style.exportStyle.asPackage{/lang}</h2>
                                <p class="sectionDescription">{lang}wcf.acp.style.exportStyle.asPackage.description{/lang}</p>
                        </header>
-                               
+                       
                        <dl>
                                <dt></dt>
                                <dd>
index 9f903033d18a638bf758464a391cd7346ea49d16..50369031b2ae812179251488e4f87be2fa84976c 100644 (file)
@@ -1,11 +1,9 @@
 <?php
 namespace wcf\acp\form;
-use wcf\data\package\Package;
 use wcf\data\style\Style;
 use wcf\data\style\StyleEditor;
 use wcf\form\AbstractForm;
 use wcf\system\exception\IllegalLinkException;
-use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
 
@@ -58,12 +56,6 @@ class StyleExportForm extends AbstractForm {
         */
        public $neededPermissions = ['admin.style.canManageStyle'];
        
-       /**
-        * package identifier
-        * @var string
-        */
-       public $packageName = '';
-       
        /**
         * style object
         * @var \wcf\data\style\Style
@@ -101,32 +93,8 @@ class StyleExportForm extends AbstractForm {
                if ($this->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
                ]);