bbcode Hack für c++
Verfasst: 26.01.2004 21:20
hiho,
wollte heute den Hack für c++ einbauen, doch als ich dann fertig war mit den modden der datein kam dies hier:
kann mir einer sagen was an diesen Hack hier falsch ist? -->
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// c++ syntax
// [c++] and [/c++] for posting c++ code in your posts.
$text = bbencode_second_pass_c++($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]------------------------------------------
#
// c++ MOD
// [c++] and [/c++] for posting PHP code in your posts.
$text = bbencode_first_pass_pda($text, $uid, '[c++]', '[/c++]', '', true, '');
#
#-----[ ACTION: FIND]------------------------------------------
#
} // bbencode_second_pass_code()
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// Modified php bbcode to c++ syntax
function bbencode_second_pass_php($text, $uid, $bbcode_tpl)
{
global $lang;
$html_entities_match = array("#<#", "#>#");
$html_entities_replace = array("&", "&");
$code_start_html = $bbcode_tpl['c++_open'];
$code_end_html = $bbcode_tpl['c++_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("#\[c++:1:$uid\](.*?)\[/c++: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 = "[c++:1:$uid]" . $before_replace . "[/c++: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("[c++:$uid]", $code_start_html, $text);
$text = str_replace("[/c++:$uid]", $code_end_html, $text);
$text = str_replace(' ', '&', $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_c++()
#
#
#-----[ OPEN ]------------------------------------------
#
bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END email -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN c++_open -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{L_c++}:</b></span></td>
</tr>
<tr>
<td class="code">
<!-- END c++_open -->
<!-- BEGIN c++_close -->
</td>
</tr>
</table>
<span class="postbody">
<!-- END c++_close -->
#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";
#
#-----[ AFTER, ADD ]------------------------------------------
#
h_help = "{L_BBCODE_H_HELP}"; <!-- c++ MOD //-->
#
#-----[ ACTION: FIND]------------------------------------------
#
bbtags = new Array('','','','','','','','
#
#-----[ REPLACE, WITH]------------------------------------------
#
bbtags = new Array('','','','','','','','
#
#-----[ 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="c++" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td> <!-- c++ MOD //-->
#
#-----[ FIND ]------------------------------------------
#
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ REPLACE, WITH]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ FIND ]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ REPLACE, WITH]------------------------------------------
#
<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ OPEN ]------------------------------------------
#
lang_main.php
#
#-----[ FIND]------------------------------------------
#
$lang['Code'] = "Code"; // comes before bbcode code output.
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['c++'] = "c++";
#
#-----[ FIND ]------------------------------------------
#
$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_h_help'] = "c++ syntax highlighter. [c++]<?php code ?>[/c++] (alt+h)"; // c++ MOD
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
"L_BBCODE_F_HELP" => $lang['bbcode_f_help'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_BBCODE_H_HELP" => $lang['bbcode_h_help'], // c++ MOD
#
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]
http://www.phpbbhacks.com/viewhack.php?id=1394
oder eknnt jemand noch einen anderen Hack der c++/small unterstützt?
Thx, Phil
wollte heute den Hack für c++ einbauen, doch als ich dann fertig war mit den modden der datein kam dies hier:
Parse error: parse error, unexpected T_INC in /www/htdocs/v086851/forum/includes/bbcode.php on line 154
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v086851/forum/includes/bbcode.php:154) in /www/htdocs/v086851/forum/includes/sessions.php on line 293
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v086851/forum/includes/bbcode.php:154) in /www/htdocs/v086851/forum/includes/sessions.php on line 294
Fatal error: Call to undefined function: make_bbcode_uid() in /www/htdocs/v086851/forum/posting.php on line 671
kann mir einer sagen was an diesen Hack hier falsch ist? -->
Code: Alles auswählen
###############################################
## Mod Title: c++ bbcode
## Mod Version: 1.0.0
## Author: Rapid Dr3am, Antony Bailey, antony_bailey@lycos.co.uk, http://rapiddr3am.slackslash.net
## Description: c++ syntax bbcode
## Compatibility: 2.0.4
##
## Installation Level: Moderate
## Installation Time: 10 minutes.
## Files To Edit: posting.php, bbcode.php, lang_main.php, bbcode.tpl
##
## Included Files: N/A
##
## History:
## Made on request: http://www.phpbbhacks.com/forums/viewtopic.php?t=9377
##
##
## Author Notes:
## Uses much of the code from the php syntax higlighting bbcode mod, and edits it towards a c++ syntax.
##
## Support: http://www.phpbbhacks.com/forums/viewforum.php?f=11
## Copyright: ©2003 Rapid Dr3am - Antony Bailey
##
###############################################
## This MOD is only listed on phpBBHacks.com. If you downloaded this MOD somewhere else, then you might be
## putting malicious code into your phpBB.
###############################################
##
###############################################
## This MOD is released under the GPL License.
## This MOD can be freely used, but not distributed, without my permission.
## Intellectual Property is retained by the MOD author(s) listed above.
###############################################
#-----[ OPEN ]------------------------------------------
#
bbcode.php
#
#-----[ FIND ]------------------------------------------
$bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']);
#
#-----[ ACTION: ADD BELOW]------------------------------------------
$bbcode_tpl['c++_open'] = str_replace('{L_c++}', $lang['c++Code'], $bbcode_tpl['c++_open']);
#
#-----[ ACTION: FIND]------------------------------------------
#
// [code] and
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// c++ syntax
// [c++] and [/c++] for posting c++ code in your posts.
$text = bbencode_second_pass_c++($text, $uid, $bbcode_tpl);
#
#-----[ ACTION: FIND]------------------------------------------
#
//
Code: Alles auswählen
and
$text = bbencode_first_pass_pda($text, $uid, '
Code: Alles auswählen
', '
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// c++ MOD
// [c++] and [/c++] for posting PHP code in your posts.
$text = bbencode_first_pass_pda($text, $uid, '[c++]', '[/c++]', '', true, '');
#
#-----[ ACTION: FIND]------------------------------------------
#
} // bbencode_second_pass_code()
#
#-----[ ACTION: ADD BELOW]------------------------------------------
#
// Modified php bbcode to c++ syntax
function bbencode_second_pass_php($text, $uid, $bbcode_tpl)
{
global $lang;
$html_entities_match = array("#<#", "#>#");
$html_entities_replace = array("&", "&");
$code_start_html = $bbcode_tpl['c++_open'];
$code_end_html = $bbcode_tpl['c++_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("#\[c++:1:$uid\](.*?)\[/c++: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 = "[c++:1:$uid]" . $before_replace . "[/c++: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("[c++:$uid]", $code_start_html, $text);
$text = str_replace("[/c++:$uid]", $code_end_html, $text);
$text = str_replace(' ', '&', $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_c++()
#
#
#-----[ OPEN ]------------------------------------------
#
bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END email -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN c++_open -->
</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{L_c++}:</b></span></td>
</tr>
<tr>
<td class="code">
<!-- END c++_open -->
<!-- BEGIN c++_close -->
</td>
</tr>
</table>
<span class="postbody">
<!-- END c++_close -->
#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";
#
#-----[ AFTER, ADD ]------------------------------------------
#
h_help = "{L_BBCODE_H_HELP}"; <!-- c++ MOD //-->
#
#-----[ ACTION: FIND]------------------------------------------
#
bbtags = new Array('','','','','','','
','','
Code: Alles auswählen
','
- ','
- ','
#
#-----[ REPLACE, WITH]------------------------------------------
#
bbtags = new Array('','','','','','','
','','
Code: Alles auswählen
','
- ','
- ','
#
#-----[ 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="c++" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('h')" />
</span></td> <!-- c++ MOD //-->
#
#-----[ FIND ]------------------------------------------
#
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ REPLACE, WITH]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
#
#-----[ FIND ]------------------------------------------
#
<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ REPLACE, WITH]------------------------------------------
#
<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
#-----[ OPEN ]------------------------------------------
#
lang_main.php
#
#-----[ FIND]------------------------------------------
#
$lang['Code'] = "Code"; // comes before bbcode code output.
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['c++'] = "c++";
#
#-----[ FIND ]------------------------------------------
#
$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_h_help'] = "c++ syntax highlighter. [c++]<?php code ?>[/c++] (alt+h)"; // c++ MOD
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
"L_BBCODE_F_HELP" => $lang['bbcode_f_help'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_BBCODE_H_HELP" => $lang['bbcode_h_help'], // c++ MOD
#
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]
http://www.phpbbhacks.com/viewhack.php?id=1394
oder eknnt jemand noch einen anderen Hack der c++/small unterstützt?

Thx, Phil