diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-05-25 18:00:22 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-05-25 18:00:22 +0000 |
commit | e6f46e65a7a8d55e771fcfe0f3ab853ed3411214 (patch) | |
tree | 1f42580362f05834cdd99d20b2e3519e47d78b87 | |
parent | 79600289e72eb5c2af615abbc983cac7e912eb5b (diff) | |
download | forums-e6f46e65a7a8d55e771fcfe0f3ab853ed3411214.tar forums-e6f46e65a7a8d55e771fcfe0f3ab853ed3411214.tar.gz forums-e6f46e65a7a8d55e771fcfe0f3ab853ed3411214.tar.bz2 forums-e6f46e65a7a8d55e771fcfe0f3ab853ed3411214.tar.xz forums-e6f46e65a7a8d55e771fcfe0f3ab853ed3411214.zip |
fix an improper fix.
- generally, sorry, but direct url parsing after ] will no longer work...
- try to eliminate the most common "bug" for placing urls within the [url=][/url] part (the text). This will trigger make_clickable and render the url invalid (doubled url), moreso if other text is involved too. This is still te case if the url is not written directly after the [url=] part. This is nearly the best we can get within 3.0.x - and every report about [url=], [url] and make_clickable and it's non-parsing or parsing will be closed with "will not fix", except it is a critical bug resulting in the non-functioning of the board. We may adjust this later to our own liking while we try to find different ways to face these problems.
git-svn-id: file:///svn/phpbb/trunk@7681 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/includes/functions.php | 10 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index fee5f49cc1..b4d954c908 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2613,6 +2613,7 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class // make sure no HTML entities were matched $chars = array('<', '>', '"'); $split = false; + foreach ($chars as $char) { $next_split = strpos($url, $char); @@ -2668,6 +2669,7 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class { $url = substr($url, 0, -1); } + break; } switch ($type) @@ -2734,19 +2736,19 @@ function make_clickable($text, $server_url = false, $class = 'postlink') // Be sure to not let the matches cross over. ;) // relative urls for this board - $magic_url_match[] = '#(^|[\n\t (>\]])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie'; + $magic_url_match[] = '#(^|[\n\t (>])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')"; // matches a xxxx://aaaaa.bbb.cccc. ... - $magic_url_match[] = '#(^|[\n\t (>\]])(' . get_preg_expression('url_inline') . ')#ie'; + $magic_url_match[] = '#(^|[\n\t (>])(' . get_preg_expression('url_inline') . ')#ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing - $magic_url_match[] = '#(^|[\n\t (>\]])(' . get_preg_expression('www_url_inline') . ')#ie'; + $magic_url_match[] = '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_WWW, '\$1', '\$2', '', '$class')"; // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. - $magic_url_match[] = '/(^|[\n\t (>\]])(' . get_preg_expression('email') . ')/ie'; + $magic_url_match[] = '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_EMAIL, '\$1', '\$2', '', '')"; } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index a593dffec6..b8f00d71ee 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -905,7 +905,7 @@ class bbcode_firstpass extends bbcode $url = append_sid($url); } - return ($var1) ? '[url=' . $this->bbcode_specialchars($url) . ':' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($var2) . '[/url:' . $this->bbcode_uid . ']' : '[url:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($url) . '[/url:' . $this->bbcode_uid . ']'; + return ($var1) ? '[url=' . $this->bbcode_specialchars($url) . ':' . $this->bbcode_uid . ']' . $var2 . '[/url:' . $this->bbcode_uid . ']' : '[url:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($url) . '[/url:' . $this->bbcode_uid . ']'; } return '[url' . (($var1) ? '=' . $var1 : '') . ']' . $var2 . '[/url]'; |