From: Marcel Werk Date: Thu, 25 Apr 2013 23:46:51 +0000 (+0200) Subject: Fixed template copy function X-Git-Tag: 2.0.0_Beta_1~295^2~10^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad54b542be0ab5c9a8399ce3346a4616338df682;p=GitHub%2FWoltLab%2FWCF.git Fixed template copy function --- diff --git a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php index 7ad09cde43..b0c8891c68 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php @@ -1,5 +1,7 @@ copy = intval($_REQUEST['copy']); + $this->copiedTemplate = new Template($this->copy); + if (!$this->copiedTemplate->templateID) { + throw new IllegalLinkException(); + } + + $this->packageID = $this->copiedTemplate->packageID; + } + } + /** * @see wcf\form\IForm::readFormParameters() */ @@ -171,13 +202,9 @@ class TemplateAddForm extends AbstractForm { $templateGroupList->readObjects(); $this->availableTemplateGroups = $templateGroupList->getObjects(); - if (!count($_POST)) { - if (!empty($_REQUEST['copy'])) { - $templateID = intval($_REQUEST['copy']); - $template = new Template($templateID); - $this->tplName = $template->templateName; - $this->templateSource = $template->getSource(); - } + if (!count($_POST) && $this->copiedTemplate !== null) { + $this->tplName = $this->copiedTemplate->templateName; + $this->templateSource = $this->copiedTemplate->getSource(); } }