1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 23:55:26 +02:00
git-svn-id: file:///svn/phpbb/trunk@6047 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-06-11 05:06:48 +00:00
parent 72bb508210
commit ce3b07eee7
2 changed files with 22 additions and 3 deletions

View File

@ -1868,8 +1868,8 @@ function make_clickable($text, $server_url = false)
// Be sure to not let the matches cross over. ;)
// relative urls for this board
$magic_url_match[] = '#(^|[\n \]]|\()(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#i';
$magic_url_replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
$magic_url_match[] = '#(^|[\n \]]|\()(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie';
$magic_url_replace[] = "'\$1<!-- l --><a href=\"\$2/' . preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\1', '\$3') . '\">' . preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\1', '\$3') . '</a><!-- l -->'";
// matches a xxxx://aaaaa.bbb.cccc. ...
$magic_url_match[] = '#(^|[\n \]]|\()([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie';

View File

@ -750,6 +750,25 @@ 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())
{
$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 . ']';
}