From ad54b542be0ab5c9a8399ce3346a4616338df682 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 26 Apr 2013 01:46:51 +0200 Subject: [PATCH] Fixed template copy function --- .../lib/acp/form/TemplateAddForm.class.php | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) 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(); } } -- 2.20.1