MyBB Community Forums

Full Version: defrant targe between internal links and external
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello guys

I just need little help in class_parser.php

I want whene the message have an url and that url redirect to any part of my forum the url open in the same window

else if the url is an external url then open new window

I tryed to the following in the class_parser.php line 668 or so
find
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		return $link;
I replace it with the following
$inurl = $mybb->settings['bburl']."'/(.*?)\'";
		$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
		if ($url !=$inurl || $fullurl !=$inurl || $url !=$mybb->settings['bburl'] || $fullurl !=$mybb->settings['bburl'])
		{
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		}
		else {
		$link = "<a href=\"$fullurl\">$name</a>";
		}
		return $link;

but it's still doesn't work..
any idea?
Open .inc/class_parser.php

Find
	function mycode_parse_url($url, $name="")
	{

Add below
		global $mybb;

Find
		
	$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";

Replace By
		if(strpos($fullurl, $mybb->settings['bburl']) === false)
		{		
			$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		}
		else
		{
			$link = "<a href=\"$fullurl\">$name</a>";
		}
thanks alot dear thats did it