<maxvalue>255</maxvalue>
<options>module_tagging</options>
</option>
+
+ <option name="message_max_quote_depth">
+ <categoryname>message.general</categoryname>
+ <optiontype>integer</optiontype>
+ <defaultvalue>1</defaultvalue>
+ <minvalue>0</minvalue>
+ <maxvalue>255</maxvalue>
+ </option>
<!-- /message.general -->
<option name="search_results_per_page">
define('MESSAGE_SIDEBAR_ENABLE_USER_ONLINE_MARKING', 1);
define('MESSAGE_SIDEBAR_USER_OPTIONS', '');
define('TAGGING_MAX_TAG_LENGTH', 30);
+define('MESSAGE_MAX_QUOTE_DEPTH', 1);
define('SEARCH_RESULTS_PER_PAGE', 20);
define('SEARCH_DEFAULT_SORT_FIELD', 'time');
define('SEARCH_DEFAULT_SORT_ORDER', 'DESC');
return $this->getHtmlInputNodeProcessor()->validate();
}
+ public function enforceQuoteDepth($depth) {
+ $this->getHtmlInputNodeProcessor()->enforceQuoteDepth($depth);
+ }
+
/**
* Returns the parsed HTML ready to store.
*
// handle static converters
$this->invokeHtmlNode(new HtmlInputNodeWoltlabMetacode());
+
+ if (MESSAGE_MAX_QUOTE_DEPTH) {
+ $this->enforceQuoteDepth(MESSAGE_MAX_QUOTE_DEPTH);
+ }
+
$this->invokeHtmlNode(new HtmlInputNodeImg());
// dynamic node handlers
EventHandler::getInstance()->fireAction($this, 'afterProcess');
}
+ public function enforceQuoteDepth($depth) {
+ $quotes = [];
+ /** @var \DOMElement $quote */
+ foreach ($this->getDocument()->getElementsByTagName('woltlab-quote') as $quote) {
+ $quotes[] = $quote;
+ }
+
+ foreach ($quotes as $quote) {
+ if (!$quote->parentNode) {
+ continue;
+ }
+
+ if ($depth === 0) {
+ DOMUtil::removeNode($quote);
+ }
+ else {
+ $level = 0;
+ $parent = $quote;
+ while ($parent = $parent->parentNode) {
+ if ($parent->nodeName === 'woltlab-quote') {
+ $level++;
+ }
+ }
+
+ if ($level < $depth) {
+ continue;
+ }
+
+ DOMUtil::removeNode($quote);
+ }
+ }
+ }
+
/**
* Fixes malformed HTML with metacode markers and text being placed
* outside of paragraphs.
$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('woltlab-quote');
- while ($elements->length) {
- DOMUtil::removeNode($elements->item(0));
+ if (MESSAGE_MAX_QUOTE_DEPTH) {
+ $htmlInputProcessor->enforceQuoteDepth(MESSAGE_MAX_QUOTE_DEPTH - 1);
}
$this->quotes[$objectType][$objectID][$quoteID] = 1;
<item name="wcf.acp.option.module_tagging"><![CDATA[Tagging]]></item>
<item name="wcf.acp.option.module_tagging.description"><![CDATA[Aktiviert die Funktion für das Taggen von Inhalten.]]></item>
<item name="wcf.acp.option.tagging_max_tag_length"><![CDATA[Maximale Tag-Länge]]></item>
+ <item name="wcf.acp.option.message_max_quote_depth"><![CDATA[Maximale Zitat-Tiefe]]></item>
+ <item name="wcf.acp.option.message_max_quote_depth.description"><![CDATA[Der Wert „1“ erlaubt nur direkte Zitate, aber keine Zitate in Zitaten. Bei „2“ oder mehr dürfen Zitate selbst Zitate enthalten bis zur angegebenen Tiefe. Mit dem Wert „0“ wird diese Funktion deaktiviert und es können beliebig oft Zitate ineinander verschachtelt werden.]]></item>
<item name="wcf.acp.option.category.message.search"><![CDATA[Suchfunktion]]></item>
<item name="wcf.acp.option.search_results_per_page"><![CDATA[Ergebnisse pro Seite]]></item>
<item name="wcf.acp.option.search_default_sort_field"><![CDATA[Standardsortierung]]></item>
<item name="wcf.acp.option.module_tagging"><![CDATA[Tags]]></item>
<item name="wcf.acp.option.module_tagging.description"><![CDATA[Enables the use of tags for content.]]></item>
<item name="wcf.acp.option.tagging_max_tag_length"><![CDATA[Maximum Tag Length]]></item>
+ <item name="wcf.acp.option.message_max_quote_depth"><![CDATA[Maximum Quote Nesting]]></item>
+ <item name="wcf.acp.option.message_max_quote_depth.description"><![CDATA[The value “1” allows for direct quotes only, quotes contained within quotes will be removed. Setting this to “2” or more allows quotes to be nested up to the configured depth. You can disable this by setting the value to “0”, allowing for infinite quote nesting.]]></item>
<item name="wcf.acp.option.category.message.search"><![CDATA[Search]]></item>
<item name="wcf.acp.option.search_results_per_page"><![CDATA[Results per Page]]></item>
<item name="wcf.acp.option.search_default_sort_field"><![CDATA[Sort by]]></item>