hide mod mit bbcode box mod [problem gelöst] [mit anleitung]
Verfasst: 08.05.2004 08:59
von DerOlum
ich bin gerade dabei den hide mod einzubauen.
bis zur letzten modifikation klappt auch alles,
aber mein posting_body.tpl ist völlig anders als die in der anleitung.
die helpline message z.b steht bei mir in der add_bbcode.js!
der mod läuft zwar per tastatureingabe, aber ich bekomme den button nicht zum laufen, d.h. der code wird nicht in die message-box eingetragen!
folgende teile der anleitung kann ich in meinem code nicht finden und ich weiß nicht wie ich das anpassen kann:
Code: Alles auswählen
Find this line :
bbtags = new Array('[b]','[/b]'...
And add at the end :
'[hide]' and '[/hide]'
You will obtain something like this :
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
','
','[img]','[/img]','
','','[hide]','[/hide]');
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>
Add Below : (Don't forget to adapt the "addbbcode" numbers if neccesary ! (exemple: addbbcode18 -> addbbcode20, 20 -> 22, etc)
<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>
Next, you need to modify all the "addbbcodexx" in the rest of the file. (exemple : addbbcode20 -> addbbcode22)
That's all !

Philippe
[/code]
mein posting_body.tpl gibt's hier:
http://home.arcor.de/derolum/files/posting_body.tpl
oder als textdatei
http://home.arcor.de/derolum/files/posting_body.txt
danke für eure hilfe,
gruß,
olum
Verfasst: 14.05.2004 06:13
von DerOlum
ich hab's noch immer nicht geschafft.
weiß denn wirklich keiner rat?
danke,
olum
Verfasst: 14.05.2004 12:49
von rabbit
sorry, aber deine posting_body.tpl unterscheidet sich zu ca. 95% von meiner...

Verfasst: 14.05.2004 14:04
von DerOlum
das ist ja das problem.
das liegt aber einzig und allein am bbcode box mode.
wenn's einfach gewesen wäre hätte ich doch nicht gefragt
gruß,
olum
Verfasst: 14.05.2004 21:02
von rabbit
und wenn du den code stattdessen in deine bbcode.js packst, wo ja nun wohl alles aus der posting_body drin ist? oder hab' ich das falsch verstanden?
Verfasst: 15.05.2004 01:13
von DerOlum
wenn's so einfach wäre.
der mod funktioniert ja per tastatureingabe [hide]text[/hide] einwandfrei.
nur eben über den button nicht.
was ich bräuchte wäre ein tip wie ich einen buttun in das posting_body.tpl
einbauen kann, der beim ersten klick [hide] ins texfenster einfügt und beim zweiten klick den befehl mit [/hide] wieder schließt.
gruß,
olum
Verfasst: 16.05.2004 00:57
von DerOlum
so,
ich habe im phpbbhacks.com forum mit Ricky_Racer
doch noch einen versierten helfer gefunden.
hier also die anleitung für die installation des "hide mod",
wenn der "bbcode box mod" bereits installiert ist!
Man achte auf das große H bei
var Hide = 0;
sonst funktioniert der mod nicht!
hat jemand 'ne ahnung warum das H groß sein muß und nicht klein?
gruß,
olum
[code]
#------[ 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 = FALSE;
if( $userdata['session_logged_in'] ) {
$sql = "SELECT p.poster_id, p.topic_id
FROM " . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
AND p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? 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);
}
if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
$preview_message = bbencode_third_pass($preview_message, $bbcode_uid, $valid);
}
#
#------[ FIND:]--------------------------------------------------
#
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
{
$subject = 'Re: ' . $subject;
}
#
#------[ AFTER, ADD:]--------------------------------------------
#
if( !$userdata['session_logged_in'] ) {$message = hide_in_quote($message);
}
else
{
$sql = "SELECT p.poster_id, p.topic_id
FROM " . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
AND p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
if(!$db->sql_numrows($resultat))
{
$message = hide_in_quote($message);
}
}
#
#------[ 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
//
#
#------[ AFTER, ADD:]--------------------------------------------
#
$valid = FALSE;
if( $userdata['session_logged_in'] )
{
$sql = "SELECT p.poster_id, p.topic_id
FROM " . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
AND p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? TRUE : FALSE;
}
#
#------[ FIND:]--------------------------------------------------
#
if ( $user_sig != '' && $user_sig_bbcode_uid != '' )
{
$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
}
if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
}
#
#------[ REPLACE WITH:]------------------------------------------
#
if ( $user_sig != '' && $user_sig_bbcode_uid != '' )
{
$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
$user_sig = bbencode_third_pass($user_sig, $user_sig_bbcode_uid, $valid);
}
if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
}
#
#------[ 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:]--------------------------------------------------
#
if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
}
#
#------[ REPLACE WITH:]------------------------------------------
#
if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
$message = bbencode_third_pass($message, $bbcode_uid, FALSE);
}
#
#------[ 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) )
{
#
#------[ AFTER, ADD:]--------------------------------------------
#
$valid = FALSE;
if( $userdata['session_logged_in'] )
{
$sql = "SELECT p.poster_id, p.topic_id
FROM " . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
AND p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? TRUE : FALSE;
}
#
#------[ FIND:]--------------------------------------------------
#
if ( $bbcode_uid != "" )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
}
#
#------[ REPLACE WITH:]------------------------------------------
#
if ( $bbcode_uid != "" )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) :
preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
}
#
#------[ OPEN:]--------------------------------------------------
#
includes/bbcode.php
#
#------[ FIND:]--------------------------------------------------
#
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);
#
#------[ AFTER, ADD:]--------------------------------------------
#
$bbcode_tpl['show'] = str_replace('{HTEXTE}', '\\1', $bbcode_tpl['show']);
#
#------[ FIND:]--------------------------------------------------
#
/**
* Does second-pass bbencoding. This should be used before displaying the message in
* a thread. Assumes the message is already first-pass encoded, and we are given the
* correct UID as used in first-pass encoding.
*/
#
#------[ 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 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;
}
#
#------[ FIND:]--------------------------------------------------
# versions 2.0.4 to 2.0.6d
#
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\](([a-z]+?)://([^ \"\n\r]+?))\[/img\]#si", "[img:$uid]\\1[/img:$uid]", $text);
#
#------[ FIND:]--------------------------------------------------
# versions 2.0.7 to 2.0.8a
#
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((ht|f)tp://)([^ \?&=\"\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);
#
#------[ OPEN:]--------------------------------------------------
#
# you should do this for all styles you have
templates/subSilver/bbcode.tpl
#
#------[ FIND:]--------------------------------------------------
#
<!-- BEGIN ulist_open --><ul><!-- END ulist_open -->
<!-- BEGIN ulist_close --></ul><!-- END ulist_close -->
#
#------[ BEFORE, 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>--- If you are a *registered user* : you need to post in this topic to see the message ---</center>
</td>
</tr>
</table>
<span class="postbody">
<!-- END hide -->
#
#------[ OPEN:]--------------------------------------------------
#
# you should do this for all styles you have
templates/subSilver/posting_body.tpl
#
#------[ FIND:]--------------------------------------------------
#
<img border="0" src="bbcode_box/images/plain.gif" name="plain" type="image" onClick="BBCplain()"
onMouseOver="helpline('plain')" style="border-style: outset; border-width: 1" alt="Remove BBcode"></span></td>
</tr>
#
#------[ BEFORE, ADD:]-------------------------------------------
#
<img border="0" src="bbcode_box/images/hide.gif" name="hide" type="image" onClick="BBChide()"
onMouseOver="helpline('hide')" style="border-style: outset; border-width: 1" alt="Hide Message">
#
#------[ OPEN:]--------------------------------------------------
#
bbcode_box/add_bbcode.js
#
#------[ FIND:]--------------------------------------------------
#
fade_help = "Fade text: [fade]text[/fade]";
#
#------[ AFTER, ADD:]--------------------------------------------
#
hide_help = "Hide text: [hide]text[/hide]";
#
#------[ FIND:]--------------------------------------------------
#
var plain = 0;
#
#------[ AFTER, ADD:]--------------------------------------------
#
var Hide = 0;
#
#------[ FIND:]--------------------------------------------------
#
function BBCimg() {
var FoundErrors = '';
var enterURL = prompt("Enter the image URL","http://");
if (!enterURL) {
FoundErrors += "You didn't write the image URL";
}
if (FoundErrors) {
alert("Error :"+FoundErrors);
return;
}
var ToAdd = "[img]"+enterURL+"[/img]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}
#
#------[ AFTER, ADD:]--------------------------------------------
#
function BBChide() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[hide]" + theSelection + "[/hide]";
document.post.message.focus();
return;
}
}
if (Hide == 0) {
ToAdd = "[hide]";
document.post.hide.src = "bbcode_box/images/hide1.gif";
Hide = 1;
} else {
ToAdd = "[/hide]";
document.post.hide.src = "bbcode_box/images/hide.gif";
Hide = 0;
}
PostWrite(ToAdd);
}[/code]
Verfasst: 16.05.2004 01:03
von DerOlum
muß wohl das große H in der function sein, oder?