From: Alexander Ebert Date: Mon, 2 May 2016 15:41:40 +0000 (+0200) Subject: Page controller is immutable X-Git-Tag: 3.0.0_Beta_1~1771 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1df3baa27e95f20e56122c3834b5bfeb9fab59d;p=GitHub%2FWoltLab%2FWCF.git Page controller is immutable --- diff --git a/wcfsetup/install/files/acp/templates/pageAdd.tpl b/wcfsetup/install/files/acp/templates/pageAdd.tpl index a0cd7f35e2..e2b36d87ae 100644 --- a/wcfsetup/install/files/acp/templates/pageAdd.tpl +++ b/wcfsetup/install/files/acp/templates/pageAdd.tpl @@ -107,22 +107,6 @@ - -
-
- originIsSystem} readonly="readonly"{/if} /> - {if $errorField == 'controller'} - - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {else} - {lang}wcf.acp.page.controller.error.{@$errorType}{/lang} - {/if} - - {/if} -
- - {if !$isMultilingual}
diff --git a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php index 335258b476..4342fe47fd 100644 --- a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php @@ -102,12 +102,6 @@ class PageAddForm extends AbstractForm { */ public $customURL = []; - /** - * page controller - * @var string - */ - public $controller = ''; - /** * page titles * @var string[] @@ -192,7 +186,6 @@ class PageAddForm extends AbstractForm { if (isset($_POST['isDisabled'])) $this->isDisabled = 1; if (isset($_POST['isLandingPage'])) $this->isLandingPage = 1; if (isset($_POST['applicationPackageID'])) $this->applicationPackageID = intval($_POST['applicationPackageID']); - if (isset($_POST['controller'])) $this->controller = StringUtil::trim($_POST['controller']); if (isset($_POST['customURL']) && is_array($_POST['customURL'])) $this->customURL = ArrayUtil::trim($_POST['customURL']); if (isset($_POST['title']) && is_array($_POST['title'])) $this->title = ArrayUtil::trim($_POST['title']); @@ -216,8 +209,6 @@ class PageAddForm extends AbstractForm { $this->validateApplicationPackageID(); - $this->validateController(); - $this->validateCustomUrl(); $this->validateBoxIDs(); @@ -237,6 +228,8 @@ class PageAddForm extends AbstractForm { /** * Validates page type. + * + * @throws UserInputException */ protected function validatePageType() { if (!in_array($this->pageType, Page::$availablePageTypes) || $this->pageType == 'system') { @@ -250,6 +243,8 @@ class PageAddForm extends AbstractForm { /** * Validates parent page id. + * + * @throws UserInputException */ protected function validateParentPageID() { if ($this->parentPageID) { @@ -262,6 +257,8 @@ class PageAddForm extends AbstractForm { /** * Validates package id. + * + * @throws UserInputException */ protected function validateApplicationPackageID() { if (!isset($this->availableApplications[$this->applicationPackageID])) { @@ -269,23 +266,10 @@ class PageAddForm extends AbstractForm { } } - /** - * Validates controller. - */ - protected function validateController() { - if ($this->pageType == 'system') { - if (!$this->controller) { - throw new UserInputException('controller'); - } - - if (!class_exists($this->controller)) { - throw new UserInputException('controller', 'notFound'); - } - } - } - /** * Validates custom urls. + * + * @throws UserInputException */ protected function validateCustomUrl() { foreach ($this->customURL as $type => $customURL) { @@ -297,6 +281,8 @@ class PageAddForm extends AbstractForm { /** * Validates box ids. + * + * @throws UserInputException */ protected function validateBoxIDs() { foreach ($this->boxIDs as $boxID) { @@ -383,7 +369,6 @@ class PageAddForm extends AbstractForm { 'lastUpdateTime' => TIME_NOW, 'isMultilingual' => $this->isMultilingual, 'identifier' => '', - 'controller' => $this->controller, 'packageID' => 1 ]), 'content' => $content, 'boxToPage' => $this->getBoxToPage()]); @@ -437,7 +422,6 @@ class PageAddForm extends AbstractForm { 'isLandingPage' => $this->isLandingPage, 'isMultilingual' => $this->isMultilingual, 'applicationPackageID' => $this->applicationPackageID, - 'controller' => $this->controller, 'customURL' => $this->customURL, 'title' => $this->title, 'content' => $this->content, diff --git a/wcfsetup/install/files/lib/acp/form/PageEditForm.class.php b/wcfsetup/install/files/lib/acp/form/PageEditForm.class.php index b0c1d27a8d..4b53f7cb67 100644 --- a/wcfsetup/install/files/lib/acp/form/PageEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageEditForm.class.php @@ -11,7 +11,7 @@ use wcf\system\WCF; * Shows the page add form. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage acp.form @@ -38,6 +38,8 @@ class PageEditForm extends PageAddForm { /** * @inheritDoc + * + * @throws IllegalLinkException */ public function readParameters() { parent::readParameters(); @@ -67,7 +69,6 @@ class PageEditForm extends PageAddForm { if ($this->page->originIsSystem) { $this->parentPageID = $this->page->parentPageID; $this->applicationPackageID = $this->page->applicationPackageID; - $this->controller = $this->page->controller; } if ($this->page->requireObjectID) { @@ -79,17 +80,17 @@ class PageEditForm extends PageAddForm { /** * @inheritDoc */ - protected function validatePageType() { - // type is immutable + protected function validateName() { + if (mb_strtolower($this->name) != mb_strtolower($this->page->name)) { + parent::validateName(); + } } /** * @inheritDoc */ - protected function validateName() { - if (mb_strtolower($this->name) != mb_strtolower($this->page->name)) { - parent::validateName(); - } + protected function validatePageType() { + // type is immutable } /** @@ -167,7 +168,6 @@ class PageEditForm extends PageAddForm { $this->parentPageID = $this->page->parentPageID; $this->pageType = $this->page->pageType; $this->applicationPackageID = $this->page->applicationPackageID; - $this->controller = $this->page->controller; if ($this->page->controllerCustomURL) $this->customURL[0] = $this->page->controllerCustomURL; if ($this->page->isLandingPage) $this->isLandingPage = 1; if ($this->page->isDiabled) $this->isDisabled = 1;