Page 1 of 1

Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 2:56 pm
by Spaz
My forums is using the wrapper,  but when a user opens a topic in a new tab / windows it shows vb outside the wrapper is there any way i can detect this and keep it inside the wrapper.

Re: Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 3:55 pm
by chockers
not really man, as when its wrapped its just the forum being put within a space allocated on your page..

it doesnt actualy change the links of the forum.. which would be needed for your question..

however you could disable right click, which would stop people openin in a new window.. but then they could hold a button and press the link, but either way if people want to open in a new window.. u cant stop them.. lol

Re: Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 6:46 pm
by Spaz
I just had a thought, maybe preditor can help me out with this, what if I changed the links from vb to use the link from the bridge eg.
with my vba gallery i call it by saying
index.php?option=com_vbridge&Itemid=33&file=gallery/index.php

so in my test when i modify that link to be
index.php?option=com_vbridge&Itemid=33&file=forumdisplay.php?f=2

it works and its in the wrapper. So all i need to do is have vb make all links to have index.php?option=com_vbridge&Itemid=33&file= before the original.

so i theory that will produce the links i want so no matter what the users do it is always in the wrapper.
hope you understand what i am saying.

Re: Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 7:43 pm
by chockers
or there i that method.. it would require u to find where it is in which file.. but its doable, but a long process.. however if u did find out plz let the community know.. it would be a good addition to the release

Re: Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 9:38 pm
by Predator
A replace function was included in the older versions, to have this also for vB 3.5.x

in foum/includes/functions.php at line 4241-4244 after

Code: Select all

if ($vbulletin->debug AND $debughtml != '')
	{
		$vartext = str_replace('</body>', "<!--start debug html-->$debughtml<!--end debug html-->\n</body>", $vartext);
	}

add:

Code: Select all

//<!-- Begin Joomla-vBridge from WH-SOLUTION -->
$vbconfig = $vbulletin->db->query_first("SELECT * FROM ".MOS_PREFIX."vbridge_config WHERE id='1'");

if ($vbconfig['wrapped'] == 1 ) {

$Itemid = $vbulletin->db->query_first("SELECT id FROM ".MOS_PREFIX."menu WHERE link='index.php?option=com_vbridge' AND published='1'");
$mosurl = MOS_URL."/index.php?option=com_vbridge&Itemid=".$Itemid['id']."&file=";
$vartext = str_replace("php?","php&", $vartext);
$vartext = str_replace("index.php&","index.php", $vartext);
$vartext = str_replace("&&","?", $vartext);
$vartext = str_replace("&buddies=","", $vartext);
$vartext = str_replace("&option","?option", $vartext);
$vartext = str_replace("attachment.php&","attachment.php?", $vartext);
$vartext = str_replace("image.php&","image.php?", $vartext);
$vartext = str_replace("online.php&order","online.php?order", $vartext);
$vartext = str_replace("online.php&","online.php", $vartext);
$vartext = str_replace('href="', 'href="'.$mosurl.'',$vartext);
$vartext = str_replace('href="'.$mosurl.'online.php','href="online.php',$vartext);
$vartext = str_replace('URL=', 'URL='.$mosurl.'',$vartext);
$vartext = str_replace('URL='.$mosurl.'misc.php&', 'URL=misc.php?',$vartext);
$vartext = str_replace('window.location = "', 'window.location = "'.$mosurl.'',$vartext);
$vartext = str_replace("window.location = '", "window.location = '".$mosurl."",$vartext);
$vartext = str_replace('window.location="', 'window.location="'.$mosurl.'',$vartext);
$vartext = str_replace("window.open('", "window.open('$mosurl",$vartext);
$vartext = str_replace('window.open("', 'window.open("'.$mosurl.'',$vartext);
$vartext = str_replace('openWindow("private.php&','openWindow("private.php?',$vartext);
$vartext = str_replace('img_obj.src = "', 'img_obj.src = "'.$mosurl.'',$vartext);
$vartext = str_replace('<form action="report.php', '<form action="'.$mosurl.'report.php',$vartext);
$vartext = str_replace("opener.location=('", "opener.location=('$mosurl",$vartext);
$vartext = str_replace('opener.location=("', 'opener.location=("'.$mosurl.'',$vartext);
$vartext = str_replace('opener.location="', 'opener.location="'.$mosurl.'',$vartext);
}
//<!-- End Joomla-vBridge -->

Re: Opening a new window while in wrapper

Posted: Fri Nov 18, 2005 10:28 pm
by Spaz
Yer, it works one error though

Code: Select all

$vbconfig = $DB_site->query_first("SELECT * FROM ".MOS_PREFIX."vbridge_config WHERE id='1'");
should be

Code: Select all

$vbconfig = $vbulletin->db->query_first("SELECT * FROM ".MOS_PREFIX."vbridge_config WHERE id='1'");
Thanx  ;D

edit. grrr
My gallery links dont work with it, but now that I know what 2 do i will try and figure it out, i just need to figure out which links come from the gallery and make the change to $mosurl = MOS_URL."/index.php?option=com_vbridge&Itemid=".$Itemid['id']."&file="; 
to include file=gallery/

will let yall know how i did.

Re: Opening a new window while in wrapper

Posted: Sun Nov 20, 2005 2:59 pm
by Spaz
OK, I cant seem to figure this out, need some expert help with it, just to recap I am using vbAdvanced Gallery along with the vBridge now I applied the code preditor left, and It works nice for the forum, but because the gallery is in a subdir the links dont match.
eg index.php?option=com_vbridge&Itemid=33&file=browseimages.php&c=2 should be
index.php?option=com_vbridge&Itemid=33&file=gallery/browseimages.php&c=2.
I tried doing the strReplace but its hard knowing which is from gallery etc.
eg.
//Gallery Replacements
$vartext = str_replace("browseimages.php","gallery/browseimages.php", $vartext);
$vartext = str_replace("displayimage.php","gallery/displayimage.php", $vartext);
$vartext = str_replace("ecard.php","gallery/ecard.php", $vartext);
$vartext = str_replace("editimage.php","editimage.php", $vartext);
$vartext = str_replace("managecats.php","gallery/managecats.php", $vartext);
$vartext = str_replace("upload.php","gallery/upload.php", $vartext);
$vartext = str_replace("showimage.php","gallery/showimage.php", $vartext);
//$vartext = str_replace("misc.php","gallery/misc.php", $vartext);
$vartext = str_replace("newreply.php","gallery/newreply.php", $vartext);
$vartext = str_replace("moderate.php","gallery/moderate.php", $vartext);
works but I cant uses it for say search.php because it would messup the search for the forums aswell
if any experts got the time to give this problem some thought would be appricated, because I cant see how to make it work.
Thanx

Re: Opening a new window while in wrapper

Posted: Mon Jun 04, 2007 11:13 pm
by ocWikiSysop
I'm interested in doing this exact same thing under 3.6.5. I've tried adding the above code to a clean VB install and all I get is a db crash. Does anyone have update code for this?