Zeile 228 | Zeile 228 |
---|
$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message); $message = preg_replace("#( )+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message); }
|
$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message); $message = preg_replace("#( )+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message); }
|
$message = my_wordwrap($message);
| |
$message = $plugins->run_hooks("parse_message_end", $message);
| $message = $plugins->run_hooks("parse_message_end", $message);
|
Zeile 321 | Zeile 319 |
---|
$callback_mycode['email_complex']['regex'] = "#\[email=(.*?)\](.*?)\[/email\]#i"; $callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
$callback_mycode['email_complex']['regex'] = "#\[email=(.*?)\](.*?)\[/email\]#i"; $callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
++$callback_count;
| ++$callback_count;
|
}
if($mybb->settings['allowcolormycode'] == 1) { $nestable_mycode['color']['regex'] = "#\[color=([a-zA-Z]*|\#?[\da-fA-F]{3}|\#?[\da-fA-F]{6})](.*?)\[/color\]#si"; $nestable_mycode['color']['replacement'] = "<span style=\"color: $1;\">$2</span>";
|
}
if($mybb->settings['allowcolormycode'] == 1) { $nestable_mycode['color']['regex'] = "#\[color=([a-zA-Z]*|\#?[\da-fA-F]{3}|\#?[\da-fA-F]{6})](.*?)\[/color\]#si"; $nestable_mycode['color']['replacement'] = "<span style=\"color: $1;\">$2</span>";
|
|
|
++$nestable_count; }
| ++$nestable_count; }
|
Zeile 340 | Zeile 338 |
---|
$callback_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si"; $callback_mycode['size_int']['replacement'] = array($this, 'mycode_handle_size_callback');
|
$callback_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si"; $callback_mycode['size_int']['replacement'] = array($this, 'mycode_handle_size_callback');
|
|
|
++$nestable_count; ++$callback_count;
|
++$nestable_count; ++$callback_count;
|
}
| }
|
if($mybb->settings['allowfontmycode'] == 1) { $nestable_mycode['font']['regex'] = "#\[font=([a-z0-9 ,\-_'\"]+)\](.*?)\[/font\]#si"; $nestable_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";
|
if($mybb->settings['allowfontmycode'] == 1) { $nestable_mycode['font']['regex'] = "#\[font=([a-z0-9 ,\-_'\"]+)\](.*?)\[/font\]#si"; $nestable_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";
|
++$nestable_count; }
| ++$nestable_count; }
|
if($mybb->settings['allowalignmycode'] == 1) { $nestable_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si"; $nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\">$2</div>";
++$nestable_count;
|
if($mybb->settings['allowalignmycode'] == 1) { $nestable_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si"; $nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\">$2</div>";
++$nestable_count;
|
}
| }
|
$custom_mycode = $cache->read("mycode");
|
$custom_mycode = $cache->read("mycode");
|
|
|
// If there is custom MyCode, load it. if(is_array($custom_mycode)) {
| // If there is custom MyCode, load it. if(is_array($custom_mycode)) {
|
Zeile 378 | Zeile 376 |
---|
else { $mycode = $standard_mycode;
|
else { $mycode = $standard_mycode;
|
}
| }
|
// Assign the MyCode to the cache. foreach($mycode as $code)
| // Assign the MyCode to the cache. foreach($mycode as $code)
|
Zeile 414 | Zeile 412 |
---|
function parse_mycode($message, $options=array()) { global $lang, $mybb;
|
function parse_mycode($message, $options=array()) { global $lang, $mybb;
|
|
|
if(empty($this->options)) { $this->options = $options;
| if(empty($this->options)) { $this->options = $options;
|
Zeile 451 | Zeile 449 |
---|
if($this->mycode_cache['nestable_count'] > 0) { foreach($this->mycode_cache['nestable'] as $mycode)
|
if($this->mycode_cache['nestable_count'] > 0) { foreach($this->mycode_cache['nestable'] as $mycode)
|
{
| {
|
while(preg_match($mycode['find'], $message)) { $message = preg_replace($mycode['find'], $mycode['replacement'], $message);
| while(preg_match($mycode['find'], $message)) { $message = preg_replace($mycode['find'], $mycode['replacement'], $message);
|
Zeile 523 | Zeile 521 |
---|
{ $smilie['find'] = explode("\n", $smilie['find']); $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
|
{ $smilie['find'] = explode("\n", $smilie['find']); $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
|
$smilie['image'] = $mybb->get_asset_url($smilie['image']);
| $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
foreach($smilie['find'] as $s)
|
foreach($smilie['find'] as $s)
|
{
| {
|
$s = $this->parse_html($s); eval("\$smilie_template = \"".$templates->get("smilie", 1, 0)."\";"); $this->smilies_cache[$s] = $smilie_template;
| $s = $this->parse_html($s); eval("\$smilie_template = \"".$templates->get("smilie", 1, 0)."\";"); $this->smilies_cache[$s] = $smilie_template;
|
Zeile 692 | Zeile 691 |
---|
"#(o)(nabort\s?=)#i" );
|
"#(o)(nabort\s?=)#i" );
|
$message = preg_replace($js_array, "$1<strong></strong>$2$4", $message);
| $message = preg_replace($js_array, "$1<strong></strong>$2$6", $message);
|
return $message; }
| return $message; }
|
Zeile 821 | Zeile 820 |
---|
else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
|
else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
|
}
| }
|
$username = preg_replace("#(?:"|\"|')? pid=(?:"|\"|')?[0-9]+[\"']?(?:"|\"|')?#i", '', $username);
|
$username = preg_replace("#(?:"|\"|')? pid=(?:"|\"|')?[0-9]+[\"']?(?:"|\"|')?#i", '', $username);
|
$delete_quote = false; }
| $delete_quote = false; }
|
unset($match); preg_match("#dateline=(?:"|\"|')?([0-9]+)(?:"|\"|')?#i", $username, $match); if((int)$match[1])
| unset($match); preg_match("#dateline=(?:"|\"|')?([0-9]+)(?:"|\"|')?#i", $username, $match); if((int)$match[1])
|
Zeile 843 | Zeile 842 |
---|
if($delete_quote) { $username = my_substr($username, 0, my_strlen($username)-1);
|
if($delete_quote) { $username = my_substr($username, 0, my_strlen($username)-1);
|
| } if(!empty($this->options['allow_html'])) { $username = htmlspecialchars_uni($username);
|
}
if($text_only) {
|
}
if($text_only) {
|
return "\n".htmlspecialchars_uni($username)." $lang->wrote{$date}\n--\n{$message}\n--\n";
| return "\n{$username} {$lang->wrote}{$date}\n--\n{$message}\n--\n";
|
} else {
| } else {
|
Zeile 857 | Zeile 861 |
---|
$span = "<span>{$date}</span>"; }
|
$span = "<span>{$date}</span>"; }
|
return "<blockquote><cite>{$span}".htmlspecialchars_uni($username)." $lang->wrote{$linkback}</cite>{$message}</blockquote>\n";
| return "<blockquote><cite>{$span}{$username} {$lang->wrote}{$linkback}</cite>{$message}</blockquote>\n";
|
} }
| } }
|
Zeile 1036 | Zeile 1040 |
---|
{ $url = "http://".$url; }
|
{ $url = "http://".$url; }
|
$fullurl = $url;
| |
|
|
$url = str_replace('&', '&', $url); $name = str_replace('&', '&', $name);
| if(!empty($this->options['allow_html'])) { $url = $this->parse_html($url); }
$fullurl = $url;
|
if(!$name) {
| if(!$name) {
|
Zeile 1050 | Zeile 1057 |
---|
{ if(my_strlen($url) > 55) {
|
{ if(my_strlen($url) > 55) {
|
| $name = htmlspecialchars_decode($name);
|
$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
|
$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
|
| $name = htmlspecialchars_uni($name);
|
} }
| } }
|
Zeile 1063 | Zeile 1072 |
---|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $fullurl = str_replace(array_keys($entities), array_values($entities), $fullurl);
|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $fullurl = str_replace(array_keys($entities), array_values($entities), $fullurl);
|
|
|
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode $link = "<a href=\"$fullurl\" target=\"_blank\"{$nofollow}>$name</a>"; return $link;
|
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode $link = "<a href=\"$fullurl\" target=\"_blank\"{$nofollow}>$name</a>"; return $link;
|
}
/** * Parses URL MyCode. *
| }
/** * Parses URL MyCode. *
|
* @param array Matches. * @return string The built-up link. */
| * @param array Matches. * @return string The built-up link. */
|
Zeile 1080 | Zeile 1089 |
---|
if(!isset($matches[3])) { $matches[3] = '';
|
if(!isset($matches[3])) { $matches[3] = '';
|
}
| }
|
return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]); }
| return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]); }
|
Zeile 1106 | Zeile 1115 |
---|
* @param array Optional array of dimensions */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
* @param array Optional array of dimensions */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
{ global $lang; $url = trim($url); $url = str_replace("\n", "", $url); $url = str_replace("\r", "", $url); if($align == "right") {
| { global $lang; $url = trim($url); $url = str_replace("\n", "", $url); $url = str_replace("\r", "", $url);
if(!empty($this->options['allow_html'])) { $url = $this->parse_html($url); }
if($align == "right") {
|
$css_align = " style=\"float: right;\""; } else if($align == "left") { $css_align = " style=\"float: left;\""; }
|
$css_align = " style=\"float: right;\""; } else if($align == "left") { $css_align = " style=\"float: left;\""; }
|
$alt = htmlspecialchars_uni(basename($url));
| $alt = basename($url);
|
if(my_strlen($alt) > 55)
|
if(my_strlen($alt) > 55)
|
{
| { $alt = htmlspecialchars_decode($alt);
|
$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);
|
$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);
|
}
| $alt = htmlspecialchars_uni($alt); }
|
$alt = $lang->sprintf($lang->posted_image, $alt); if($dimensions[0] > 0 && $dimensions[1] > 0) {
| $alt = $lang->sprintf($lang->posted_image, $alt); if($dimensions[0] > 0 && $dimensions[1] > 0) {
|
Zeile 1132 | Zeile 1149 |
---|
else { return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
|
else { return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
|
} }
/** * Parses IMG MyCode. * * @param array Matches. * @return string Image code. */ function mycode_parse_img_callback1($matches) { return $this->mycode_parse_img($matches[2]);
| } }
/** * Parses IMG MyCode. * * @param array Matches. * @return string Image code. */ function mycode_parse_img_callback1($matches) { return $this->mycode_parse_img($matches[2]);
|
}
/**
| }
/**
|
Zeile 1192 | Zeile 1209 |
---|
$url = str_replace("\r", "", $url); $url = str_replace("\'", "'", $url);
|
$url = str_replace("\r", "", $url); $url = str_replace("\'", "'", $url);
|
if(!empty($this->options['shorten_urls'])) { if(my_strlen($url) > 55) { $name = my_substr($url, 0, 40)."...".my_substr($url, -10); } } else { $name = $url; }
$link = "<a href=\"{$url}\" target=\"_blank\">{$name}</a>"; $image = $lang->sprintf($lang->posted_image, $link);
| $image = $lang->sprintf($lang->posted_image, $this->mycode_parse_url($url));
|
return $image; }
| return $image; }
|
Zeile 1218 | Zeile 1222 |
---|
function mycode_parse_img_disabled_callback1($matches) { return $this->mycode_parse_img_disabled($matches[2]);
|
function mycode_parse_img_disabled_callback1($matches) { return $this->mycode_parse_img_disabled($matches[2]);
|
}
/** * Parses IMG MyCode disabled. * * @param array Matches. * @return string Image code. */
| }
/** * Parses IMG MyCode disabled. * * @param array Matches. * @return string Image code. */
|
function mycode_parse_img_disabled_callback2($matches) { return $this->mycode_parse_img_disabled($matches[4]);
| function mycode_parse_img_disabled_callback2($matches) { return $this->mycode_parse_img_disabled($matches[4]);
|
Zeile 1238 | Zeile 1242 |
---|
* @return string Image code. */ function mycode_parse_img_disabled_callback3($matches)
|
* @return string Image code. */ function mycode_parse_img_disabled_callback3($matches)
|
{
| {
|
return $this->mycode_parse_img_disabled($matches[3]); }
| return $this->mycode_parse_img_disabled($matches[3]); }
|
Zeile 1269 | Zeile 1273 |
---|
if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email)) { return "<a href=\"mailto:$email\">".$name."</a>";
|
if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email)) { return "<a href=\"mailto:$email\">".$name."</a>";
|
| } elseif(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+\?(.*?)$/si", $email)) { return "<a href=\"mailto:".htmlspecialchars_uni($email)."\">".$name."</a>";
|
} else { return $email;
|
} else { return $email;
|
} }
/**
| } }
/**
|
* Parses email MyCode. * * @param array Matches
| * Parses email MyCode. * * @param array Matches
|
Zeile 1289 | Zeile 1297 |
---|
$matches[2] = ''; } return $this->mycode_parse_email($matches[1], $matches[2]);
|
$matches[2] = ''; } return $this->mycode_parse_email($matches[1], $matches[2]);
|
}
/** * Parses video MyCode.
| }
/** * Parses video MyCode.
|
* * @param string The video provider. * @param string The video to link to.
| * * @param string The video provider. * @param string The video to link to.
|
Zeile 1301 | Zeile 1309 |
---|
function mycode_parse_video($video, $url) { global $templates;
|
function mycode_parse_video($video, $url) { global $templates;
|
|
|
if(empty($video) || empty($url)) { return "[video={$video}]{$url}[/video]";
| if(empty($video) || empty($url)) { return "[video={$video}]{$url}[/video]";
|
Zeile 1309 | Zeile 1317 |
---|
$parsed_url = @parse_url(urldecode($url)); if($parsed_url == false)
|
$parsed_url = @parse_url(urldecode($url)); if($parsed_url == false)
|
{ return "[video={$video}]{$url}[/video]";
| { return "[video={$video}]{$url}[/video]";
|
}
$fragments = array();
| }
$fragments = array();
|
Zeile 1384 | Zeile 1392 |
---|
break; default: return "[video={$video}]{$url}[/video]";
|
break; default: return "[video={$video}]{$url}[/video]";
|
}
| }
|
if(empty($id)) {
| if(empty($id)) {
|
Zeile 1422 | Zeile 1430 |
---|
$url = str_replace("\r", "", $url); $url = str_replace("\'", "'", $url);
|
$url = str_replace("\r", "", $url); $url = str_replace("\'", "'", $url);
|
if(!empty($this->options['shorten_urls'])) { if(my_strlen($url) > 55) { $name = my_substr($url, 0, 40)."...".my_substr($url, -10); } } else { $name = $url; }
$link = "<a href=\"{$url}\" target=\"_blank\">{$name}</a>"; $video = $lang->sprintf($lang->posted_video, $link);
| $video = $lang->sprintf($lang->posted_video, $this->mycode_parse_url($url));
|
return $video; }
| return $video; }
|
Zeile 1558 | Zeile 1553 |
---|
function mycode_prepare_list($matches) { // Append number to identify matching list tags
|
function mycode_prepare_list($matches) { // Append number to identify matching list tags
|
if($matches[1] == '[/list]')
| if(strcasecmp($matches[1], '[/list]') == 0)
|
{ $count = array_pop($this->list_elements); if($count !== NULL)
| { $count = array_pop($this->list_elements); if($count !== NULL)
|