<?php
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ******************************************************************** >>
<< * ---------------------------------------------------------------- * >>
<< * Copyright ©2011-2012 Ozzy47                                      * >>
<< * All Rights Reserved. 											  * >>
<< * This file may not be redistributed in whole or significant part. * >>
<< * ---------------------------------------------------------------- * >>
<< * You are not allowed to use this on your server unless the files  * >>
<< * you downloaded were done so with permission.					  * >>
<< * ---------------------------------------------------------------- * >>
<< ******************************************************************** >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

global $vbulletin, $stylevar;

if (check_navigation_permission($data, $bypass))
{
	if ($data['navtype'] == 'tab' AND $data['usetabid'] AND $data['links'])
	{
		$addTabId = function($links) use (&$addTabId, $root)
		{
			foreach ($links as &$link)
			{
				if ($link['navtype'] == 'menu')
				{
					if ($link['children'])
					{
						return $addTabId($link['children']);
					}
				}
				else if (substr($data['url'], 0, 13) != 'javascript://')
				{
					$join = strpos($link['url'], '?') ? '&' : '?';
					$link['url'] = $link['url'] . $join . 'tabid=' . $root;
				}
			}

			return $links;
		};

		$menulist[$data['navid']]['children'] = $addTabId($menulist[$data['navid']]['children']);
	}

	if ($data['tabtarget'])
	{
		$menulist[$data['navid']]['url'] .= '" target="' . $data['tabtarget'];
	}

	if ($data['tabnofollow'])
	{
		$menulist[$data['navid']]['url'] .= '" rel="nofollow';
	}

	if ($data['tabtitle'])
	{
		$menulist[$data['navid']]['url'] .= '" title="' . $data['tabtitle'];
	}

	if ($vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding'])
	{
		$image_padding = ' padding: ' . (int)$vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['top'] . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['units'];
		$image_padding .= ' ' . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['right'] . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['units'];
		$image_padding .= ' ' . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['bottom'] . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['units'];
		$image_padding .= ' ' . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['left'] . $vbulletin->stylevars['dbtech_vbnavtabs_420_image_padding']['units'] . ';';
	}

	if ($data['tabimage'])
	{
		if ($data['navtype'] == 'tab')
		{
			$menulist[$data['navid']]['title'] = '<img src="' . $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['dbtech_vbnavtabs_420_images']['imagedir'] . '/' . $data['tabimage'] . '" alt="" style="margin-bottom:.25em; vertical-align:middle; '.$image_padding.'" /> ' . $data['text'];
		}
		else
		{
			$menulist[$data['navid']]['title'] = '<img src="' . $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['dbtech_vbnavtabs_420_images']['imagedir'] . '/' . $data['tabimage'] . '" alt="" style="margin-bottom:.25em; vertical-align:middle; '.$image_padding.'" /> ' . $data['text'];
		}
	}

	if ($data['tabcolor'])
	{
		$menulist[$data['navid']]['title'] = '<span style="color:' . $data['tabcolor'] . '">' . $menulist[$data['navid']]['title'] . '</span>';
	}
}

/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ********************************************************************* >>
<< * Created: 09:30, Fri June 8th 2012                                 * >>
<< * VER: 1.0.0                                                        * >>
<< ********************************************************************* >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
?>