So basically:
[ code=php]// @MangaD test :) http://lf-empire.de[/code]
results in this mess:
I know that smilies have been semi-fixed, but I have fixed this entirely:
Actually this was more complicated than I thought, my solution was only working if html is enabled, which isn't the case. So now I've fixed this with a dirty hack...
1. Go to file /forum/inc/class_parser.php
2. Search for:
3. Add after:
4. Go to file /forum/inc/plugins/BBGeSHi.php
5. Search for:
6. Replace with:
What this does is make the parser run first for codes before anything else before other mycode, smilies, etc are parsed, but after html symbols are parsed. Without this, the other tags are parsed first and result in html that is then parsed by BBGeSHi. So now we should be getting the correct result of the parsed tags instead of their html. This is still not what we want though, we don't want the tags to be parsed at all.
4. Search for:
5. Add after:
What this does is replace these special characters with their html codes (before they are parsed, thanks to step 3), so they won't be parsed.
This solution is not clean but fixes the bug. Though some smilies like =P probably will be parsed because '=' cannot be escaped. If there are better solutions please let me know! :)
[ code=php]// @MangaD test :) http://lf-empire.de[/code]
results in this mess:
PHP-Code:
// <DVZ_ME#0> <span style="font-weight: bold;" class="mycode_b">test</span> :) <a href="http://lf-empire.de" target="_blank" rel="noopener" class="mycode_url">http://lf-empire.de</a> |
I know that smilies have been semi-fixed, but I have fixed this entirely:
Actually this was more complicated than I thought, my solution was only working if html is enabled, which isn't the case. So now I've fixed this with a dirty hack...
1. Go to file /forum/inc/class_parser.php
2. Search for:
Code:
// If MyCode needs to be replaced, first filter out [code] and [php] tags.
if(!empty($this->options['allow_mycode']) && $mybb->settings['allowcodemycode'] == 1)
{
preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "<mybb-code>\n", $message);
}
3. Add after:
Code:
$message = $plugins->run_hooks("parse_message_mangad", $message);
4. Go to file /forum/inc/plugins/BBGeSHi.php
5. Search for:
Code:
$plugins->add_hook("parse_message_end", "BBGeSHi_run");
6. Replace with:
Code:
$plugins->add_hook("parse_message_mangad", "BBGeSHi_run");
What this does is make the parser run first for codes before anything else before other mycode, smilies, etc are parsed, but after html symbols are parsed. Without this, the other tags are parsed first and result in html that is then parsed by BBGeSHi. So now we should be getting the correct result of the parsed tags instead of their html. This is still not what we want though, we don't want the tags to be parsed at all.
4. Search for:
Code:
$_geshied = str_replace("\r", "", $_geshied);
5. Add after:
Code:
$_geshied = str_replace(array('[',']'),array('[',']'),$_geshied);
$_geshied = str_replace("@","@",$_geshied);
$_geshied = str_replace(".", ".", $_geshied);
$_geshied = str_replace("(", "(", $_geshied);
$_geshied = str_replace(")", ")", $_geshied);
$_geshied = str_replace(":", ":", $_geshied);
$_geshied = str_replace("^", "^", $_geshied);
$_geshied = str_replace("$", "$", $_geshied);
$_geshied = str_replace("_", "_", $_geshied);
What this does is replace these special characters with their html codes (before they are parsed, thanks to step 3), so they won't be parsed.
This solution is not clean but fixes the bug. Though some smilies like =P probably will be parsed because '=' cannot be escaped. If there are better solutions please let me know! :)