A maybe easier, generalized and more failsafe approach:
In functions_newpost.php
FIND
PHP Code:
// ###################### Start convert_url_to_bbcode_callback #######################
ABOVE that ADD
PHP Code:
function autoparse_onsite($url)
{
$parsed = parse_url($url);
if (stripos($parsed['host'], getenv('HTTP_HOST')) !== false)
{
return '[url]' . $url . '[/url]';
}
else
{
return $url;
}
}
FIND
PHP Code:
$urlSearchArray = array(
"#(^|(?<=[^_a-z0-9-=\]\"'/@]|(?<=" . $taglist . ")\]))((https?|ftp|gopher|news|telnet)://|www\.)((\[(?!/)|[^\s[^$!`\"'|{}<>])+)(?!\[/url|\[/img)(?=[,.]*(\)\s|\)$|[\s[]|$))#siU"
);
$urlReplaceArray = array(
"[url]\\2\\4[/url]"
);
REPLACE that with
PHP Code:
$urlSearchArray = array(
"#(^|(?<=[^_a-z0-9-=\]\"'/@]|(?<=" . $taglist . ")\]))((https?|ftp|gopher|news|telnet)://|www\.)((\[(?!/)|[^\s[^$!`\"'|{}<>])+)(?!\[/url|\[/img)(?=[,.]*(\)\s|\)$|[\s[]|$))#siUe"
);
$urlReplaceArray = array("autoparse_onsite('\\2\\4')");
This should take care of only autoparsing "onsite" URLs everywhere - no need to mess with Checkbox settings.
Please not that it, if for xample the Board is running on
http://forum.yourdomain.com and a User posts
http://www.yourdomain.com, this will not be autoparsed.
Also, if a User posts
http://forum.yourdomain.com.mydomain...esntmatter.php or
http://www.foo.bar.forum.yourdomain....esntmatter.php it will be autoparsed.
@Merk
There are no security issues with these Modifications.
convert_url_to_bbcode() just wraps [url] around URLs - that's it.