Fixed multiple issues in template administration
authorMarcel Werk <burntime@woltlab.com>
Thu, 25 Apr 2013 20:21:34 +0000 (22:21 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 25 Apr 2013 20:21:34 +0000 (22:21 +0200)
Fixes #1247

wcfsetup/install/files/acp/templates/templateAdd.tpl
wcfsetup/install/files/lib/acp/form/TemplateGroupAddForm.class.php
wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php

index d7b06a59ea18437bb59f17a7b0e55d533cc56d10..a3f5bb819870b13c52a4f73e3e2522047e9f616b 100644 (file)
@@ -3,6 +3,7 @@
 <header class="boxHeadline">
        <hgroup>
                <h1>{lang}wcf.acp.template.{$action}{/lang}</h1>
+               {if $action == 'edit'}<h2>{$template->getPath()}</h2>{/if}
        </hgroup>
 </header>
 
index b9f2404d34a7a35bb32742b18c6fe8fe49e7545d..933b935dc73ac979028fe49b4002493f099cd61f 100644 (file)
@@ -85,10 +85,6 @@ class TemplateGroupAddForm extends AbstractForm {
                        throw new UserInputException('templateGroupName');
                }
        
-               if (!preg_match('/^[a-z0-9_\-]+\/$/i', $this->templateGroupName)) {
-                       throw new UserInputException('templateGroupName', 'notValid');
-               }
-               
                $sql = "SELECT  COUNT(*) AS count
                        FROM    wcf".WCF_N."_template_group
                        WHERE   templateGroupName = ?";
@@ -108,8 +104,8 @@ class TemplateGroupAddForm extends AbstractForm {
                        throw new UserInputException('templateGroupFolderName');
                }
                
-               if ($this->templateGroupFolderName == '/') {
-                       throw new UserInputException('templateGroupFolderName', 'notUnique');
+               if (!preg_match('/^[a-z0-9_\- ]+\/$/i', $this->templateGroupFolderName)) {
+                       throw new UserInputException('templateGroupFolderName', 'notValid');
                }
        
                $sql = "SELECT  COUNT(*) AS count
index 62c9f6c93e33d29fadc734b3bff00c6bccbf1a2c..f9eb21e181f99e147cce78bd9aa8dedc78c8531f 100644 (file)
@@ -51,7 +51,9 @@ class TemplateGroupEditor extends DatabaseObjectEditor implements IEditableCache
         * Deletes the folder of this template group.
         */
        public function deleteFolder() {
-               DirectoryUtil::getInstance(WCF_DIR . 'templates/' . $this->templateGroupFolderName)->removeAll();
+               if (file_exists(WCF_DIR . 'templates/' . $this->templateGroupFolderName)) {
+                       DirectoryUtil::getInstance(WCF_DIR . 'templates/' . $this->templateGroupFolderName)->removeAll();
+               }
        }
        
        /**