<?php
$signatureoverride = true;
$vbulletin->options['dbtech_vbshop_override_cancustomsignature_exempt'] = @unserialize($vbulletin->options['dbtech_vbshop_override_cancustomsignature_exempt']);
if (
	($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature']) AND 
	$vbulletin->options['dbtech_vbshop_override_cancustomsignature'] AND 
	!is_member_of($vbulletin->userinfo, (array)$vbulletin->options['dbtech_vbshop_override_cancustomsignature_exempt'])
)
{
	// Verify purchases
	VBSHOP::verify_purchases($vbulletin->userinfo);
	
	foreach ($vbulletin->userinfo['dbtech_vbshop_purchase'] as $purchaseid => $purchase)
	{
		if ($purchase['feature'] != 'item' OR $purchase['userid'] != $vbulletin->userinfo['userid'])
		{
			// Skip the feature
			continue;
		}
		
		if (!$purchase['active'])
		{
			// Skip the feature
			continue;
		}
		
		if (!$item = VBSHOP::$cache[$purchase['feature']][$purchase['featureid']])
		{
			// Skip this
			continue;
		}

		if (!$item['active'])
		{
			// Skip this
			continue;
		}

		if ($item['itemtypeid'] != 'signaturechange')
		{
			// Skip this
			continue;
		}

		// We're not overriding permissions
		$signatureoverride = false;
		break;
	}

	if ($signatureoverride)
	{
		// Fake no permissions
		eval(standard_error(fetch_error('nosignaturepermission')));
	}
}
?>