From: Tim Düsterhus Date: Fri, 24 May 2013 19:54:38 +0000 (+0200) Subject: Add smileyPath to smiley administration X-Git-Tag: 2.0.0_Beta_1~70 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1aa8ebeedbc53a63fbeae46f4556f57c211ca70c;p=GitHub%2FWoltLab%2FWCF.git Add smileyPath to smiley administration Closes #1296 --- diff --git a/wcfsetup/install/files/acp/templates/smileyAdd.tpl b/wcfsetup/install/files/acp/templates/smileyAdd.tpl index bc586a7606..c8f5c5e3d7 100644 --- a/wcfsetup/install/files/acp/templates/smileyAdd.tpl +++ b/wcfsetup/install/files/acp/templates/smileyAdd.tpl @@ -34,6 +34,7 @@
+ {if $errorField == 'smileyTitle'} {if $errorType == 'empty'} @@ -72,6 +73,7 @@
+ {if $errorField == 'smileyCode'} {if $errorType == 'empty'} @@ -97,6 +99,24 @@
+ +
+
+ + + {if $errorField == 'smileyPath'} + + {if $errorType == 'empty'} + {lang}wcf.global.form.error.empty{/lang} + {else} + {lang}wcf.acp.smiley.smileyPath.error.{@$errorType}{/lang} + {/if} + + {/if} + {lang}wcf.acp.smiley.smileyPath.description{/lang} +
+ +
diff --git a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php index 10a0dbd700..31fbcf7ce5 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php @@ -10,6 +10,7 @@ use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; use wcf\system\WCF; +use wcf\util\FileUtil; use wcf\util\StringUtil; /** @@ -68,6 +69,12 @@ class SmileyAddForm extends AbstractForm { */ public $aliases = ''; + /** + * smileyPath + * @var string + */ + public $smileyPath = ''; + /** * node tree with available smiley categories * @var wcf\data\category\CategoryNodeTree @@ -89,6 +96,7 @@ class SmileyAddForm extends AbstractForm { 'categoryID' => $this->categoryID, 'smileyCode' => $this->smileyCode, 'aliases' => $this->aliases, + 'smileyPath' => $this->smileyPath, 'categoryNodeList' => $this->categoryNodeTree->getIterator() )); } @@ -122,18 +130,11 @@ class SmileyAddForm extends AbstractForm { if (I18nHandler::getInstance()->isPlainValue('smileyTitle')) $this->smileyTitle = I18nHandler::getInstance()->getValue('smileyTitle'); - if (isset($_POST['showOrder'])) { - $this->showOrder = intval($_POST['showOrder']); - } - if (isset($_POST['smileyCode'])) { - $this->smileyCode = StringUtil::trim($_POST['smileyCode']); - } - if (isset($_POST['categoryID'])) { - $this->categoryID = intval($_POST['categoryID']); - } - if (isset($_POST['aliases'])) { - $this->aliases = StringUtil::unifyNewlines(StringUtil::trim($_POST['aliases'])); - } + if (isset($_POST['showOrder'])) $this->showOrder = intval($_POST['showOrder']); + if (isset($_POST['categoryID'])) $this->categoryID = intval($_POST['categoryID']); + if (isset($_POST['smileyCode'])) $this->smileyCode = StringUtil::trim($_POST['smileyCode']); + if (isset($_POST['aliases'])) $this->aliases = StringUtil::unifyNewlines(StringUtil::trim($_POST['aliases'])); + if (isset($_POST['smileyPath'])) $this->smileyPath = FileUtil::removeLeadingSlash(StringUtil::trim($_POST['smileyPath'])); } /** @@ -146,10 +147,11 @@ class SmileyAddForm extends AbstractForm { 'data' => array( 'smileyTitle' => $this->smileyTitle, 'smileyCode' => $this->smileyCode, + 'aliases' => $this->aliases, + 'smileyPath' => $this->smileyPath, 'showOrder' => $this->showOrder, 'categoryID' => $this->categoryID ?: null, - 'packageID' => 1, - 'aliases' => $this->aliases + 'packageID' => 1 ) )); $this->objectAction->executeAction(); @@ -201,6 +203,14 @@ class SmileyAddForm extends AbstractForm { throw new UserInputException('smileyCode'); } + if (empty($this->smileyPath)) { + throw new UserInputException('smileyPath'); + } + + if (!file_exists(WCF_DIR.$this->smileyPath)) { + throw new UserInputException('smileyPath', 'notFound'); + } + // validate smiley code and aliases against existing smilies $conditionBuilder = new PreparedStatementConditionBuilder(); if (isset($this->smiley)) { diff --git a/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php index 694fff843f..38bb5c8a3c 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php @@ -73,9 +73,10 @@ class SmileyEditForm extends SmileyAddForm { $this->objectAction = new SmileyAction(array($this->smileyID), 'update', array('data' => array( 'smileyTitle' => $this->smileyTitle, 'smileyCode' => $this->smileyCode, + 'aliases' => $this->aliases, + 'smileyPath' => $this->smileyPath, 'showOrder' => $this->showOrder, - 'categoryID' => $this->categoryID ?: null, - 'aliases' => $this->aliases + 'categoryID' => $this->categoryID ?: null ))); $this->objectAction->executeAction(); @@ -99,6 +100,7 @@ class SmileyEditForm extends SmileyAddForm { $this->smileyCode = $this->smiley->smileyCode; $this->aliases = $this->smiley->aliases; + $this->smileyPath = $this->smiley->smileyPath; $this->showOrder = $this->smiley->showOrder; $this->categoryID = $this->smiley->categoryID; } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 3f92b63eca..f4da99d089 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -942,11 +942,14 @@ - + + + getPath()}“ interpretiert.]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 310f46714c..ef4f6f0deb 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -941,11 +941,14 @@ Examples for medium ID detection: - + + + getPath()}“ interpretiert.]]> +