Habe mal ne Frage an die Profis hier
Da ich vom selber Modden nicht viel verstehe!
Meine Frage ist wie muss ich diesen Mod anpassen, das Gäste als auch Benutzer erst Antworten müssen, um den Hidden Text zu sehen!
Ps. Falls es nicht also kompliziert ist evtl noch das nur die Admins & Mods
Die Hidden Buttons benutzen können!
Code: Alles auswählen
##############################################################
## MOD Title: Hide MOD plus
## MOD Author: OXPUS < webmaster@oxpus.de > (Karsten Ude) http://www.oxpus.de
## MOD Description: Based on the original HIDE MOD by Philiweb this MOD inserts two
## BBCodes each user can use to hide text from guests and/or users
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5-10 Minutes
## Files To Edit: 10
## includes/bbcode.php
## includes/page_header.php
## includes/topic_review.php
## languages/lang_english/lang_main.php
## languages/lang_german/lang_main.php
## posting.php
## viewtopic.php
## search.php
## templates/subSilver/bbcode.tpl
## templates/subSilver/posting_body.tpl
##
## Included Files: N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##############################################################
## MOD History:
##
## 2005-11-03 - Version 1.0.0
## - First release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$bbcode_tpl['show'] = str_replace('{PROTECTED_MESSAGE}', $lang['Protected_message'], $bbcode_tpl['show']);
$bbcode_tpl['show'] = str_replace('{HTEXTE}', '\\1', $bbcode_tpl['show']);
$bbcode_tpl['hide'] = str_replace('{PROTECTED_MESSAGE}', $lang['Protected_message'], $bbcode_tpl['hide']);
$bbcode_tpl['hide'] = str_replace('{PROTECTED_MESSAGE_MOD}', $lang['Protected_message_mod'], $bbcode_tpl['hide']);
$bbcode_tpl['show_user'] = str_replace('{PROTECTED_MESSAGE}', $lang['Protected_message'], $bbcode_tpl['show_user']);
$bbcode_tpl['show_user'] = str_replace('{HTEXTE_USER}', '\\1', $bbcode_tpl['show_user']);
$bbcode_tpl['hide_user'] = str_replace('{PROTECTED_MESSAGE}', $lang['Protected_message'], $bbcode_tpl['hide_user']);
$bbcode_tpl['hide_user'] = str_replace('{PROTECTED_MESSAGE_USER}', $lang['Protected_message_user'], $bbcode_tpl['hide_user']);
#
#-----[ FIND ]------------------------------------------
#
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//[hide]message[/hide]
$text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[hide:$uid]\\1[/hide:$uid]", $text);
//[hide_user]message[/hide_user]
$text = preg_replace("#\[hide_user\](.*?)\[\/hide_user\]#si","[hide_user:$uid]\\1[/hide_user:$uid]", $text);
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
function hide_in_quote($text)
{
$text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","--- phpBB : The Protected Message is not copied in this quote ---", $text);
return $text;
}
function hide_in_quote_user($text)
{
$text = preg_replace("#\[hide_user\](.*?)\[\/hide_user\]#si","--- phpBB : The Protected Message is not copied in this quote ---", $text);
return $text;
}
function bbencode_third_pass($text, $uid, $deprotect)
{
global $bbcode_tpl;
// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;
// First: If there isn't a "[" and a "]" in the message, don't bother.
if (! (strpos($text, "[") && strpos($text, "]")) )
{
// Remove padding, return.
$text = substr($text, 1);
return $text;
}
// Patterns and replacements for URL and email tags..
$patterns = array();
$replacements = array();
if ( $deprotect ) {
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['show'];
}
else
{
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['hide'];
}
$text = preg_replace($patterns, $replacements, $text);
// Remove our padding from the string..
$text = substr($text, 1);
return $text;
}
function bbencode_third_pass_user($text, $uid, $deprotect)
{
global $bbcode_tpl;
// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;
// First: If there isn't a "[" and a "]" in the message, don't bother.
if (! (strpos($text, "[") && strpos($text, "]")) )
{
// Remove padding, return.
$text = substr($text, 1);
return $text;
}
// Patterns and replacements for URL and email tags..
$patterns = array();
$replacements = array();
if ( $deprotect ) {
$patterns[0] = "#\[hide_user:$uid\](.*?)\[/hide_user:$uid\]#si";
$replacements[0] = $bbcode_tpl['show_user'];
}
else
{
$patterns[0] = "#\[hide_user:$uid\](.*?)\[/hide_user:$uid\]#si";
$replacements[0] = $bbcode_tpl['hide_user'];
}
$text = preg_replace($patterns, $replacements, $text);
// Remove our padding from the string..
$text = substr($text, 1);
return $text;
}
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------
#
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
if ( $row = $db->sql_fetchrow($result) )
{
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$valid = $is_auth['auth_mod'] ? TRUE : FALSE;
$valid_user = ($userdata['session_logged_in']) ? TRUE : FALSE;
#
#-----[ FIND ]------------------------------------------
#
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
$message = bbencode_third_pass_user($message, $bbcode_uid, $valid_user);
#
#-----[ OPEN ]------------------------------------------
#
languages/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_h_help'] = "Hide: [hide]message[/hide] (alt+h)";
$lang['bbcode_hu_help'] = "Hide for user: [hide_user]message[/hide_user] (alt+H)";
$lang['Protected_message'] = 'Protected Message';
$lang['Protected_message_mod'] = '<b>This text is protected!</b> Login as an Administrator or Moderator to read this text!';
$lang['Protected_message_user'] = '<b>This text is protected!</b> Login to read this text!';
#
#-----[ OPEN ]------------------------------------------
#
languages/lang_german/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['bbcode_f_help'] = 'Schriftgröße: [size=x-small]Kleiner Text[/size]';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_h_help'] = "Verstecke: [hide]message[/hide] (alt+h)";
$lang['bbcode_hu_help'] = "Verstecke vor Benutzer: [hide_user]message[/hide_user] (alt+H)";
$lang['Protected_message'] = 'Geschützter Text';
$lang['Protected_message_mod'] = '<b>Dieser Text ist geschützt!</b> Melde Dich als Administrator oder Moderator an, um diesen Text zu lesen.';
$lang['Protected_message_user'] = '<b>Dieser Text ist geschützt!</b> Melde Dich an, um diesen Text zu lesen.';
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )
{
$user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
}
if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
$valid = $is_auth['auth_mod'] ? TRUE : FALSE;
$valid_user = ($userdata['session_logged_in']) ? TRUE : FALSE;
if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )
{
$user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
$user_sig = bbencode_third_pass($user_sig, $userdata['user_sig_bbcode_uid'], $valid);
$user_sig = bbencode_third_pass_user($user_sig, $userdata['user_sig_bbcode_uid'], $valid_user);
}
if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
$preview_message = bbencode_third_pass($preview_message, $bbcode_uid, $valid);
$preview_message = bbencode_third_pass_user($preview_message, $bbcode_uid, $valid_user);
}
#
#-----[ FIND ]------------------------------------------
#
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
{
$subject = 'Re: ' . $subject;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if (!$valid)
{
$message = hide_in_quote($message);
}
if (!$valid_user)
{
$message = hide_in_quote_user($message);
}
#
#-----[ FIND ]------------------------------------------
#
"L_BBCODE_F_HELP" => $lang['bbcode_f_help'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_BBCODE_H_HELP" => $lang['bbcode_h_help'],
"L_BBCODE_HU_HELP" => $lang['bbcode_hu_help'],
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
//
// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$valid = $is_auth['auth_mod'] ? TRUE : FALSE;
$valid_user = ($userdata['session_logged_in']) ? TRUE : FALSE;
#
#-----[ FIND ]------------------------------------------
#
$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_sig = bbencode_third_pass($user_sig, $user_sig_bbcode_uid, $valid);
$user_sig = bbencode_third_pass_user($user_sig, $user_sig_bbcode_uid, $valid_user);
#
#-----[ FIND ]------------------------------------------
#
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
$message = bbencode_third_pass_user($message, $bbcode_uid, $valid_user);
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( $return_chars != -1 )
#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if( $return_chars == -1 )
#
#-----[ FIND ]------------------------------------------
#
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$message = bbencode_third_pass($message, $bbcode_uid, FALSE);
$message = bbencode_third_pass_user($message, $bbcode_uid, FALSE);
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</a><!-- END email -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN show -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{PROTECTED_MESSAGE}</b></span></td>
</tr>
<tr>
<td class="quote">
{HTEXTE}
</td>
</tr>
</table>
<span class="postbody">
<!-- END show -->
<!-- BEGIN hide -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{PROTECTED_MESSAGE}</b></span></td>
</tr>
<tr>
<td class="quote">
<center>{PROTECTED_MESSAGE_MOD}</center>
</td>
</tr>
</table>
<span class="postbody">
<!-- END hide -->
<!-- BEGIN show_user -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{PROTECTED_MESSAGE}</b></span></td>
</tr>
<tr>
<td class="quote">
{HTEXTE_USER}
</td>
</tr>
</table>
<span class="postbody">
<!-- END show_user -->
<!-- BEGIN hide_user -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{PROTECTED_MESSAGE}</b></span></td>
</tr>
<tr>
<td class="quote">
<center>{PROTECTED_MESSAGE_USER}</center>
</td>
</tr>
</table>
<span class="postbody">
<!-- END hide_user -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";
#
#-----[ AFTER, ADD ]------------------------------------------
#
h_help = "{L_BBCODE_H_HELP}";
H_help = "{L_BBCODE_HU_HELP}";
#
#-----[ FIND ]------------------------------------------
#
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','- ','
- ','
#
#-----[ IN-LINE FIND ]------------------------------------------
#
);
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
, '[hide]', '[/hide]', '[hide_user]', '[/hide_user]'
#
#-----[ FIND ]------------------------------------------
#
<td><span class="genmed">
<input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
</span></td>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<td><span class="genmed">
<input type="button" class="button" accesskey="h" name="addbbcode18" value="Hide" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="H" name="addbbcode20" value="Hide User" style="width: 40px" onClick="bbstyle(20)" onMouseOver="helpline('H')" />
</span></td>
#
#-----[ FIND ]------------------------------------------
#
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ REPLACE WITH ]------------------------------------------
#
<select name="addbbcode22" onChange="bbfontstyle('[color=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ FIND ]------------------------------------------
#
</select> {L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ REPLACE WITH ]------------------------------------------
#
</select> {L_FONT_SIZE}:<select name="addbbcode24" onChange="bbfontstyle('[size=' + this.form.addbbcode24.options[this.form.addbbcode24.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]