From: Alexander Ebert Date: Fri, 19 Aug 2016 13:08:04 +0000 (+0200) Subject: Removed quotes from quoted messages X-Git-Tag: 3.0.0_Beta_1~663 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=417d3ce19644669623c484325f767361c3e2f9cc;p=GitHub%2FWoltLab%2FWCF.git Removed quotes from quoted messages --- diff --git a/wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php b/wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php index 478317c333..d916646b5d 100644 --- a/wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php @@ -64,6 +64,17 @@ class HtmlInputProcessor extends AbstractHtmlProcessor { $this->embeddedContent = $this->getHtmlInputNodeProcessor()->getEmbeddedContent(); } + /** + * Processes a HTML string to provide the general DOM API. This method + * does not perform any filtering or validation. You SHOULD NOT use this + * to deal with HTML that has not been filtered previously. + * + * @param string $html html string + */ + public function processIntermediate($html) { + $this->getHtmlInputNodeProcessor()->load($this, $html); + } + /** * Processes only embedded content. This method should only be called when rebuilding * data where only embedded content is relevant, but no actual parsing is required. diff --git a/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php b/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php index 702a3a750b..163f9f018c 100644 --- a/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php @@ -4,9 +4,11 @@ use wcf\data\object\type\ObjectType; use wcf\data\object\type\ObjectTypeCache; use wcf\data\IMessage; use wcf\system\exception\SystemException; +use wcf\system\html\input\HtmlInputProcessor; use wcf\system\SingletonFactory; use wcf\system\WCF; use wcf\util\ArrayUtil; +use wcf\util\DOMUtil; /** * Manages message quotes. @@ -128,8 +130,17 @@ class MessageQuoteManager extends SingletonFactory { $this->quoteData[$quoteID.'_pID'] = $parentObjectID; if (!empty($fullQuote)) { + // strip quotes container in full quote + $htmlInputProcessor = new HtmlInputProcessor(); + $htmlInputProcessor->processIntermediate($fullQuote); + + $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('blockquote'); + while ($elements->length) { + DOMUtil::removeNode($elements->item(0)); + } + $this->quotes[$objectType][$objectID][$quoteID] = 1; - $this->quoteData[$quoteID.'_fq'] = $fullQuote; + $this->quoteData[$quoteID.'_fq'] = $htmlInputProcessor->getHtml(); } $this->updateSession();