From bb5cf86a6d9bc59af39b2f167a35963786f38e55 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 22 Jun 2015 00:55:18 +0200 Subject: [PATCH] Fixed quote bbcode issue --- .../files/lib/system/bbcode/QuoteBBCode.class.php | 3 ++- .../AbstractMessageEmbeddedObjectHandler.class.php | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php index df7f8f2696..6c5ed06608 100644 --- a/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php @@ -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; diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/AbstractMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/AbstractMessageEmbeddedObjectHandler.class.php index 6e53b5a398..71bd77daff 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/AbstractMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/AbstractMessageEmbeddedObjectHandler.class.php @@ -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; -- 2.20.1