Remove imagePath option from StyleAddForm
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 21 Jul 2020 10:24:16 +0000 (12:24 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 21 Jul 2020 13:39:34 +0000 (15:39 +0200)
wcfsetup/install/files/acp/templates/styleAdd.tpl
wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php

index 05c5156c1d206b180602ad8307dfdc21ffe884bc..803ef8eb9c9169caa610103ef0fb9cde1b63cb79 100644 (file)
                                                </dd>
                                        </dl>
                                {/if}
-                               <dl{if $errorField == 'imagePath'} class="formError"{/if}>
-                                       <dt><label for="imagePath">{lang}wcf.acp.style.imagePath{/lang}</label></dt>
-                                       <dd>
-                                               <input type="text" name="imagePath" id="imagePath" value="{$imagePath}" class="long">
-                                               {if $errorField == 'imagePath'}
-                                                       <small class="innerError">
-                                                               {if $errorType == 'empty'}
-                                                                       {lang}wcf.global.form.error.empty{/lang}
-                                                               {else}
-                                                                       {lang}wcf.acp.style.imagePath.error.{$errorType}{/lang}
-                                                               {/if}
-                                                       </small>
-                                               {/if}
-                                               <small>{lang}wcf.acp.style.imagePath.description{/lang}</small>
-                                       </dd>
-                               </dl>
                                
                                {event name='fileFields'}
                        </section>
index 89afd3d3f1206d3ae5509644eb2262984bf9d3c4..4d6e140d283f4aa57f379c5fa0981e88c0d882e8 100644 (file)
@@ -107,12 +107,6 @@ class StyleAddForm extends AbstractForm {
         */
        public $globals = [];
        
-       /**
-        * image path
-        * @var string
-        */
-       public $imagePath = 'images/';
-       
        /**
         * tainted style
         * @var boolean
@@ -327,7 +321,6 @@ class StyleAddForm extends AbstractForm {
                if (isset($_POST['authorName'])) $this->authorName = StringUtil::trim($_POST['authorName']);
                if (isset($_POST['authorURL'])) $this->authorURL = StringUtil::trim($_POST['authorURL']);
                if (isset($_POST['copyright'])) $this->copyright = StringUtil::trim($_POST['copyright']);
-               if (isset($_POST['imagePath'])) $this->imagePath = StringUtil::trim($_POST['imagePath']);
                if (isset($_POST['license'])) $this->license = StringUtil::trim($_POST['license']);
                if (isset($_POST['packageName'])) $this->packageName = StringUtil::trim($_POST['packageName']);
                if (isset($_POST['styleDate'])) $this->styleDate = StringUtil::trim($_POST['styleDate']);
@@ -405,14 +398,6 @@ class StyleAddForm extends AbstractForm {
                        }
                }
                
-               // ensure image path is below WCF_DIR/images/
-               if ($this->imagePath) {
-                       $relativePath = FileUtil::unifyDirSeparator(FileUtil::getRelativePath(WCF_DIR.'images/', WCF_DIR.$this->imagePath));
-                       if (strpos($relativePath, '../') !== false) {
-                               throw new UserInputException('imagePath', 'invalid');
-                       }
-               }
-               
                if (!empty($this->variables['overrideScss'])) {
                        $this->parseOverrides();
                }
@@ -725,7 +710,6 @@ class StyleAddForm extends AbstractForm {
                                'styleDescription' => '',
                                'styleVersion' => $this->styleVersion,
                                'styleDate' => $this->styleDate,
-                               'imagePath' => $this->imagePath,
                                'copyright' => $this->copyright,
                                'license' => $this->license,
                                'authorName' => $this->authorName,
@@ -754,7 +738,6 @@ class StyleAddForm extends AbstractForm {
                $this->authorName = $this->authorURL = $this->copyright = $this->packageName = '';
                $this->license = $this->styleDate = $this->styleDescription = $this->styleName = $this->styleVersion = '';
                $this->setDefaultValues();
-               $this->imagePath = 'images/';
                $this->isTainted = true;
                $this->templateGroupID = 0;
                $this->rebuildUploadFields();
@@ -786,7 +769,6 @@ class StyleAddForm extends AbstractForm {
                        'colorCategories' => $this->colorCategories,
                        'colors' => $this->colors,
                        'copyright' => $this->copyright,
-                       'imagePath' => $this->imagePath,
                        'isTainted' => $this->isTainted,
                        'license' => $this->license,
                        'packageName' => $this->packageName,
index f0f927bc18ca3f9a6a74fe2acab9bc13fc021f33..aba1ec5ebec0eace434d30a97c5f35596254d4b4 100644 (file)
@@ -144,7 +144,6 @@ class StyleEditForm extends StyleAddForm {
                        $this->authorName = $this->style->authorName;
                        $this->authorURL = $this->style->authorURL;
                        $this->copyright = $this->style->copyright;
-                       $this->imagePath = $this->style->imagePath;
                        $this->isTainted = $this->style->isTainted;
                        $this->license = $this->style->license;
                        $this->packageName = $this->style->packageName;
@@ -191,7 +190,6 @@ class StyleEditForm extends StyleAddForm {
                                'templateGroupID' => $this->templateGroupID,
                                'styleVersion' => $this->styleVersion,
                                'styleDate' => $this->styleDate,
-                               'imagePath' => $this->imagePath,
                                'copyright' => $this->copyright,
                                'packageName' => $this->packageName,
                                'license' => $this->license,