Log in

View Full Version : Modifying the [url] function?


Joshua5692
02-06-2006, 12:28 PM
Due to spam the owner of the board I help wants links to open in a new window through his own site in a frame. Similar to the way external links are viewed on about.com or the Google image search feature. But there is no way to edit the [ url] code from the admin panel. It is not listed with the vbcode, can anyone advise please how we add this domain to the link?

The new links would look similar to this:

http://www.hisdomain.com/link?out=http://www.submittedlink.com

Anyone please?

S@NL - BlackBik
02-06-2006, 08:45 PM
You could check the class_bbcode.php in includes.
url's are parsed in there, i think.

Joshua5692
02-07-2006, 01:13 PM
Thank you, it would seem we are half way there now. I found the lines. They look like this....

function handle_bbcode_url($text, $link)
{
$rightlink = trim($link);
if (empty($rightlink))
{
// no option -- use param
$rightlink = trim($text);
}
$rightlink = str_replace(array('`', '"', "'", '['), array('`', '"', ''', '['), $this->strip_smilies($rightlink));

if (!preg_match('#^[a-z0-9]+(?<!about|javascript|vbscript):#si', $rightlink))
{
$rightlink = "http://$rightlink";
}

if (!trim($link) OR $text == $rightlink)
{
$tmp = unhtmlspecialchars($rightlink);
if (vbstrlen($tmp) > 55 AND $this->is_wysiwyg() == false)
{
$text = htmlspecialchars_uni(substr($tmp, 0, 36) . '...' . substr($tmp, -14));
}
}

// remove double spaces -- fixes issues with wordwrap
$rightlink = str_replace(' ', '', $rightlink);

// standard URL hyperlink
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
}


So I see at the end the hyperlink return, that is where I assumed I would add the domain the way we need for the script to work. However, I have tried several different ways of adding it and can't seem to get the proper syntax, up to this point PHP seemed fairly easy the past year or so.

Can anyone give a suggestion? I keep getting the following error:
Parse error: parse error, unexpected T_STRING in /domainname/public_html/forum/includes/class_bbcode.php on line 1705
Line 1705 is the hyperlink return line.

Again what we need the rendered as is :

http://www.hisdomain.com/link?out=http://www.link.com
I assume too that $rightlink is the submitted link. Can anyone help out with the proper php format for adding the additional domain before the submitted?

Joshua5692
03-03-2006, 11:42 AM
Seriously, nobody can help with that last sentence? :(

Iain M
03-03-2006, 01:45 PM
you could use the redirection page from this hack

https://vborg.vbsupport.ru/showthread.php?s=&threadid=91021

and the options from this hack

https://vborg.vbsupport.ru/showthread.php?t=95753