The M.I.P.
11-01-2004, 10:00 PM
This tiny modification adds a redirector like http://anonym.to/? to external (non local) URLs. External links open in a new browser window, local ones open in the same window.
Have a look on the Active Link Security (https://vborg.vbsupport.ru/showthread.php?t=70684) modification which does pretty much the same.
Use the patch below to apply the needed changes to your includes/functions_bbcode.php.
To apply it manually, open your includes/functions_bbcode.php and search for "function handle_bbcode_url".
Replace the lines beginning with "-" inside the patch with those beginning with "+" (don't include the "+/-").
diff -urw vbb.303/upload/includes/functions_bbcodeparse.php vbb.303.urlprefix/upload/includes/functions_bbcodeparse.php
--- vbb.303/upload/includes/functions_bbcodeparse.php Wed Aug 25 09:36:06 2004
+++ vbb.303.urlprefix/upload/includes/functions_bbcodeparse.php Tue Aug 31 15:58:59 2004
@@ -1437,7 +1442,7 @@
// ###################### Start handle_bbcode_url #######################
function handle_bbcode_url($text, $link, $type = 'url')
{
- global $wysiwygparse;
+ global $wysiwygparse, $vboptions;
if (trim($text) == '')
{
@@ -1475,8 +1480,18 @@
if ($type == 'url')
{
+ if (stristr($rightlink,$vboptions['bburl']))
+ {
+ $urlprefix = '';
+ $target = "_self";
+ }
+ else
+ {
+ $urlprefix = $vboptions['urlprefix'];
+ $target = "_blank";
+ }
// standard URL hyperlink
- return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
+ return "<a href=\"{$urlprefix}{$rightlink}\" target=\"{$target}\">$text</a>";
}
else
{Now switch into debug mode by adding a line $debug = true; to your includes/config.php.
Go into your vBulletin Options in your administration control panel (AdminCP). Choose an appropiate setting group (e.g. "General Settings").
Add a new setting (you need to be in debug mode for this) for your URL redirector:
Varname: urlprefix
Title: URL Prefix/Redirector
Description: URL Prefix like http://anonym.to/?
Default: http://anonym.to/?
vBulletin Default: No
Save the new setting, check if it appears in your vBulletin Options (again, save it), remove the debug mode line in your config.php and you're done.
Have a look on the Active Link Security (https://vborg.vbsupport.ru/showthread.php?t=70684) modification which does pretty much the same.
Use the patch below to apply the needed changes to your includes/functions_bbcode.php.
To apply it manually, open your includes/functions_bbcode.php and search for "function handle_bbcode_url".
Replace the lines beginning with "-" inside the patch with those beginning with "+" (don't include the "+/-").
diff -urw vbb.303/upload/includes/functions_bbcodeparse.php vbb.303.urlprefix/upload/includes/functions_bbcodeparse.php
--- vbb.303/upload/includes/functions_bbcodeparse.php Wed Aug 25 09:36:06 2004
+++ vbb.303.urlprefix/upload/includes/functions_bbcodeparse.php Tue Aug 31 15:58:59 2004
@@ -1437,7 +1442,7 @@
// ###################### Start handle_bbcode_url #######################
function handle_bbcode_url($text, $link, $type = 'url')
{
- global $wysiwygparse;
+ global $wysiwygparse, $vboptions;
if (trim($text) == '')
{
@@ -1475,8 +1480,18 @@
if ($type == 'url')
{
+ if (stristr($rightlink,$vboptions['bburl']))
+ {
+ $urlprefix = '';
+ $target = "_self";
+ }
+ else
+ {
+ $urlprefix = $vboptions['urlprefix'];
+ $target = "_blank";
+ }
// standard URL hyperlink
- return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
+ return "<a href=\"{$urlprefix}{$rightlink}\" target=\"{$target}\">$text</a>";
}
else
{Now switch into debug mode by adding a line $debug = true; to your includes/config.php.
Go into your vBulletin Options in your administration control panel (AdminCP). Choose an appropiate setting group (e.g. "General Settings").
Add a new setting (you need to be in debug mode for this) for your URL redirector:
Varname: urlprefix
Title: URL Prefix/Redirector
Description: URL Prefix like http://anonym.to/?
Default: http://anonym.to/?
vBulletin Default: No
Save the new setting, check if it appears in your vBulletin Options (again, save it), remove the debug mode line in your config.php and you're done.