Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[HACK] BBCode Url parser
You don't have permission for this action!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2008-08-16 05:14:13
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:

$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);
Unknown User
2008-08-16 10:27:34
thanks for ur work

but someone said its not a good idea to remove...or we have to change every links ??!!
Unknown User
2008-08-16 13:55:31
Quote:
for domain in white list

Configuring it by:

$site_config["url_whitelist"] = array("www.yoursite.com", "www.sample.com");

On mine tracker is set to:

- tracker itself (really usefull for internal links)

- forums (it's independent, and on another domain)

Hm... and I don't like website always opening new window ^^

Edit: this hack affect: shoutbox/comments/torrents/...
Unknown User
2008-08-17 00:23:47
The main point of anonym.to is to hide the redirect/link on your torrent site from the site it is linking to.
Unknown User
2008-08-17 22:03:20
This don't remove anonym.to except if domain is in white list :blink:
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728