Removed quotes from quoted messages
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / message / quote / MessageQuoteManager.class.php
index 702a3a750b2b440882288e2e667bc5d11ad92d10..163f9f018ca1f69d64041e234b2d75a23f947e78 100644 (file)
@@ -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();