Fixed quote bbcode issue
authorMarcel Werk <burntime@woltlab.com>
Sun, 21 Jun 2015 22:55:18 +0000 (00:55 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 21 Jun 2015 22:55:18 +0000 (00:55 +0200)
wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php
wcfsetup/install/files/lib/system/message/embedded/object/AbstractMessageEmbeddedObjectHandler.class.php

index df7f8f26964e33703037d5b868ab6592405f8413..6c5ed066082af1c99b2e543f7dd587c13c1d841f 100644 (file)
@@ -4,6 +4,7 @@ use wcf\system\application\ApplicationHandler;
 use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
 use wcf\system\request\RouteHandler;
 use wcf\system\WCF;
+use wcf\util\StringUtil;
 
 /**
  * Parses the [quote] bbcode tag.
@@ -29,7 +30,7 @@ class QuoteBBCode extends AbstractBBCode {
                        $quoteAuthor = (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '');
                        $quoteAuthorObject = null;
                        if ($quoteAuthor && !$externalQuoteLink) {
-                               $quoteAuthorLC = mb_strtolower($quoteAuthor);
+                               $quoteAuthorLC = mb_strtolower(StringUtil::decodeHTML($quoteAuthor));
                                foreach (MessageEmbeddedObjectManager::getInstance()->getObjects('com.woltlab.wcf.quote') as $user) {
                                        if (mb_strtolower($user->username) == $quoteAuthorLC) {
                                                $quoteAuthorObject = $user;
index 6e53b5a398a1d54050c1d0e6ad09ea6aae243b4e..71bd77daffafc18f546f2d7a3a8495f4bd8cd388 100644 (file)
@@ -46,13 +46,22 @@ abstract class AbstractMessageEmbeddedObjectHandler extends DatabaseObjectDecora
         */
        public static function getFirstParameters($message, $bbcode) {
                $pattern = '~\['.$bbcode.'=
-                               (?:\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|([^,\]]*))
+                               (\'(?:[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|(?:[^,\]]*))
                                (?:,(?:\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^,\]]*))*
                        \]~ix';
                
                if (preg_match_all($pattern, $message, $matches)) {
+                       foreach ($matches[1] as &$value) {
+                               // remove quotes
+                               if (mb_substr($value, 0, 1) == "'" && mb_substr($value, -1) == "'") {
+                                       $value = str_replace("\'", "'", $value);
+                                       $value = str_replace("\\\\", "\\", $value);
+                               
+                                       $value = mb_substr($value, 1, -1);
+                               }
+                       }
+                       
                        $results = ArrayUtil::trim($matches[1]);
-                       $results = array_merge($results, ArrayUtil::trim($matches[2]));
                        $results = array_unique($results);
                        
                        return $results;