&& --> &anp;&
-
-
- Offizieller Beitrag
Ist jetzt zwar besser, aber immer noch nicht perfekt
[php:1:106ced1d5c]<?php
&;&; < > "
?>[/php:1:106ced1d5c][php:1:106ced1d5c]
&;&; < > "
[/php:1:106ced1d5c] -
Versuch Nr.2
$text = str_replace("&;","&",$text);
-
- Offizieller Beitrag
Jetzt wird es schlimmer
Wenn ich das versuche, kommt dann das im Testforum so heraus
Zitat<?php
&amp;;&amp;; < > "
?> -
lol
also ja da weis ich auch nicht weiter außer du gibst mir mal den gesammten Quelltext der Funktion!
-
- Offizieller Beitrag
Hier das Script
PHP
Alles anzeigen######################################################## ## Mod Title: PHP Syntax Highlighter BBCode ## Mod Version: Beta 2.0.0 ## Author: JW Frazier / Fubonis < [email]php@fubonis.com[/email] > ## ## This mod is only for phpBB2 ## Tested on RC-3 ## ONLY for PHP4+ ## ## Description: This mod creates a new BBCode, "[php]your_code[/php]" ## It simply takes the code and uses the syntax highlighting of PHP ## and makes a pretty presentation of your code! ## To use this, your code MUST have at least the opening PHP tag ## Example: [php]<?php phpinfo(); ?>[/php] is valid ## [php]phpinfo();[/php] is not. ## ## ## Installation Level: Easy ## Installation Time: 10 Minutes ## Files To Edit: 5 ## /includes/bbcode.php ## /templates/YOUR_TEMPLATE_NAME/bbcode.tpl ## /templates/YOUR_TEMPLATE_NAME/posting_body.tpl ## /language/lang_YOUR_LANGUAGE/lang_main.php ## /posting.php ######################################################## ## ## Installation Notes: ## ## ALWAYS back up your files. ## Rock the open-source movement! ######################################################## # #-----[ ACTION: OPEN /includes/bbcode.php]------------------------------------------ # # #-----[ ACTION: FIND]------------------------------------------ $bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']); # #-----[ ACTION: ADD BELOW]------------------------------------------ $bbcode_tpl['php_open'] = str_replace('{L_PHP}', $lang['PHPCode'], $bbcode_tpl['php_open']); // PHP MOD # #-----[ ACTION: FIND]------------------------------------------ # // [code] and
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// PHP MOD
// [PHP] and [/PHP] for posting PHP code in your posts.
$text = bbencode_second_pass_php($text, $uid, $bbcode_tpl);
#
#-----[ ACTION: FIND]------------------------------------------
#
//for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_first_pass_pda($text, $uid, '', '', true, '');
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// PHP MOD
// [PHP] and [/PHP] for posting PHP code in your posts.
$text = bbencode_first_pass_pda($text, $uid, '[php]', '[/php]', '', true, '');
#
#-----[ ACTION: FIND]------------------------------------------
#
} // bbencode_second_pass_code()
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
/**
* PHP MOD
* Does second-pass bbencoding of the [php] tags. This includes
* running htmlspecialchars() over the text contained between
* any pair of [php] tags that are at the first level of
* nesting. Tags at the first level of nesting are indicated
* by this format: [php:1:$uid] ... [/php:1:$uid]
* Other tags are in this format: [php:$uid] ... [/php:$uid]
*
* Original code/function by phpBB Group
* Modified by JW Frazier / Fubonis < php@fubonis.com >
*/
function bbencode_second_pass_php($text, $uid, $bbcode_tpl)
{
global $lang;$html_entities_match = array("#<#", "#>#");
$html_entities_replace = array("<", ">");$code_start_html = $bbcode_tpl['php_open'];
$code_end_html = $bbcode_tpl['php_close'];// First, do all the 1st-level matches. These need an htmlspecialchars() run,
// so they have to be handled differently.
$match_count = preg_match_all("#\[php:1:$uid\](.*?)\[/php:1:$uid\]#si", $text, $matches);for ($i = 0; $i < $match_count; $i++)
{
$before_replace = $matches[1][$i];
$after_replace = $matches[1][$i];$after_replace = preg_replace($html_entities_match, $html_entities_replace, $after_replace);
// Replace 2 spaces with " " so non-tabbed code indents without making huge long lines.
$after_replace = str_replace(" ", " ", $after_replace);
// now Replace 2 spaces with " " to catch odd #s of spaces.
$after_replace = str_replace(" ", " ", $after_replace);
// Replace tabs with " " so tabbed code indents sorta right without making huge long lines.
$after_replace = str_replace("\t", " ", $after_replace);$str_to_match = "[php:1:$uid]" . $before_replace . "[/php:1:$uid]";
$replacement = $code_start_html;
$after_replace = str_replace('<', '<', $after_replace);
$after_replace = str_replace('>', '>', $after_replace);
ob_start();
highlight_string($after_replace);
$after_replace = ob_get_contents();
ob_end_clean();
$replacement .= $after_replace;
$replacement .= $code_end_html;$text = str_replace($str_to_match, $replacement, $text);
}// Now, do all the non-first-level matches. These are simple.
$text = str_replace("[php:$uid]", $code_start_html, $text);
$text = str_replace("[/php:$uid]", $code_end_html, $text);
$text = str_replace('&nbsp;', '', $text);
$text = str_replace('&</font><font color="#0000CC">nbsp</font><font color="#006600">;', '', $text);
$text = str_replace('&</font><font color="#0000BB">nbsp</font><font color="#007700">;', '', $text);return $text;
} // bbencode_second_pass_php()
#
#-----[ ACTION: CLOSE /includes/bbcode.php]------------------------------------------
#
#
#-----[ ACTION: OPEN /templates/YOUR_TEMPLATE_NAME/bbcode.tpl]------------------------------------------
#
#
#-----[ ACTION: FIND]------------------------------------------
#
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed">{L_PHP}:</span></td>
</tr>
<tr>
<td class="code">
</td>
</tr>
</table>
<span class="postbody">
#
#-----[ ACTION: CLOSE /templates/YOUR_TEMPLATE_NAME/bbcode.tpl]------------------------------------------
#
#
#-----[ ACTION: OPEN /templates/YOUR_TEMPLATE_NAME/posting_body.tpl]------------------------------------------
#
#
#-----[ ACTION: FIND]------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
h_help = "{L_BBCODE_H_HELP}";
#
#-----[ ACTION: FIND]------------------------------------------
#
bbtags = new Array('','','','','','','Zitat','
','
','
','
','
','
','','http://,');
#
#-----[ ACTION: REPLACE WITH]------------------------------------------
#
bbtags = new Array('','','','','','','Zitat','
','
','
','
','
','
','','http://,','[php]<?php\n','\n?>[/php]');
#
#-----[ ACTION: 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>
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
<td><span class="genmed">
<input type="button" class="button" accesskey="h" name="addbbcode18" value="PHP" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td>
#
#-----[ ACTION: FIND]------------------------------------------
#
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ ACTION: REPLACE WITH]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ ACTION: FIND]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ ACTION: REPLACE WITH]------------------------------------------
#
<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ ACTION: CLOSE /templates/YOUR_TEMPLATE/posting_body.tpl]------------------------------------------
#
#
#-----[ ACTION: OPEN /language/lang_YOUR_LANGUAGE/lang_main.php]------------------------------------------
#
#
#-----[ ACTION: FIND]------------------------------------------
#
$lang['Code'] = "Code"; // comes before bbcode code output.
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
$lang['PHPCode'] = "PHP"; // PHP MOD
#
#-----[ ACTION: FIND]------------------------------------------
#
$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]";
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
$lang['bbcode_h_help'] = "PHP syntax highlighter. [php]<?php code ?>[/php] (alt+h)"; // PHP MOD
#
#-----[ ACTION: CLOSE language/lang_YOUR_LANGUAGE/lang_main.php]------------------------------------------
#
#
#-----[ ACTION: OPEN /posting.php]------------------------------------------
#
#
#-----[ ACTION: FIND]------------------------------------------
#
"L_BBCODE_F_HELP" => $lang['bbcode_f_help'],
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
"L_BBCODE_H_HELP" => $lang['bbcode_h_help'], // PHP MOD
#
#-----[ ACTION: CLOSE /posting.php]------------------------------------------
#
#
#-----[ ACTION: UPLOAD YOUR FILES]------------------------------------------
#[/code] -
hab ihr schon mal dran gedacht, dass es vllt ein anderes script ist, das beim ansenden "drüberläuft", das das & ersetzt!?
mfg
-
- Offizieller Beitrag
Ich denke mir dabei garnichts, den PHP ist ein Buch mit 7 Siegeln für mich
Aber natürlich kann das Forenscript selbst dafür sorgen, das das" & " falsch dargestellt wird ? -
das muss wohl auch so sein ! ich sehe zumindest nichts wo das geändert wird (& --> &)
-
irgendwo hab ich gelesen, wie man das beheben kann!!!
ich schau mal nach und poste es dann hier!!!
(vorausgesetzt, ich finde es... *g*)[EDIT:]
SORRY, habs gefunden!
War aber nicht deswegen, sondern wegen der fehlerhaften Darstellung von Umlauten.... -
vielleicht liegt es irgendwo im script an einem htmlspecialchars, htmlentities oder ähnlich.
diese funktionen setzen sonderzeichen wie & automatisch in die dazugehörigen codes wie & um.
ist dann aber komisch, dass andere sonderzeichen wie < und > nicht umgesetzt werden...aber auf jeden fall drin lassen, man kann ja auch AND statt && schreiben und so viele & brauchts in php auch nicht
-