
BBcode MOD en CENTER werkt niet meer
Forumregels
Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.

Ha, de hulptroepen zijn gekomen en hebben de MOD herschreven!
Hulde aan JOOSTDJ
Hulde aan JOOSTDJ
Code: Selecteer alles
##############################################################
## MOD Title: BBcode moderation (BB code & mod)
## MOD Author: Ralendil < ralendil@hotmail.com > Ravaille Franck - http://civs.org
## MOD Description: Permit to use a special BB code for your moderation.
## MOD Version: 1.0.4
## Installation Level: Intermediate
## Installation Time: 5 min
## Files to Edit: includes/bbcode.php,
## posting.php,
## includes/functions_post.php,
## templates/subSilver/bbcodes.tpl,
## templates/subSilver/subSilver.css,
## templates/subSilver/overall_header.tpl,
## language/lang_english/lang_main.php
## Included Files: N/A
##############################################################
## Author Notes:
## Version 1.0.4 is rewritten and released by JoostDJ
##
##############################################################
## MOD HISTORY
##
## 0.0.1 Beta: Doesn't work cause of Subsilver template that work in a special way.
## 1.0.0 Release: Work perfectly.
## 1.0.1 Correction (code forgotten).
## 1.0.2 Only Admin and modo can edit or post messages with BBcode moderation.
## Now this mod isn't only a bbcode.
## 1.0.3 MOD doesn't work properly since PHPBB version 2.0.19
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## Before installation please undo the installation of previous versions!
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['quote_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_open']);
$bbcode_tpl['quote_username_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_username_open']);
$bbcode_tpl['quote_username_open'] = str_replace('{L_WROTE}', $lang['wrote'], $bbcode_tpl['quote_username_open']);
$bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\\1', $bbcode_tpl['quote_username_open']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$bbcode_tpl['mod_open'] = str_replace('{L_MOD}', $lang['Mod'], $bbcode_tpl['mod_open']);
$bbcode_tpl['mod_username_open'] = str_replace('{L_MOD}', $lang['Mod'], $bbcode_tpl['mod_username_open']);
$bbcode_tpl['mod_username_open'] = str_replace('{L_BY}', $lang['By'], $bbcode_tpl['mod_username_open']);
$bbcode_tpl['mod_username_open'] = str_replace('{USERNAME}', '\\1', $bbcode_tpl['mod_username_open']);
#
#-----[ FIND ]------------------------------------------
#
// New one liner to deal with opening quotes with usernames...
// replaces the two line version that I had here before..
$text = preg_replace("/\[quote:$uid=\"(.*?)\"\]/si", $bbcode_tpl['quote_username_open'], $text);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// MOD Mod quote
$text = str_replace("[mod:$uid]", $bbcode_tpl['mod_open'], $text);
$text = str_replace("[/mod:$uid]", $bbcode_tpl['mod_close'], $text);
$text = preg_replace("/\[mod:$uid=\"(.*?)\"\]/si", $bbcode_tpl['mod_username_open'], $text);
#
#-----[ FIND ]------------------------------------------
#
// [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff.
$text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, '');
$text = bbencode_first_pass_pda($text, $uid, '/\[quote=\\\\"(.*?)\\\\"\]/is', '[/quote]', '', false, '', "[quote:$uid=\\\"\\1\\\"]");
#
#-----[ AFTER, ADD ]------------------------------------------
#
// MOD Mod Quote
$text = bbencode_first_pass_pda($text, $uid, '[mod]', '[/mod]', '', false, '');
$text = bbencode_first_pass_pda($text, $uid, '/\[mod=\\\\"(.*?)\\\\"\]/is', '[/mod]', '', false, '', "[mod:$uid=\\\"\\1\\\"]");
#
#-----[ FIND ]------------------------------------------
#
//
// We're going to try and catch usernames with "[' characters.
//
if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) )
{
// OK we are in a quote tag that probably contains a ] bracket.
// Grab a bit more of the string to hopefully get all of it..
if ($close_pos = strpos($text, '"]', $curr_pos + 14))
{
if (strpos(substr($text, $curr_pos + 14, $close_pos - ($curr_pos + 14)), '[quote') === false)
{
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 7);
}
}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// MOD Mod Quote
//
if( preg_match('#\[mod=\\\"#si', $possible_start, $match) && !preg_match('#\[mod=\\\"(.*?)\\\"\]#si', $possible_start) )
{
// OK we are in a mod tag that probably contains a ] bracket.
// Grab a bit more of the string to hopefully get all of it..
if ($close_pos = strpos($text, '"]', $curr_pos + 14))
{
if (strpos(substr($text, $curr_pos + 14, $close_pos - ($curr_pos + 14)), '[mod') === false)
{
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 7);
}
}
}
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'editpost' )
{
$attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0;
$user_sig = $post_info['user_sig'];
$html_on = ( $post_info['enable_html'] ) ? true : false;
$bbcode_on = ( $post_info['enable_bbcode'] ) ? true : false;
$smilies_on = ( $post_info['enable_smilies'] ) ? true : false;
#
#-----[ AFTER, ADD ]------------------------------------------
#
/*BEGIN Moderation BBcode*/
// Is this post isn't moderated yet?
if (($userdata['user_level'] != ADMIN) and ($userdata['user_level'] != MOD))
{
if( (preg_match("[mod:$uid]", $message)) || (preg_match("/\[mod:$uid=\"(.*?)\"\]/si", $message)) || (preg_match("[/mod:$uid]", $message)) )
{
message_die(GENERAL_MESSAGE, $lang['Mod_authorisation'], $lang['Moderation']);
}
}
/*END Moderation BBcode*/
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
// Check message
if (!empty($message))
{
$bbcode_uid = ($bbcode_on) ? make_bbcode_uid() : '';
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
#
#-----[ AFTER, ADD ]------------------------------------------
#
/*BEGIN Moderation BBcode*/
// Is this post countain moderation BBcode?
if (($userdata['user_level'] != ADMIN) and ($userdata['user_level'] != MOD))
{
if( (preg_match("[mod:$uid]", $message)) || (preg_match("/\[mod:$uid=\"(.*?)\"\]/si", $message)) || (preg_match("[/mod:$uid]", $message)) )
{
message_die(GENERAL_MESSAGE, $lang['Mod_reserved'], $lang['Moderation']);
}
}
/*END Moderation BBcode*/
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcodes.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</A><!-- END email -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN mod_username_open --></span>
<table width="75%" cellspacing="1" cellpadding="3" border="1" align="center">
<tr>
<td><span class="genmed"><b>{L_MOD} {L_BY} {USERNAME}:</b></span></td>
</tr>
<tr>
<td class="mod"><!-- END quote_username_open -->
<!-- BEGIN mod_open --></span>
<table width="75%" cellspacing="1" cellpadding="3" border="1" align="center">
<tr>
<td><span class="genmed"><b>{L_MOD}:</b></span></color></td>
</tr>
<tr>
<td class="mod"><!-- END mod_open -->
<!-- BEGIN mod_close --></td>
</tr>
</table>
<span class="postbody"><!-- END mod_close -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.css
#
#-----[ FIND ]------------------------------------------
#
.quote {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #444444; line-height: 125%;
background-color: #FAFAFA; border: #D1D7DC; border-style: solid;
border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
.mod {
font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #D61717; line-height: 125%;
background-color: #f1e1b1; border: #D61717; border-style: solid; font-weight : bold;
border-left-width: 2px; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
.quote {
font-family: {T_FONTFACE1}; font-size: {T_FONTSIZE2}px; color: {T_FONTCOLOR1}; line-height: 125%;
background-color: {T_TD_COLOR1}; border: {T_TR_COLOR3}; border-style: solid;
border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
.mod {
font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #D61717; line-height: 125%;
background-color: #f1e1b1; border: #D61717; border-style: solid; font-weight : bold;
border-left-width: 2px; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px
}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['wrote'] = 'wrote'; // proceeds the username and is followed by the quoted text
$lang['Quote'] = 'Quote'; // comes before bbcode quote output.
$lang['Code'] = 'Code'; // comes before bbcode code output.
#
#-----[ AFTER, ADD ]------------------------------------------
#
/* BEGIN Moderation mod*/
$lang['By'] = 'by';
$lang['Mod'] = 'Moderation';
$lang['Mod_authorisation'] = 'Sorry, your post has been moderated so you can\'t edit it. If you want changing something you should contact the board administrator.';
$lang['Mod_reserved'] = 'Sorry, you don\'t be allowed to use the BBcode reserved to moderation !';
$lang['Moderation'] = 'Moderation restrictions';
/* END Moderation mod*/
#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
#
# EoM
En zo is het!
En is nu dan ook de fout weg als er in een bericht staat:djrandall schreef:Ha, de hulptroepen zijn gekomen en hebben de MOD herschreven!
Hulde aan JOOSTDJ
Code: Selecteer alles
[mod="Admin"]bericht[/mod]
Code: Selecteer alles
[mod=Admin]bericht[/mod]
Laatst gewijzigd door Derky op 31 jan 2006, 18:43, 1 keer totaal gewijzigd.
Ik denk, zal me hier ook eens aanmelden
Bij de nieuwe versie die ik heb geschreven is rekening gehouden met alle security issues die in PHPBB 2.0.19 zijn verholpen. Volledig safe dus!
Ook is er geen probleem meer bij het editen van een gemodereerde post.
Let er wel op dat je de code van eerder versies weghaalt omdat de lokatie van het één en ander veranderd is.

Bij de nieuwe versie die ik heb geschreven is rekening gehouden met alle security issues die in PHPBB 2.0.19 zijn verholpen. Volledig safe dus!
Ook is er geen probleem meer bij het editen van een gemodereerde post.
Let er wel op dat je de code van eerder versies weghaalt omdat de lokatie van het één en ander veranderd is.
Werkt deze niet meer??
http://www.phpbb.nl/viewtopic.php?t=23213
Ik heb nog geen tijd gehad om het te testen..

http://www.phpbb.nl/viewtopic.php?t=23213
Ik heb nog geen tijd gehad om het te testen..