Zeile 165 | Zeile 165 |
---|
$replace = array("\n", "\n"); $message = str_replace($find, $replace, $message); }
|
$replace = array("\n", "\n"); $message = str_replace($find, $replace, $message); }
|
| $message = $plugins->run_hooks("parse_message_htmlsanitized", $message);
|
// Replace "me" code and slaps if we have a username if(!empty($this->options['me_username']) && $mybb->settings['allowmemycode'] == 1)
|
// Replace "me" code and slaps if we have a username if(!empty($this->options['me_username']) && $mybb->settings['allowmemycode'] == 1)
|
{
| {
|
global $lang;
|
global $lang;
|
|
|
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_me\">* {$this->options['me_username']} \\2</span>", $message); $message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_slap\">* {$this->options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
|
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_me\">* {$this->options['me_username']} \\2</span>", $message); $message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_slap\">* {$this->options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
|
}
| }
$message = $plugins->run_hooks("parse_message_me_mycode", $message);
|
// If we can, parse smilies if(!empty($this->options['allow_smilies']))
| // If we can, parse smilies if(!empty($this->options['allow_smilies']))
|
Zeile 185 | Zeile 189 |
---|
if(!empty($this->options['allow_mycode'])) { $message = $this->parse_mycode($message);
|
if(!empty($this->options['allow_mycode'])) { $message = $this->parse_mycode($message);
|
}
| }
|
// Parse Highlights if(!empty($this->options['highlight']))
| // Parse Highlights if(!empty($this->options['highlight']))
|
Zeile 244 | Zeile 248 |
---|
* @return string The formatted message. */ function parse_html($message)
|
* @return string The formatted message. */ function parse_html($message)
|
{
| {
|
$message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // fix & but allow unicode $message = str_replace("<","<",$message); $message = str_replace(">",">",$message);
| $message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // fix & but allow unicode $message = str_replace("<","<",$message); $message = str_replace(">",">",$message);
|
Zeile 280 | Zeile 284 |
---|
$standard_mycode['hr']['regex'] = "#\[hr\]#si"; $standard_mycode['hr']['replacement'] = "<hr class=\"mycode_hr\" />";
|
$standard_mycode['hr']['regex'] = "#\[hr\]#si"; $standard_mycode['hr']['replacement'] = "<hr class=\"mycode_hr\" />";
|
++$standard_count; }
| ++$standard_count; }
|
if($mybb->settings['allowsymbolmycode'] == 1) { $standard_mycode['copy']['regex'] = "#\(c\)#i";
| if($mybb->settings['allowsymbolmycode'] == 1) { $standard_mycode['copy']['regex'] = "#\(c\)#i";
|
Zeile 322 | Zeile 326 |
---|
$callback_mycode['email_complex']['regex'] = "#\[email=((?:[a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+(?:\?.*?)?)\](.*?)\[/email\]#i"; $callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
$callback_mycode['email_complex']['regex'] = "#\[email=((?:[a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+(?:\?.*?)?)\](.*?)\[/email\]#i"; $callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
|
|
++$callback_count; }
| ++$callback_count; }
|
Zeile 790 | Zeile 794 |
---|
$message = preg_replace("#(^<br(\s?)(\/?)>|<br(\s?)(\/?)>$)#i", "", $message);
if(!$message)
|
$message = preg_replace("#(^<br(\s?)(\/?)>|<br(\s?)(\/?)>$)#i", "", $message);
if(!$message)
|
{
| {
|
return ''; }
| return ''; }
|
Zeile 798 | Zeile 802 |
---|
$delete_quote = true;
preg_match("#pid=(?:"|\"|')?([0-9]+)[\"']?(?:"|\"|')?#i", $username, $match);
|
$delete_quote = true;
preg_match("#pid=(?:"|\"|')?([0-9]+)[\"']?(?:"|\"|')?#i", $username, $match);
|
if((int)$match[1])
| if((int)$match[1])
|
{ $pid = (int)$match[1]; $url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid"; if(defined("IN_ARCHIVE")) { $linkback = " <a href=\"{$url}\">[ -> ]</a>";
|
{ $pid = (int)$match[1]; $url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid"; if(defined("IN_ARCHIVE")) { $linkback = " <a href=\"{$url}\">[ -> ]</a>";
|
}
| }
|
else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
| else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
|
Zeile 821 | Zeile 825 |
---|
{ if($match[1] < TIME_NOW) {
|
{ if($match[1] < TIME_NOW) {
|
$postdate = my_date('relative', (int)$match[1]);
| if($text_only) { $postdate = my_date('normal', (int)$match[1]); } else { $postdate = my_date('relative', (int)$match[1]); }
|
$date = " ({$postdate})"; } $username = preg_replace("#(?:"|\"|')? dateline=(?:"|\"|')?[0-9]+(?:"|\"|')?#i", '', $username);
| $date = " ({$postdate})"; } $username = preg_replace("#(?:"|\"|')? dateline=(?:"|\"|')?[0-9]+(?:"|\"|')?#i", '', $username);
|
Zeile 1050 | Zeile 1061 |
---|
$name = htmlspecialchars_uni($name); }
|
$name = htmlspecialchars_uni($name); }
|
$nofollow = '';
| |
if(!empty($this->options['nofollow_on'])) {
|
if(!empty($this->options['nofollow_on'])) {
|
$nofollow = " rel=\"nofollow\"";
| $rel = " rel=\"noopener nofollow\"";
|
}
|
}
|
| else { $rel = " rel=\"noopener\""; }
|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $url = str_replace(array_keys($entities), array_values($entities), $url);
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $url = str_replace(array_keys($entities), array_values($entities), $url);
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
|
|
|
eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";"); return $mycode_url;
|
eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";"); return $mycode_url;
|
}
/** * Parses URL MyCode.
| }
/** * Parses URL MyCode.
|
* * @param array $matches Matches. * @return string The built-up link.
| * * @param array $matches Matches. * @return string The built-up link.
|
Zeile 1079 | Zeile 1093 |
---|
$matches[3] = ''; } return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
|
$matches[3] = ''; } return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
|
}
| }
|
/** * Parses URL MyCode. *
| /** * Parses URL MyCode. *
|
Zeile 1105 | Zeile 1119 |
---|
* @return string */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
* @return string */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
{
| {
|
global $lang, $templates; $url = trim($url); $url = str_replace("\n", "", $url);
| global $lang, $templates; $url = trim($url); $url = str_replace("\n", "", $url);
|
Zeile 1417 | Zeile 1431 |
---|
} break; case "twitch":
|
} break; case "twitch":
|
if(isset($path[3]))
| if(count($path) >= 3 && $path[1] == 'videos') { // Direct video embed with URL like: https://www.twitch.tv/videos/179723472 $id = 'video=v'.$path[2]; } elseif(count($path) >= 4 && $path[2] == 'v') { // Direct video embed with URL like: https://www.twitch.tv/waypoint/v/179723472 $id = 'video=v'.$path[3]; } elseif(count($path) >= 2)
|
{
|
{
|
$id = $path[3]; // https://www.twitch.tv/giantbomb/v/100048090
| // Channel (livestream) embed with URL like: https://twitch.tv/waypoint $id = 'channel='.$path[1];
|
} break; default:
| } break; default:
|
Zeile 1525 | Zeile 1550 |
---|
$last_char = my_substr($matches[3], -1); } }
|
$last_char = my_substr($matches[3], -1); } }
|
if($matches[2] == 'www' || $matches[2] == 'ftp')
| if(in_array(strtolower($matches[2]), array('www', 'ftp')))
|
{ return "{$matches[1]}[url]{$matches[2]}.{$matches[3]}[/url]{$external}"; }
| { return "{$matches[1]}[url]{$matches[2]}.{$matches[3]}[/url]{$external}"; }
|