mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
git-svn-id: file:///svn/phpbb/trunk@6674 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8e297a038c
commit
1f118ba2ae
5 changed files with 10 additions and 10 deletions
|
@ -2101,7 +2101,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
|
||||||
function get_context($text, $words, $length = 400)
|
function get_context($text, $words, $length = 400)
|
||||||
{
|
{
|
||||||
// first replace all whitespaces with single spaces
|
// first replace all whitespaces with single spaces
|
||||||
$text = preg_replace('/\s+/', ' ', $text);
|
$text = preg_replace('/\s+/u', ' ', $text);
|
||||||
|
|
||||||
$word_indizes = array();
|
$word_indizes = array();
|
||||||
if (sizeof($words))
|
if (sizeof($words))
|
||||||
|
|
|
@ -89,7 +89,7 @@ class bbcode_firstpass extends bbcode
|
||||||
$this->message = str_replace("\r\n", "\n", $this->message);
|
$this->message = str_replace("\r\n", "\n", $this->message);
|
||||||
|
|
||||||
// We strip newlines and spaces after and before quotes in quotes (trimming)
|
// We strip newlines and spaces after and before quotes in quotes (trimming)
|
||||||
$this->message = preg_replace(array('#\[quote(=".*?")?\]([\s|\n]+)#is', '#([\s|\n]+)\[\/quote\]#is'), array("[quote\\1]", "[/quote]"), $this->message);
|
$this->message = preg_replace(array('#\[quote(=".*?")?\]([\s|\n]+)#ius', '#([\s|\n]+)\[\/quote\]#ius'), array("[quote\\1]", "[/quote]"), $this->message);
|
||||||
|
|
||||||
// Now we add exactly one newline
|
// Now we add exactly one newline
|
||||||
$this->message = preg_replace(array('#\[quote(=".*?")?\]#is', '#\[\/quote\]#is'), array("[quote\\1]\n", "\n[/quote]"), $this->message);
|
$this->message = preg_replace(array('#\[quote(=".*?")?\]#is', '#\[\/quote\]#is'), array("[quote\\1]\n", "\n[/quote]"), $this->message);
|
||||||
|
@ -445,7 +445,7 @@ class bbcode_firstpass extends bbcode
|
||||||
}
|
}
|
||||||
|
|
||||||
$code = preg_replace('#^<span class="[a-z]+"><span class="([a-z]+)">(.*)</span></span>#s', '<span class="$1">$2</span>', $code);
|
$code = preg_replace('#^<span class="[a-z]+"><span class="([a-z]+)">(.*)</span></span>#s', '<span class="$1">$2</span>', $code);
|
||||||
$code = preg_replace('#(?:[\n\r\s\t]| )*</span>$#', '</span>', $code);
|
$code = preg_replace('#(?:[\n\r\s\t]| )*</span>$#u', '</span>', $code);
|
||||||
|
|
||||||
// remove newline at the end
|
// remove newline at the end
|
||||||
if (!empty($code) && $code{strlen($code)-1} == "\n")
|
if (!empty($code) && $code{strlen($code)-1} == "\n")
|
||||||
|
@ -933,14 +933,14 @@ class parse_message extends bbcode_firstpass
|
||||||
// Do some general 'cleanup' first before processing message,
|
// Do some general 'cleanup' first before processing message,
|
||||||
// e.g. remove excessive newlines(?), smilies(?)
|
// e.g. remove excessive newlines(?), smilies(?)
|
||||||
// Transform \r\n and \r into \n
|
// Transform \r\n and \r into \n
|
||||||
$match = array('#\r\n?#', "#([\n][\s]+){3,}#", '#(script|about|applet|activex|chrome):#i');
|
$match = array('#\r\n?#', "#([\n][\s]+){3,}#u", '#(script|about|applet|activex|chrome):#i');
|
||||||
$replace = array("\n", "\n\n", "\\1:");
|
$replace = array("\n", "\n\n", "\\1:");
|
||||||
$this->message = preg_replace($match, $replace, trim($this->message));
|
$this->message = preg_replace($match, $replace, trim($this->message));
|
||||||
|
|
||||||
// Message length check. -1 disables this check completely.
|
// Message length check. -1 disables this check completely.
|
||||||
if ($config['max_' . $mode . '_chars'] != -1)
|
if ($config['max_' . $mode . '_chars'] != -1)
|
||||||
{
|
{
|
||||||
$msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#is', ' ', $this->message));
|
$msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));
|
||||||
|
|
||||||
if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars'])
|
if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars'])
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,7 @@ class fulltext_mysql extends search_backend
|
||||||
|
|
||||||
if ($terms == 'all')
|
if ($terms == 'all')
|
||||||
{
|
{
|
||||||
$match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#');
|
$match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');
|
||||||
$replace = array(' +', ' |', ' -', ' +', ' -', ' |');
|
$replace = array(' +', ' |', ' -', ' +', ' -', ' |');
|
||||||
|
|
||||||
$keywords = preg_replace($match, $replace, $keywords);
|
$keywords = preg_replace($match, $replace, $keywords);
|
||||||
|
|
|
@ -173,7 +173,7 @@ class fulltext_native extends search_backend
|
||||||
{
|
{
|
||||||
$words = array();
|
$words = array();
|
||||||
|
|
||||||
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#', $keywords, $words);
|
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words);
|
||||||
if (sizeof($words[1]))
|
if (sizeof($words[1]))
|
||||||
{
|
{
|
||||||
$keywords = '(' . implode('|', $words[1]) . ')';
|
$keywords = '(' . implode('|', $words[1]) . ')';
|
||||||
|
@ -184,7 +184,7 @@ class fulltext_native extends search_backend
|
||||||
$this->search_query = $keywords;
|
$this->search_query = $keywords;
|
||||||
|
|
||||||
$exact_words = array();
|
$exact_words = array();
|
||||||
preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#', $keywords, $exact_words);
|
preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words);
|
||||||
$exact_words = $exact_words[1];
|
$exact_words = $exact_words[1];
|
||||||
|
|
||||||
if (sizeof($exact_words))
|
if (sizeof($exact_words))
|
||||||
|
|
|
@ -130,7 +130,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$search_terms = 'all';
|
$search_terms = 'all';
|
||||||
$keywords = implode(' |', explode(' ', preg_replace('#\s+#', ' ', $keywords))) . ' ' .$add_keywords;
|
$keywords = implode(' |', explode(' ', preg_replace('#\s+#u', ' ', $keywords))) . ' ' .$add_keywords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
|
|
||||||
// define some vars for urls
|
// define some vars for urls
|
||||||
// @todo preg_replace still needed?
|
// @todo preg_replace still needed?
|
||||||
$hilit = preg_replace('#&(\#[0-9]+;)#', '&$1', htmlspecialchars(implode('|', explode(' ', preg_replace('#\s+#', ' ', str_replace(array('+', '-', '|', '(', ')'), ' ', $keywords))))));
|
$hilit = htmlspecialchars(implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')'), ' ', $keywords)))));
|
||||||
$u_hilit = urlencode($keywords);
|
$u_hilit = urlencode($keywords);
|
||||||
$u_show_results = ($show_results != 'posts') ? '&sr=' . $show_results : '';
|
$u_show_results = ($show_results != 'posts') ? '&sr=' . $show_results : '';
|
||||||
$u_search_forum = implode('&fid%5B%5D=', $search_forum);
|
$u_search_forum = implode('&fid%5B%5D=', $search_forum);
|
||||||
|
|
Loading…
Add table
Reference in a new issue