UBB.Dev
Posted By: God URL and IMG prefix - 09/21/2005 2:39 AM
Is there something that would modify my forum so whenever someone posts an url it would automatically get an http://safeurl.de/? url infront of it, and whenever someone posts an img, it would have a http://invis.free.anonymizer.com/ url as a prefix?

I saw this done on another forum (phpbb) and was wondering if such mod existed for ubb 6.6 or if it could be done.

Any response is appreciated.
Thanks.
Posted By: AllenAyres Re: URL and IMG prefix - 09/21/2005 4:30 AM
It could be done, would involve editing the posting routines in ubb_lib_posting.cgi
Posted By: LK Re: URL and IMG prefix - 09/21/2005 11:37 AM
ubb_lib.cgi
Find:
Code
	$check =~ s/(^|s)(http://S+)(.|,|))?/$1<a href="$2" target="_blank">$2</a>$3/isg;
$check =~ s/(^|s)(https://S+)(.|,|))?/$1<a href="$2" target="_blank">$2</a>$3/isg;
$check =~ s/(^|s)(ftp://S+)(.|,|))?/$1<a href="$2" target="_blank">$2</a>$3/isg;
$check =~ s/(^|s)(www.S+)(.|,|))?/$1<a href="http://$2" target="_blank">$2</a>$3/isg;
Wherever you see:
Code
<a href="
Add after that:
Code
http://safeurl.de/?
Find:
Code
		$returner = qq~<a href="$orig"$target>$wording</a>~;
Replace with:
Code
		$returner = qq~<a href="http://safeurl.de/?$orig"$target>$wording</a>~;
Find:
Code
		$returner = qq~ <img src="$orig" alt=" - " />~;
Replace with:
Code
		$returner = qq~ <img src="http://invis.free.anonymizer.com/$orig" alt=" - " />~;
ubb_lib_posting.cgi
Find:
Code
		# auto-URLs
$match++ if $message =~ s/(<a href=")(http|https|ftp)(://)(S+)(" target="_blank">)234(</a>)/ $2$3$4 /isg;
# new URL
$match++ if $message =~ s/(<a href=")(http|https|ftp)(://)(S+)(" target="_blank">)(.+?)(</a>)/$2://$4/isg;
Add ABOVE:
Code
		# auto-URLs
$match++ if $message =~ s/(<a href="http://safeurl.de/?)(http|https|ftp)(://)(S+)(" target="_blank">)234(</a>)/ $2$3$4 /isg;
# new URL
$match++ if $message =~ s/(<a href="http://safeurl.de/?)(http|https|ftp)(://)(S+)(" target="_blank">)(.+?)(</a>)/$2://$4/isg;
Find:
Code
			$match++ if $message =~ s/(<img src=")(S+)(" alt=" - " />)/[img]$2[/img]/isg;
Add ABOVE:
Code
			$match++ if $message =~ s/(<img src="http://invis.free.anonymizer.com/)(S+)(" alt=" - " />)/[img]$2[/img]/isg;
It's untested but should work.
Posted By: God Re: URL and IMG prefix - 09/22/2005 2:12 AM
Thank you. The help is much appreciated. It looks like everything is working according to plan. Although there isn't really a way to see if the image hack is really working... not one that I can see.
Posted By: Gizmo Re: URL and IMG prefix - 09/22/2005 5:53 AM
View the page (or image) source and see wink ...
Posted By: God Re: URL and IMG prefix - 09/22/2005 4:19 PM
It's working perfectly for the posting. Only thing is that it needs to also have the prefixes in the profile, the sig, and the avator. Could someone tell me how this can be done?

I'm guessing it's pretty much the same thing as LK posted except to some other files.
© UBB.Developers