Seite 1 von 1

Farbauswahl Fehler! BITTE HELFEN!

Verfasst: 20.12.2005 03:33
von 2003
Morgen Jungs!
Habe mal eine kleines Problem, denke für erfahrene Leute ist es ein Kinderspiel den Fehler zu finden, und zwar geht es um folgendes.

Wenn ich in einem Thread was Poste oder ein Neues Thema erstellen will, und einnen Text Farbig darstellen will, geht das auch wunder bar, doch er springt dan im Auswahl fenster nicht wieder auf Standard zurück, sondern bleibt auf der Farbe stehen!

Sprich ich makiere ein Text, sage er soll ihn rot Darstellen, dann müste die Auswahl Box wieder auf Standard springen, doch dies tut sie nicht sie bleibt auf der Farbe, und ich kann die Farbe dann nicht nochmal asuwählen.

Das Problem ist erst aufgetreten als ich mir den Hide Mod eingebaut habe!

Code: Alles auswählen

################################################################# 
## Mod Title: Lockdown PHPBB 
## Mod Version: 1.0.0 
## Author: http://membres.lycos.fr/philiweb/download/hide/hackhide.php?ver=rc3&num=1&lang=en 
## Editor: Acecool <webmaster@acecoolco.com> (Josh M. M.) http://www.acecoolco.com/ 
## Description: Adds [hide]Tags to hide text from registered members that have not REPLIED, also 
## hides from GUESTS, AND if not installed on a template, the user cannot see text at all, IF you 
## try to quote it gives you an error in the quote 
## Installation Level: Moderate 
## Installation Time: 10-15 minutes 
## Files To Edit: 7     posting.php 
##                    viewtopic.php 
##         search.php 
##         includes/topic_review.php 
##         includes/bbcode.php 
##         templates/subsilver/bbcode.tpl 
##         templates/subsilver/posting_body.tpl 
## Included Files: n/a 
################################################################# 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
################################################################# 
## Author Note: 
## Well the original author made the code really messed up "StefanPool" 
## I "Acecool" Fixed it up a bit and put it inside this mod template 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
# 
#-----[ 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']; 
$result = $db->sql_query($sql); 
$valid = $db->sql_numrows($result) ? 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']; 
$result = $db->sql_query($sql); 
if(!$db->sql_numrows($result)) {$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']; 
$result = $db->sql_query($sql); 
$valid = $db->sql_numrows($result) ? 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( $return_chars != -1 ) 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

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 ]------------------------------------------ 
# 

$testok = 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); 
$testok = $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, $testok); 
} 

# 
#-----[ 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 ]------------------------------------------ 
# 

function prepare_bbcode_template($bbcode_tpl) 
{ 
   global $lang; 
    
   $bbcode_tpl['olist_open'] = str_replace('{LIST_TYPE}', '\\1', $bbcode_tpl['olist_open']); 
    
   $bbcode_tpl['color_open'] = str_replace('{COLOR}', '\\1', $bbcode_tpl['color_open']); 
    
   $bbcode_tpl['size_open'] = str_replace('{SIZE}', '\\1', $bbcode_tpl['size_open']); 
    
   $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']); 
    
   $bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']); 

   $bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']); 
    
   // We do URLs in several different ways.. 
   $bbcode_tpl['url1'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']); 
   $bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1\\2', $bbcode_tpl['url1']); 
    
   $bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); 
   $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']); 
    
   $bbcode_tpl['url3'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']); 
   $bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url3']); 
    
   $bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); 
   $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url4']); 

   $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']); 
   $bbcode_tpl['show'] = str_replace('{HTEXTE}', '\\1', $bbcode_tpl['show']); 

   define("BBCODE_TPL_READY", true); 
    
   return $bbcode_tpl; 

} 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

function hide_in_quote($text) 
{ 
        $text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[url=http://www.acecoolco.com]Acecool Company[/url] - [color=#ff0000]Protected Message[/color]: You cannot quote the message before making a reply.", $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 ]------------------------------------------ 
# 

   // [img]image_url_here[/img] code.. 
   $text = preg_replace("#\[img\](([a-z]+?)://([^ \"\n\r]+?))\[/img\]#si", "[img:$uid]\\1[/img:$uid]", $text); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

//[hide]message[/hide] 
$text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[hide:$uid]\\1[/hide:$uid]", $text); 

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/subSilver/bbcode.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 

<!-- BEGIN ulist_open --><ul><!-- END ulist_open --> 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

<!-- BEGIN show --> 
</span> 
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"> 
<tr> 
          <td><span class="genmed"><b><a href="http://www.acecoolco.com">Acecool Company</a> - <font color=red>Protected Message</font>:</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><a href="http://www.acecoolco.com">Acecool Company</a> - <font color=red>Protected Message</font>:</b></span></td> 
        </tr> 
        <tr> 
          <td class="quote"> 
                <center>You need to be a <a href="profile.php?mode=register&agreed=true">Registered member</a> to view this message.<br>You need to REPLY to view this message.</center> 
                </td> 
        </tr> 
</table> 
<span class="postbody"> 
<!-- END hide --> 

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/subSilver/posting_body.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 

f_help = "{L_BBCODE_F_HELP}"; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

h_help = "Hide: [hide]message[/hide] (alt+h)"; 

# 
#-----[ FIND ]------------------------------------------ 
# 

bbcode = new Array(); 
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','',''

#
#-----[ AFTER, ADD ]------------------------------------------
#

,'[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>

#
#-----[ 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>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
#EoM[/code]

Verfasst: 18.08.2006 12:57
von Berney
Hallo?!

Jetzt benutzt man mal die Suche, findet genau das Problem und dann hat aber keiner eine Lösung???

Hide habe ich zwar nicht eingebaut, aber den Center Mod!!!

Grüße & Dank

Verfasst: 18.08.2006 13:54
von Berney
Na gut,

Pioniergeist hat das Problem gelöst!!! Sowohl der Center als auch Hide Hack macht da wohl Zicken!!! und in der posting_body.tpl wird der Befehl, der die Farbeinstellung auf Standard stellt überschrieben!

Laut Hack Anweisung für den BBcode [center] soll folgende Zeile geändert werden:

Code: Alles auswählen

# 
#-----[ FINDE ]------------------------------------------ 
#
			<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">

# 
#-----[ MIT FOLGENDEM ERSETZEN ]-------------------------------------------------- 
#
# siehe "Notiz" am Anfang dieser Anleitung

			<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
Die besagte Notiz am Anfag besagt lediglich, dass die Erhöhung (hier von 18 auf 20 an drei Stellen gemacht werden muss und dass je nach dem wieviele BBcodes man dazu baut entsprechend in 2-er Schritten erhöht werden soll. Das Problem ist ein anderes!!! Im Original sieht bei aktuellen phpBB Versionen die Zeile so aus:

Code: Alles auswählen

<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">
Man beachte den Eintrag ;this.selectedIndex=0; (fast am Ende der Zeile, vor der onMouseOver Anweisung) der durch stupides Einkopieren/Ersetzen verloren geht!

Ergänzt man diesen Eintrag wieder, so ist das Problem gelöst!

Grüße
Berney