Added missing text validation
authorMarcel Werk <burntime@woltlab.com>
Thu, 7 Mar 2013 19:30:20 +0000 (20:30 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 7 Mar 2013 19:30:20 +0000 (20:30 +0100)
files/lib/data/conversation/message/ConversationMessageAction.class.php
files/lib/form/ConversationAddForm.class.php

index b64a99ec3d0cdc5264f6fa1b1cc0931cdd783c6b..d8c94b9cd4d8cebc7797679a3d0025647286f44d 100644 (file)
@@ -352,6 +352,10 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
         * @see wcf\data\IMessageQuickReplyAction::validateMessage()
         */
        public function validateMessage(DatabaseObject $container, $message) {
+               if (StringUtil::length($message) > WCF::getSession()->getPermission('user.conversation.maxLength')) {
+                       throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.tooLong', array('maxTextLength' => WCF::getSession()->getPermission('user.conversation.maxLength'))));
+               }
+               
                // search for censored words
                if (ENABLE_CENSORSHIP) {
                        $result = Censorship::getInstance()->test($message);
index 24686f8852bfaf524fbed7d444653081b596ef46..997b65ca65b450cc76d625bd4c6419b8db3246be 100644 (file)
@@ -113,6 +113,9 @@ class ConversationAddForm extends MessageForm {
                        
                        $this->participants = $user->username;
                }
+               
+               // get max text length
+               $this->maxTextLength = WCF::getSession()->getPermission('user.conversation.maxLength');
        }
        
        /**