aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-06-11 05:06:48 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-06-11 05:06:48 +0000
commitce3b07eee7dbefc68dcd8eab3ab667e6532c8561 (patch)
tree678987e1b99abcb214a1a3fd10bb14e2087ebe4b /phpBB/includes/message_parser.php
parent72bb5082101318c820a34be9ee09a092bd81b4bc (diff)
downloadforums-ce3b07eee7dbefc68dcd8eab3ab667e6532c8561.tar
forums-ce3b07eee7dbefc68dcd8eab3ab667e6532c8561.tar.gz
forums-ce3b07eee7dbefc68dcd8eab3ab667e6532c8561.tar.bz2
forums-ce3b07eee7dbefc68dcd8eab3ab667e6532c8561.tar.xz
forums-ce3b07eee7dbefc68dcd8eab3ab667e6532c8561.zip
;-)
git-svn-id: file:///svn/phpbb/trunk@6047 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 90b48e402a..5d9a192cbf 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -744,12 +744,31 @@ class bbcode_firstpass extends bbcode
if ($valid)
{
$this->parsed_items['url']++;
-
+
if (!preg_match('#^[\w]+?://.*?#i', $url))
{
$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())
+ {
+ $url_info['query'] = preg_replace('/(?:&amp;|^)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'];
+ }
+ }
+
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 . ']';
}