Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* $Id: class_parser.php 2271 2006-09-27 02:45:07Z Tikitiki $
| * $Id: class_parser.php 2447 2006-11-27 04:18:13Z CraKteR $
|
*/
/*
| */
/*
|
Zeile 75 | Zeile 75 |
---|
if($this->base_url != "") {
|
if($this->base_url != "") {
|
if(my_substr($this->base_url, strlen($this->base_url) -1) != "/")
| if(my_substr($this->base_url, my_strlen($this->base_url) -1) != "/")
|
{ $this->base_url = $this->base_url."/"; }
| { $this->base_url = $this->base_url."/"; }
|
Zeile 86 | Zeile 86 |
---|
// Get rid of cartridge returns for they are the workings of the devil $message = str_replace("\r", "", $message);
|
// Get rid of cartridge returns for they are the workings of the devil $message = str_replace("\r", "", $message);
|
$message = $this->strip_rtl($message);
| |
// Filter bad words if requested. if($options['filter_badwords'] != "no")
|
// Filter bad words if requested. if($options['filter_badwords'] != "no")
|
{
| {
|
$message = $this->parse_badwords($message); }
if($options['allow_html'] != "yes") { $message = $this->parse_html($message);
|
$message = $this->parse_badwords($message); }
if($options['allow_html'] != "yes") { $message = $this->parse_html($message);
|
}
| }
|
else { // Strip out any script tags if HTML is enabled
| else { // Strip out any script tags if HTML is enabled
|
Zeile 110 | Zeile 108 |
---|
} $message = preg_replace("#<base(.*)>#is", "<base$1>", $message); $message = preg_replace("#<meta(.*)>#is", "<meta$1>", $message);
|
} $message = preg_replace("#<base(.*)>#is", "<base$1>", $message); $message = preg_replace("#<meta(.*)>#is", "<meta$1>", $message);
|
| $message = str_replace(array('<?php', '<!--', '-->', '?>'), array('<?php', '<!--', '-->', '?>'), $message);
|
} }
| } }
|
Zeile 166 | Zeile 165 |
---|
}
if($options['nl2br'] != "no")
|
}
if($options['nl2br'] != "no")
|
{
| {
|
$message = nl2br($message); $message = str_replace("</div><br />", "</div>", $message); $message = preg_replace("#<(/?)p>\s*(<br />?)#", "<$1p>", $message);
| $message = nl2br($message); $message = str_replace("</div><br />", "</div>", $message); $message = preg_replace("#<(/?)p>\s*(<br />?)#", "<$1p>", $message);
|
Zeile 251 | Zeile 250 |
---|
$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";
$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";
|
$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";
$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";
|
$standard_mycode['size_int']['replacement'] = "<font size=\"$1\">$2</font>";
| $standard_mycode['size_int']['replacement'] = "<span style=\"font-size: $1em;\">$2</span>";
|
$standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si"; $standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";
| $standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si"; $standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";
|
Zeile 306 | Zeile 305 |
---|
// Parse quotes first $message = $this->mycode_parse_quotes($message);
|
// Parse quotes first $message = $this->mycode_parse_quotes($message);
|
$message = $this->mycode_auto_url($message);
| $message = $this->mycode_auto_url($message);
|
|
|
| $message = str_replace('$', '$', $message);
|
// Replace the rest $message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);
| // Replace the rest $message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);
|
Zeile 421 | Zeile 422 |
---|
{ if(!$badword['replacement']) $badword['replacement'] = "*****"; $badword['badword'] = preg_quote($badword['badword']);
|
{ if(!$badword['replacement']) $badword['replacement'] = "*****"; $badword['badword'] = preg_quote($badword['badword']);
|
$message = preg_replace("#\b".$badword['badword']."\b#i", $badword['replacement'], $message);
| $message = preg_replace("#(\W|^)".$badword['badword']."(\W|$)#i", "\\1".$badword['replacement']."\\2", $message);
|
} } if($options['strip_tags'] == "yes")
| } } if($options['strip_tags'] == "yes")
|
Zeile 440 | Zeile 441 |
---|
function fix_javascript($message) { $js_array = array(
|
function fix_javascript($message) { $js_array = array(
|
"#(j)(avascript)#i", "#(a)(lert)#i", "#(o)(nmouseover)#i", "#(o)(nmouseout)#i", "#(o)(nmousedown)#i", "#(o)(nmousemove)#i", "#(o)(nmouseup)#i", "#(o)(nclick)#i", "#(o)(ndblclick)#i", "#(o)(nload)#i", "#(o)(nsubmit)#i", "#(o)(nblur)#i", "#(o)(nchange)#i", "#(o)(nfocus)#i", "#(o)(nselect)#i", "#(o)(nunload)#i", "#(o)(nkeypress)#i"
| "#(j)(avascript\:)#i", "#(o)(nmouseover\s?=)#i", "#(o)(nmouseout\s?=)#i", "#(o)(nmousedown\s?=)#i", "#(o)(nmousemove\s?=)#i", "#(o)(nmouseup\s?=)#i", "#(o)(nclick\s?=)#i", "#(o)(ndblclick\s?=)#i", "#(o)(nload\s?=)#i", "#(o)(nsubmit\s?=)#i", "#(o)(nblur\s?=)#i", "#(o)(nchange\s?=)#i", "#(o)(nfocus\s?=)#i", "#(o)(nselect\s?=)#i", "#(o)(nunload\s?=)#i", "#(o)(nkeypress\s?=)#i"
|
); $message = preg_replace($js_array, "$1<strong></strong>$2", $message);
|
); $message = preg_replace($js_array, "$1<strong></strong>$2", $message);
|
|
|
return $message; }
| return $message; }
|
Zeile 475 | Zeile 476 |
---|
// Assign pattern and replace values. $pattern = array("#\[quote=(?:"|\"|')?(.*?)[\"']?(?:"|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si", "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");
|
// Assign pattern and replace values. $pattern = array("#\[quote=(?:"|\"|')?(.*?)[\"']?(?:"|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si", "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");
|
|
|
$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n", "</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");
| $replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n", "</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");
|
Zeile 494 | Zeile 496 |
---|
); $message = preg_replace($find, $replace, $message); return $message;
|
); $message = preg_replace($find, $replace, $message); return $message;
|
|
|
}
/** * Parses code MyCode.
|
}
/** * Parses code MyCode.
|
*
| *
|
* @param string The message to be parsed * @return string The parsed message. */
| * @param string The message to be parsed * @return string The parsed message. */
|
Zeile 527 | Zeile 529 |
---|
{ return; }
|
{ return; }
|
| $str = str_replace('&', '&', $str);
|
$str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str);
|
$str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str);
|
$str = str_replace('&', '&', $str);
| |
$original = $str;
|
$original = $str;
|
|
|
// See if open and close tags are provided.
|
// See if open and close tags are provided.
|
$added_open_close = false;
| $added_open_tag = false;
|
if(!preg_match("#^\s*<\?#si", $str)) {
|
if(!preg_match("#^\s*<\?#si", $str)) {
|
$added_open_close = true; $str = "<?php \n".$str." \n?>";
| $added_open_tag = true; $str = "<?php \n".$str; } $added_end_tag = false; if(!preg_match("#\?>\s*$#si", $str)) { $added_end_tag = true; $str = $str." \n?>";
|
} // If the PHP version < 4.2, catch highlight_string() output. if(version_compare(PHP_VERSION, "4.2.0", "<"))
| } // If the PHP version < 4.2, catch highlight_string() output. if(version_compare(PHP_VERSION, "4.2.0", "<"))
|
Zeile 549 | Zeile 559 |
---|
else { $code = @highlight_string($str, true);
|
else { $code = @highlight_string($str, true);
|
}
| }
|
// If < PHP 5, make XHTML compatible. if(version_compare(PHP_VERSION, "5", "<")) {
| // If < PHP 5, make XHTML compatible. if(version_compare(PHP_VERSION, "5", "<")) {
|
Zeile 557 | Zeile 567 |
---|
"<font", "color=\"", "</font>"
|
"<font", "color=\"", "</font>"
|
);
| );
|
$replace = array( "<span", "style=\"color: ",
| $replace = array( "<span", "style=\"color: ",
|
Zeile 575 | Zeile 585 |
---|
$code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
|
$code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
|
if($added_open_close == true)
| if($added_open_tag)
|
{ $code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\"><\?php( | )(<br />?)#", "<code><span style=\"color: #$1\">", $code);
|
{ $code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\"><\?php( | )(<br />?)#", "<code><span style=\"color: #$1\">", $code);
|
| }
if($added_end_tag) {
|
$code = str_replace("?></span></code>", "</span></code>", $code); }
| $code = str_replace("?></span></code>", "</span></code>", $code); }
|
Zeile 622 | Zeile 636 |
---|
$fullurl = stripslashes($fullurl); if($name == $url && $this->options['shorten_urls'] != "no") {
|
$fullurl = stripslashes($fullurl); if($name == $url && $this->options['shorten_urls'] != "no") {
|
if(strlen($url) > 55)
| if(my_strlen($url) > 55)
|
{ $name = my_substr($url, 0, 40)."...".my_substr($url, -10); }
| { $name = my_substr($url, 0, 40)."...".my_substr($url, -10); }
|
Zeile 660 | Zeile 674 |
---|
* @param string The email address to link to. * @param string The name for the link. * @return string The built-up email link.
|
* @param string The email address to link to. * @param string The name for the link. * @return string The built-up email link.
|
*/
| */
|
function mycode_parse_email($email, $name="") { if(!$name)
| function mycode_parse_email($email, $name="") { if(!$name)
|
Zeile 734 | Zeile 748 |
---|
} return $message; }
|
} return $message; }
|
/** * Strip RTL Unicude * */ function strip_rtl($message) { //$message = htmlentities($message); //$message = preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e', '"&#".ord($0).";"', $message); //$message = str_replace('‮', '', $message); //$message = str_replace('‮', '', $message); //$message = str_replace('‮', '', $message); //$message = html_entity_decode($message); return $message; }
| |
/** * Strips MyCode.
| /** * Strips MyCode.
|