diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-06-12 16:09:55 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-06-12 16:09:55 +0000 |
commit | 6da13549760e1ab5aac0369e1e92696e7908dfc8 (patch) | |
tree | 008f4d6c74a619bee51a224251b9a37a5cfc203c /phpBB/includes/message_parser.php | |
parent | 896e552dde30e6a7b782bbb187dfd9363bcdc7c0 (diff) | |
download | forums-6da13549760e1ab5aac0369e1e92696e7908dfc8.tar forums-6da13549760e1ab5aac0369e1e92696e7908dfc8.tar.gz forums-6da13549760e1ab5aac0369e1e92696e7908dfc8.tar.bz2 forums-6da13549760e1ab5aac0369e1e92696e7908dfc8.tar.xz forums-6da13549760e1ab5aac0369e1e92696e7908dfc8.zip |
removed the ability to parse after closing brackets, since this seems to create a bunch of new problems
added a space after quotes for correctly parsing urls/smilies
instead of splitting the url just compare with strpos
david: please review once you get home. :)
git-svn-id: file:///svn/phpbb/trunk@6051 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r-- | phpBB/includes/message_parser.php | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index ecfd4a50ed..afe66042dd 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -613,8 +613,8 @@ class bbcode_firstpass extends bbcode if ($buffer == '/quote' && sizeof($close_tags)) { // we have found a closing tag - - $out .= array_pop($close_tags) . ']'; + // Add space at the end of the closing tag to allow following urls/smilies to be parsed correctly + $out .= array_pop($close_tags) . '] '; $tok = '['; $buffer = ''; } @@ -740,7 +740,7 @@ class bbcode_firstpass extends bbcode if ($var1) { - $retval = '[email=' . $this->bbcode_specialchars($email) . ':' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($txt) . '[/email:' . $this->bbcode_uid . ']'; + $retval = '[email=' . $this->bbcode_specialchars($email) . ':' . $this->bbcode_uid . ']' . $txt . '[/email:' . $this->bbcode_uid . ']'; } else { @@ -768,7 +768,7 @@ class bbcode_firstpass extends bbcode return ''; } - // relative urls for this board + // Checking urls if (preg_match('#' . preg_quote(generate_board_url(), '#') . '/([^ \t\n\r<"\']+)#i', $url) || preg_match('#([\w]+?://.*?[^ \t\n\r<"\']*)#i', $url) || preg_match('#(www\.[\w\-]+\.[\w\-.\~]+(?:/[^ \t\n\r<"\']*)?)#i', $url)) @@ -785,26 +785,13 @@ class bbcode_firstpass extends bbcode $url = 'http://' . $url; } - $url_info = parse_url($url); - $script_test_path = explode('/', $url_info['path']); - $test_url = $url_info['scheme'] . '://' . $url_info['host']; - if (!empty($url_info['port'])) - { - $test_url .= ':' . $url_info['port']; - } - // We take our test url and stick on the first bit of text we get to check if we are really at the domain. If so, lets go! - if ($test_url . '/' . $script_test_path[1] == generate_board_url()) + if (strpos($url, generate_board_url()) !== false && strpos($url, 'sid=') !== false) { - $url_info['query'] = preg_replace('/(?:&|^)sid=[0-9a-f]{32}/', '', $url_info['query']); - $url = $test_url . $url_info['path'] . '?' . $url_info['query']; - if (!empty($url_info['fragment'])) - { - $url .= $url_info['fragment']; - } + $url = preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\1', $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]'; |