diff --git a/upload/config.php b/upload/config.php index bbad6b8c9..12867afdf 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1; // Increase number of revision after update $bb_cfg['tp_version'] = '2.0.2'; -$bb_cfg['tp_release_state'] = 'TP II r76'; -$bb_cfg['tp_release_date'] = '04-07-2011'; +$bb_cfg['tp_release_state'] = 'TP II r77'; +$bb_cfg['tp_release_date'] = '05-07-2011'; $bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger $bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут"; diff --git a/upload/includes/bbcode.php b/upload/includes/bbcode.php index 182eee8c7..7bcce2a7a 100644 --- a/upload/includes/bbcode.php +++ b/upload/includes/bbcode.php @@ -583,30 +583,25 @@ class bbcode function init_replacements () { $tpl = $this->tpl; - $url_exp = '[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+?'; $img_url_exp = 'http://[^\s\?&;:=\#\"<>]+?\.(jpg|jpeg|gif|png)'; $email_exp = '[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+'; $this->preg = array( - '#\[quote="(.+?)"\]#i' => $tpl['quote_username_open'], - '#\[spoiler="(.+?)"\]#i' => $tpl['spoiler_title_open'], - '#\[list=(a|A|i|I|1)\]#i' => '
$1', - '#\[name=([a-zA-Z0-9_]+?)\]#i' => '', - '#\[url=\#([a-zA-Z0-9_]+?)\](.*?)\[/url\]#i' => '$2', - '#\[color=([\#0-9a-zA-Z]+)\]#' => '', - '#\[size=([1-2]?[0-9])\]#i' => '', - '#\[align=(left|right|center|justify)\]#i' => '', - '#\[font="([\w\- \']+)"\]#i' => '', - "#\[img\]($img_url_exp)\[/img\]#i" => $tpl['img'], - "#\[img=(left|right)\]($img_url_exp)\[/img\]\s*#i" => $tpl['img_aligned'], - "#\[email\]($email_exp)\[/email\]#i" => '$1', - "#\[url\](https?://$url_exp)\[/url\]#i" => '$1', - "#\[url\](www\.$url_exp)\[/url\]#i" => '$1', - "#\[url=(https?://$url_exp)\]([^?\n\t].*?)\[/url\]#i" => '$2', - "#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#i" => '$2', + '#\[quote="(.+?)"\]#isu' => $tpl['quote_username_open'], + '#\[spoiler="(.+?)"\]#isu' => $tpl['spoiler_title_open'], + '#\[list=(a|A|i|I|1)\]#isu' => '
$1', + '#\[name=([a-zA-Z0-9_]+?)\]#isu' => '', + '#\[url=\#([a-zA-Z0-9_]+?)\](.*?)\[/url\]#isu' => '$2', + '#\[color=([\#0-9a-zA-Z]+)\]#isu' => '', + '#\[size=([1-2]?[0-9])\]#isu' => '', + '#\[align=(left|right|center|justify)\]#isu' => '', + '#\[font="([\w\- \']+)"\]#isu' => '', + "#\[img\]($img_url_exp)\[/img\]#isu" => $tpl['img'], + "#\[img=(left|right)\]($img_url_exp)\[/img\]\s*#isu" => $tpl['img_aligned'], + "#\[email\]($email_exp)\[/email\]#isu" => '$1', ); $this->str = array( @@ -794,16 +789,13 @@ class bbcode { global $bb_cfg; - $url_regexp = "# - (? $max_len) ? substr($href, 0, $max_len - 19) .'...'. substr($href, -16) : $href; + $name = empty($m[2]) ? $href : $m[2]; + + if(mb_strlen($name, 'UTF-8')) + { + $anme = mb_substr($name, 0, $max_len - 19, 'UTF-8') .'...'. mb_substr($name, -16, 'UTF-8'); + } + if(!preg_match("#{$bb_cfg['server_name']}#", $href)) { require_once(INC_DIR .'class.idna_convert.php'); diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 03e52e506..12e58c752 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -1469,22 +1469,21 @@ function get_user_id ($username) function str_short ($text, $max_length, $space = ' ') { - if ($max_length && strlen($text) > $max_length) + if ($max_length && mb_strlen($text, 'UTF-8') > $max_length) { - $text = mb_substr($text, 0, $max_length); + $text = mb_substr($text, 0, $max_length, 'UTF-8'); if ($last_space_pos = $max_length - intval(strpos(strrev($text), $space))) { if ($last_space_pos > round($max_length * 3/4)) { $last_space_pos--; - $text = mb_substr($text, 0, $last_space_pos); + $text = mb_substr($text, 0, $last_space_pos, 'UTF-8'); } } $text .= '...'; $text = preg_replace('!?(\w+)?;?(\w{1,5})?\.\.\.$!', '...', $text); } - return $text; }