git-svn-id: file:///svn/phpbb/trunk@6674 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-11-27 19:32:18 +00:00
parent 8e297a038c
commit 1f118ba2ae
5 changed files with 10 additions and 10 deletions

View file

@ -2101,7 +2101,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
function get_context($text, $words, $length = 400)
{
// first replace all whitespaces with single spaces
$text = preg_replace('/\s+/', ' ', $text);
$text = preg_replace('/\s+/u', ' ', $text);
$word_indizes = array();
if (sizeof($words))

View file

@ -89,7 +89,7 @@ class bbcode_firstpass extends bbcode
$this->message = str_replace("\r\n", "\n", $this->message);
// 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
$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('#(?:[\n\r\s\t]|&nbsp;)*</span>$#', '</span>', $code);
$code = preg_replace('#(?:[\n\r\s\t]|&nbsp;)*</span>$#u', '</span>', $code);
// remove newline at the end
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,
// e.g. remove excessive newlines(?), smilies(?)
// 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&#058;");
$this->message = preg_replace($match, $replace, trim($this->message));
// Message length check. -1 disables this check completely.
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'])
{

View file

@ -116,7 +116,7 @@ class fulltext_mysql extends search_backend
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(' +', ' |', ' -', ' +', ' -', ' |');
$keywords = preg_replace($match, $replace, $keywords);

View file

@ -173,7 +173,7 @@ class fulltext_native extends search_backend
{
$words = array();
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#', $keywords, $words);
preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words);
if (sizeof($words[1]))
{
$keywords = '(' . implode('|', $words[1]) . ')';
@ -184,7 +184,7 @@ class fulltext_native extends search_backend
$this->search_query = $keywords;
$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];
if (sizeof($exact_words))

View file

@ -130,7 +130,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
else
{
$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
// @todo preg_replace still needed?
$hilit = preg_replace('#&amp;(\#[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_show_results = ($show_results != 'posts') ? '&amp;sr=' . $show_results : '';
$u_search_forum = implode('&amp;fid%5B%5D=', $search_forum);