Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: class_parser.php 4817 2010-03-17 14:09:32Z Huji $
| * $Id: class_parser.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
/*
| */
/*
|
Zeile 114 | Zeile 114 |
---|
{ $message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "<script$1>$2</script$3>", $message); }
|
{ $message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "<script$1>$2</script$3>", $message); }
|
// Remove these completely $message = preg_replace("#\s*<base[^>]*>\s*#is", "", $message); $message = preg_replace("#\s*<meta[^>]*>\s*#is", "", $message);
|
|
$message = str_replace(array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n"), array('<?php', '<!--', '-->', '?>', "\n", "\n"), $message); } // If MyCode needs to be replaced, first filter out [code] and [php] tags. if($options['allow_mycode']) {
|
$message = str_replace(array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n"), array('<?php', '<!--', '-->', '?>', "\n", "\n"), $message); } // If MyCode needs to be replaced, first filter out [code] and [php] tags. if($options['allow_mycode']) {
|
// First we split up the contents of code and php tags to ensure they're not parsed.
| |
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); }
| 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); }
|
Zeile 133 | Zeile 130 |
---|
// Replace "me" code and slaps if we have a username if($options['me_username'])
|
// Replace "me" code and slaps if we have a username if($options['me_username'])
|
{
| {
|
global $lang; $message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);
| global $lang; $message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);
|
Zeile 156 | Zeile 153 |
---|
if($options['highlight']) { $message = $this->highlight_message($message, $options['highlight']);
|
if($options['highlight']) { $message = $this->highlight_message($message, $options['highlight']);
|
}
| }
|
// Run plugin hooks $message = $plugins->run_hooks("parse_message", $message);
| // Run plugin hooks $message = $plugins->run_hooks("parse_message", $message);
|
Zeile 168 | Zeile 165 |
---|
{ foreach($code_matches as $text) {
|
{ foreach($code_matches as $text) {
|
// Fix up HTML inside the code tags so it is clean if($options['allow_html'] != 0) { $text[2] = $this->parse_html($text[2]); }
| |
if(my_strtolower($text[1]) == "code") { $code = $this->mycode_parse_code($text[2]);
|
if(my_strtolower($text[1]) == "code") { $code = $this->mycode_parse_code($text[2]);
|
}
| }
|
elseif(my_strtolower($text[1]) == "php") { $code = $this->mycode_parse_php($text[2]);
| elseif(my_strtolower($text[1]) == "php") { $code = $this->mycode_parse_php($text[2]);
|
Zeile 185 | Zeile 176 |
---|
$message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1); } }
|
$message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1); } }
|
| }
// Replace meta and base tags in our post - these are > dangerous < if($this->options['allow_html']) { $message = preg_replace_callback("#<((m[^a])|(b[^diloru>])|(s[^aemptu>]))(\s*[^>]*)>#si", create_function( '$matches', 'return htmlspecialchars($matches[0]);' ), $message);
|
}
if($options['nl2br'] !== 0)
| }
if($options['nl2br'] !== 0)
|