Do cleanup before adding a message to search index
authorMarcel Werk <burntime@woltlab.com>
Fri, 15 Jul 2016 12:00:49 +0000 (14:00 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 15 Jul 2016 12:00:49 +0000 (14:00 +0200)
wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php

index d1fba778837aa2d150abdf2a85a8be2e7ae9c83e..c1714b98cc29f344f99422debb9fbd02fad61943 100644 (file)
@@ -7,6 +7,7 @@ use wcf\data\package\PackageList;
 use wcf\system\exception\SystemException;
 use wcf\system\search\mysql\MysqlSearchIndexManager;
 use wcf\system\SingletonFactory;
+use wcf\util\StringUtil;
 
 /**
  * Manages the search index.
@@ -103,6 +104,9 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager
         * @inheritDoc
         */
        public function set($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID = null, $metaData = '') {
+               // strip html; remove whitespace from beginning and end of the message
+               $message = StringUtil::trim(StringUtil::stripHTML($message));
+               
                $this->getSearchIndexManager()->set($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData);
        }