This hack enable to open url in the same window for domain in white list and disable "anonym.to" redir.
In backend/config.php
Add:
In backend/config.php
Add:
$site_config["url_whitelist"] = array("www.yoursite.com", "www.sample.com");
In backend/functions.php
find
function format_urls($s){
return preg_replace(
"/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^<>\s]+)/i",
"\\1<a href=http://anonym.to/?\\2 target=_blank>\\2</a>", $s);
}
Replace with:
function _regex_format_urls( $matches=array() )
{
global $site_config;
$value = parse_url($matches[2]);
$Result = ( in_array(strtolower($value[host]), $site_config["url_whitelist"]) ) ?
"$matches[1]<a href='$matches[2]' target=_top>$matches[2]</a>":
"$matches[1]<a href='http://anonym.to/?$matches[2]' target=_blank>$matches[2]</a>";
return $Result;
}
function _regex_format_urls_bbcode( $matches=array() )
{
global $site_config;
$value = parse_url($matches[1]);
$matches[3] = ($matches[3]) ? $matches[3]: $matches[1];
$Result = ( in_array(strtolower($value[host]), $site_config["url_whitelist"]) ) ?
"<a href='$matches[1]' target=_top>$matches[3]</a>":
"<a href='http://anonym.to/?$matches[1]' target=_blank>$matches[3]</a>";
return $Result;
}
function format_urls($s){
return preg_replace_callback( "#(^|\s|>)((http|https|news|ftp)://\w+[^\s\[\]\<]+)#i", '_regex_format_urls', $s );
}
Find:
// Text
$s = preg_replace(
"/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
"<a href=\\1 target=_blank>\\3</a>", $s);
"<a href=http://anonym.to/?\\1 target=_blank>\\3</a>", $s);
// http://www.example.com
$s = preg_replace(
"/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
"<a href=\\1 target=_blank>\\1</a>", $s);
"<a href=http://anonym.to/?\\1 target=_blank>\\1</a>", $s);
Replace with:
// Text
$s=preg_replace_callback("/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
'_regex_format_urls_bbcode', $s);
// http://www.example.com
$s=preg_replace_callback("/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
'_regex_format_urls_bbcode', $s);