From: Alexander Ebert Date: Mon, 23 Jan 2017 08:44:13 +0000 (+0100) Subject: Fixed style editing X-Git-Tag: 3.0.1_pl_1~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6147a6661c52e839f726ce16b8ac5bbbba9e206c;p=GitHub%2FWoltLab%2FWCF.git Fixed style editing --- diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index d49fd672af..a3e762c064 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -303,10 +303,7 @@ class StyleAddForm extends AbstractForm { throw new UserInputException('packageName', 'invalid'); } - // 3rd party styles may never have com.woltlab.* as name - if (strpos($this->packageName, 'com.woltlab.') === 0) { - throw new UserInputException('packageName', 'reserved'); - } + $this->enforcePackageNameRestriction(); } // validate template group id @@ -329,6 +326,18 @@ class StyleAddForm extends AbstractForm { } } + /** + * Disallow the use of `com.woltlab.*` for package names to avoid accidential collisions. + * + * @throws UserInputException + */ + protected function enforcePackageNameRestriction() { + // 3rd party styles may never have com.woltlab.* as name + if (strpos($this->packageName, 'com.woltlab.') !== false) { + throw new UserInputException('packageName', 'reserved'); + } + } + /** * Validates LESS-variable overrides. * diff --git a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php index c27d53a774..1b1d644470 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php @@ -57,6 +57,15 @@ class StyleEditForm extends StyleAddForm { } } + /** + * @inheritDoc + */ + protected function enforcePackageNameRestriction() { + if ($this->style->isTainted) { + parent::enforcePackageNameRestriction(); + } + } + /** * @inheritDoc */