[phpBB3 3.0.8 MOD] Kill Extra Quote (english)

WEB, Hardware, Software e generali

Moderatore: MODERATORE

Rispondi
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

[phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

Modification Name: Kill Extra quote Mod
Author: Rombo di Tuono

Modification Description: "Kill Extra Quote" Mod ERASES from the posting form (textarea) the nested quote that exceed the limit set in ACP.
Modification Version: 1.0 RC1

Requirements: phpBB 3.0.x

Features:
How it works:
Instead of blocking user from posting a message with too many nested quote, the Kill Extra Quote Mod erases the exceeding quotes at the moment the user presses the "quote" button.
So the user finds in the textarea form posting the correct numebr of nested quotes, because the mod has taken away the oldest.

Demos and instructions follow.

Eugy ROMBO di TUONO
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

INSTRUCTIONS

Messaggio da Rombo di Tuono »

Instructions:

Whole MOD is in three steps
STEP 1
OPEN phpbb root/includes/function_posting.php

FIND

Codice: Seleziona tutto

?>
BEFORE-ADD

Codice: Seleziona tutto

// begin MOD Kill Extra Quote
function remove_quote($quoted_text, $max_quote_nest)
{
/*
$max_quote_nest is set in ACP, and passed to the funcion
*/
if ($max_quote_nest > 0) {
	// constants for begin and end tag quote
	$beginquote = "[quote=";
	$endquote = "[/quote";
	// better they have same lenght
	$ctrl_len = 7;
	$quote_to_kill = $max_quote_nest -1;
	$output = "";
	$purged_text = "";
	$nest_count = 0;
	$killing = false; // determines if that part of quoted text must be taken away

	for ($i = 0; $i<=strlen($quoted_text); $i++)
	{
	$char = substr($quoted_text, $i, 1);
		if ($char == "[")
		{
		$control = substr($quoted_text, $i, $ctrl_len);
		if ($control == $beginquote ) {
			$nest_count++;
			}
		if ($control == $endquote ) {
			$nest_count--;
			if ($killing) { // if you find an end quote while in 'killing mode' you CAN stripe it at this point
				$i = $i + $ctrl_len +1;
				$char = substr($quoted_text, $i, 1);
				}
			}
		if ($nest_count > $quote_to_kill ) {
			$killing = true;
		} else {
			$killing = false;
			}
		} // end of bracket check
	if (!$killing) {
		$output = $output . $char;
		}
	}
return $output;
} else {
return $quoted_text;
}
} // END MOD Kill Extra Quote

Eugy ROMBO di TUONO
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

Re: [phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

STEP 2

OPEN phpbb root/posting.php

FIND

Codice: Seleziona tutto

$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
REPLACE WITH

Codice: Seleziona tutto

$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . remove_quote(censor_text(trim($message_parser->message)), $config['max_quote_depth']) . "[/quote]\n";
STEP 3

FIND (few rows below)

Codice: Seleziona tutto

$message = censor_text(trim($message_parser->message));
REPLACE WITH

Codice: Seleziona tutto

$message = remove_quote(censor_text(trim($message_parser->message)), $config['max_quote_depth']);

Eugy ROMBO di TUONO
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

Re: [phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

example text 1
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

Re: [phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

Rombo di Tuono ha scritto:example text 1
example 2
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

Re: [phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

Rombo di Tuono ha scritto:
Rombo di Tuono ha scritto:example text 1
example 2
example text 3

My forum allows TWO nested quote:

try to quote this message and you'll find NOT, in the message area, the inner quote "example text 1"
Avatar utente
Rombo di Tuono
Site Admin
Messaggi: 7068
Iscritto il: 04 lug 2007, 18:07
Località: Seconda stella a DESTRA...
Contatta:

Re: [phpBB3 3.0.8 MOD] Kill Extra Quote (english)

Messaggio da Rombo di Tuono »

Here's the result of quoting the above post:

Immagine
Rispondi