1 頁 (共 1 頁)

[問題] 如何防些 "滾雪球" 效應

發表於 : 2005-03-24 23:23
bebe2803
指的是
功能, 當一篇文 quote 了一篇文, 那文又被 quote 時, 就會這樣...
user 1 寫:
user2 寫:1234
abcd
user 3 內容


如果再有人 quote 後果可想而知, 有沒有辦法令 quote 預設只 quote 內容不會 quote
內的內容 ?

發表於 : 2005-03-25 01:38
動機不明
以前我都是列公告來限制的
現在有外掛輔助囉~

[外掛] Nested Quote Limit Mod(引言層次限制)

發表於 : 2005-03-25 21:08
bebe2803
那個之前看過.. (很久之前) 但因為記起因用這功能而要多 5 DB 記錄, 使用時一大堆 DB 查詢, 句子, 還真想找一個是沒有選擇, 預設就是沒有滾雪球 (即是一按 quote 只有一個引言)

我太貪心了.... @@

研究過上面的, 雖然有很多註解, 但我也看不出加, 改那些句子就可以改到只引一文...

發表於 : 2005-03-27 00:24
bebe2803
我不懂 php... (自學還未開始... 工作&家庭壓力太大....)

現在我想可不可以把上面提供的 mod 改成這樣來達到\r

"沒設定, 預設就是只留一層"

試了一會後我把碼改成這樣...

代碼: 選擇全部

#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#
   return $bbcode_tpl;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Nested Quote Limit Mod : Begin
function returnInts ($var) {
   return (is_int ($var)) ? $var : null;
}
// Nested Quote Limit Mod : End 

#
#-----[ FIND ]------------------------------------------
#
	// [code] and 
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Nested Quote Limit Mod : Begin
{
$nqlm_level = 1;

// Make sure there's enough quotes in the entire message to even
// meet the limit.
$num_quotes = preg_match_all ("/\[quote:$uid/si", $text, $matches);

if ($num_quotes > $nqlm_level) {
// Define default values.
$curr_pos = 1;
$level = 0;
while (isset ($curr_pos) && ($curr_pos < strlen ($text))) {
// Find all instances of quote tags.
$curr_pos_cmp[0] = strpos ($text, "[quote:$uid]", $curr_pos);
$curr_pos_cmp[1] = strpos ($text, "[quote:$uid=", $curr_pos);
$curr_pos_cmp[2] = strpos ($text, "[/quote:$uid]", $curr_pos);

// Filter out all the empty values to determine if we should
// continue or bail. Also makes the array play nice with min ().
$curr_pos_cmp = array_filter ($curr_pos_cmp, 'returnInts');

if (!empty ($curr_pos_cmp)) {
// Find the first tag we should deal with.
$curr_pos = min ($curr_pos_cmp);

// Set everything to false so things won't get messy with the loop.
$quote_open = null;
$quote_open_user = null;
$quote_close = null;

// Find out which type of tag we're dealing with.\r
switch ($curr_pos) {
case $curr_pos_cmp[0]:
$quote_open = true;
break;
case $curr_pos_cmp[1]:
$quote_open_user = true;
break;
case $curr_pos_cmp[2]:
$quote_close = true;
break;
}
} else {
// $curr_pos_cmp array is empty so there's nothing left to do.
$curr_pos = null;
}

// If we have a tag we'll start.
if (isset ($curr_pos)) {
// If we're in front of an opening quote tag at the maxmimum
// level, we'll insert a [quote_kill] tag.
if ((isset ($quote_open) || isset ($quote_open_user)) && $level == $nqlm_level) {
$text = substr_replace ($text, "[quote_kill:$uid]", $curr_pos, 0);
$curr_pos += strlen ("[quote_kill:$uid]");
}

// Depending on the type of tag we have, increase or decrease
// the level count and set the cursor ahead of the tag.
if (isset ($quote_open)) {
$level++;

$curr_pos += strlen ("[quote:$uid]");
} else if (isset ($quote_open_user)) {
$level++;

// Find the ending of the quote tag for usernames.
$end_bracket_pos = strpos ($text, ']', $curr_pos);
$curr_pos += (($end_bracket_pos + 1) - $curr_pos);
} else if (isset ($quote_close)) {
$level--;

$curr_pos += strlen ("[/quote:$uid]");
}

// Now we're positioned after a quote closing quote tag at
// the maximum level, so we'll insert an ending [/quote_kill] tag
if (isset ($quote_close) && $level == $nqlm_level) {
$text = substr_replace ($text, "[/quote_kill:$uid]", $curr_pos, 0);
$curr_pos += strlen ("[/quote_kill:$uid]");
}
}
}

// We've now traversed all of the text and have inserted [quote_kill]
// tags as needed. Now all we delete the tags and everything inside.
$text = preg_replace ("/(\s*)\[quote_kill:$uid\](.*?)\[\/quote_kill:$uid\](\s*)/si", ' ', $text);
}
}
// Nested Quote Limit Mod : End[/code]

這樣真的顯示不到累積 QUOTE 但是原文仍有... @@

發表於 : 2005-03-27 02:00
bebe2803
哇啊 找到了

在 phpbb 官網, phpbbhack 也找不到, 突然想到用搜查引擎打 phpbb quote, 就找到這個...

代碼: 選擇全部

  OPEN the file posting.php

  FIND:

Code: (index_body.tpl) [download]

$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';


 
  REPLACE WITH:

Code: (index_body.tpl) [download]

$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
{
	$message = preg_replace('/(\[quote=(.*?)\]((.|
)*)\[\/quote\])/si',"[...]

",$message);
}
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';



  SAVE/CLOSE/UPLOAD THE FILE

來源 : http://www.phpbbstyles.com/viewtopic.php?t=1648&start=0