Re: [extension release] pun_quote 2.0.2
New version pun_quote 2.2 has been released. Quoted text is added to the current cursor position now.
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 extensions → [extension release] pun_quote 2.0.2
New version pun_quote 2.2 has been released. Quoted text is added to the current cursor position now.
Here is one question extension really works good, I use [hide=some number][/hide] tag, so on using your extension it shows all the hiden content what doesn't do good fjob for my forum, can you offer the correct replacement for this tag in order to delete this block from the 'quote'
Thanks
Study the code of the function "do_bbcode" in the file "<FORUM_ROOT>/include/parser.php". This function replaces bbcode tags with HTML tags
Study the code of the function "do_bbcode" in the file "<FORUM_ROOT>/include/parser.php". This function replaces bbcode tags with HTML tags
Hide tag works perfectly with the posts, it has only bag if I click "quick quote" your javascript grabs the whole post content together with the hide tag.
with the parser.php have the following block
/// MOD HIDE TAG begin
if (strpos($text, 'hide=') !== false)
{
if ($forum_user['is_guest'])
{
$text = preg_replace("#\[hide=([0-9]*)](.+?)\[/hide\]#is", '<div style="margin: 5px 20px 20px 20px;"><table cellpadding="0" cellspacing="0" border="0" width="100%"><td style="border:1px inset; background: #e8ecef"><i> <font color="red">('.$lang_topic['Hidden text guest'].')</font></i></td>
</td></table></div>', $text);
}
else
{
preg_match('#\[hide=([0-9]*)]#s',$text,$hide_count);
if($hide_count[1]<0) $hide_count[1]=0;
if(($forum_user['g_id'] == FORUM_MOD) || ($forum_user['g_id'] == FORUM_ADMIN) || (($forum_user['num_posts']) >= ($hide_count[1])))
{
$text = preg_replace('#\[hide=([0-9]*)](.*?)\[/hide\]#s', '<div style="margin: 5px 20px 20px 20px;"><table cellpadding="0" cellspacing="0" border="0" width="100%"><td style="border:1px inset; background: #e8ecef"><i>'.$lang_topic['Hidden text'].':<br><i>$2</i></i></td>
</td></table></div>', $text);
}
else
{
$text = preg_replace("#\[hide=([0-9]*)](.+?)\[/hide\]#is", '<div style="margin: 5px 20px 20px 20px;"><table cellpadding="0" cellspacing="0" border="0" width="100%"><td style="border:1px inset; background: #e8ecef"><i> <font color="red">('.$lang_topic['Hidden count begin'].' '.$hide_count[1].' '.$lang_topic['Hidden count end'].')</font></i></td>
</td></table></div>', $text);
}
}
}
if (strpos($text, 'hide') !== false)
{
if ($forum_user['is_guest'])
{
$text = preg_replace("#\[hide\](.+?)\[/hide\]#is", '<b>['.$lang_topic['Hidden text guest'].']</b>', $text);
}
else
{
$text = str_replace('[hide]', '<blockquote>'.$lang_topic['Hidden text'].':<br><i>', $text);
$text = preg_replace('#\[\/hide\]\s*#', '</i></blockquote>', $text);
}
}
// MOD HIDE TAG end
So as I understand the hide variable should be added to the this function with property to hide text or any content in
[hide=][/hide]
function QuickQuote(qid_param)
{
var selected_text = getSelectedText();
var quick_post_value = document.getElementsByName('req_message');
var cur_pos = getCaretPos();
var text = quick_post_value[0].value;
var text_below = text.substring(0, cur_pos);
var text_above = text.substring(cur_pos, text.length);
[b]if (selected_text == undefined || selected_text == '')[/b]
{
var quote = '[quote=' + pun_quote_authors[qid_param] + ']' + ParseMessage(pun_quote_posts[qid_param]) + '[/quote]';
quick_post_value[0].value = text_below + quote + text_above;
}
I think it will be better to modify the function "ParseMessage". It will be:
function ParseMessage(string)
{
var search_arr = new Array(/&/g, /"/g, /'/g, /</g, />/g);
var replace_arr = new Array('&', '"', '\'', '<', '>');
for (var replace_num = 0; replace_num < search_arr.length; replace_num++)
string = string.replace(search_arr[replace_num], replace_arr[replace_num]);
string = string.replace(/\[hide=?\].*\[\/hide\]/g, '');
return string;
}
Report about results of this changes, please.
This function gives no result it doesn't hide content in [hide=?][/hide] and the hidden links also can be seen in html code by browsing java script the pun_quote creates.
the problem can be seen here http://blog.dynotab.com.ua/viewtopic.php?id=23
Is this code works for you?
function ParseMessage(string)
{
var search_arr = new Array(/&/g, /"/g, /'/g, /</g, />/g);
var replace_arr = new Array('&', '"', '\'', '<', '>');
for (var replace_num = 0; replace_num < search_arr.length; replace_num++)
string = string.replace(search_arr[replace_num], replace_arr[replace_num]);
string = string.replace('(Скрытый текст доступен для пользователей с определенным количеством сообщений.)', '');
return string;
}
This code doesn't work it gives the results as previous, by the link from the forum
http://blog.dynotab.com.ua/viewtopic.php?id=23
[quote=G. Spider]ДСТУ 3099-95 Спирт етиловий ректифікований із меляси високоякісний.
Технічні умови
[hide=30][url=http://blog.dynotab.com.ua/norma/8_d3099-95.djv]загрузить>>>[/url][/hide]
Файл в формате djv
Для просмотра необходим Djvu Viewer скачать по следующей ссылке| [url=http://depositfiles.com/files/8mq7o8s05l target="_blank"][color=blue]загрузить>>>[/color][/url][/quote]
I'm stuck at this moment !
If any post is ended by backslash, pun_quote's javascript code will be corrupted on whole page. For example: :\
Fixed and the new version of pun_quote (2.2.1) is released.
New bug: "\n" symbols in quoted text.
I think it will be better to modify the function "ParseMessage". It will be:\n
\nfunction ParseMessage(string)\n{\n var search_arr = new Array(/&/g, /"/g, /'/g, /</g, />/g);\n var replace_arr = new Array('&', '"', '\'', '<', '>');\n for (var replace_num = 0; replace_num < search_arr.length; replace_num++)\n string = string.replace(search_arr[replace_num], replace_arr[replace_num]);\n string = string.replace(/\[hide=?\].*\[\/hide\]/g, '');\n return string;\n}\n
\nReport about results of this changes, please.
Thanks for reporting. Fixed and the new version (2.2.2) is released.
Another bug in IE 6 - 8: after clicking "Quick quote" link, user is redirected to reply page.
Can anyone please update this and make this work for 1.4.2. Its a very nice feature, especially for quick multi quote for qucik reply.
I tested this with 1.4.2, it works in Chrome 21.0, IE9 and FF 15.0
PunBB Forums → PunBB 1.3 extensions → [extension release] pun_quote 2.0.2
Powered by PunBB, supported by Informer Technologies, Inc.