From: Tim Düsterhus Date: Fri, 24 May 2013 19:36:12 +0000 (+0200) Subject: Fix validation of uniqueness of smiley codes X-Git-Tag: 2.0.0_Beta_1~71 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cda6d496f72e0a15a3675b47d0a4ed9685bca0aa;p=GitHub%2FWoltLab%2FWCF.git Fix validation of uniqueness of smiley codes --- diff --git a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php index 9ab70371e6..10a0dbd700 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php @@ -6,6 +6,7 @@ use wcf\data\package\PackageCache; use wcf\data\smiley\SmileyAction; use wcf\data\smiley\SmileyEditor; use wcf\form\AbstractForm; +use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; use wcf\system\WCF; @@ -201,10 +202,15 @@ class SmileyAddForm extends AbstractForm { } // validate smiley code and aliases against existing smilies + $conditionBuilder = new PreparedStatementConditionBuilder(); + if (isset($this->smiley)) { + $conditionBuilder->add('smileyID <> ?', array($this->smiley->smileyID)); + } $sql = "SELECT smileyCode, aliases - FROM wcf".WCF_N."_smiley"; + FROM wcf".WCF_N."_smiley + ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); + $statement->execute($conditionBuilder->getParameters()); $aliases = explode("\n", $this->aliases); while ($row = $statement->fetchArray()) {