<?php

include "../includes/localsettings.php";	
include "../library/php-mysql.php";
include "../library/php-date.php";
include "../library/php-template.php";
include "../library/php-request.php";
include "../includes/functions.php";

// Session enforcement
$AdminID = request("AdminID");

if( $EnforceSession )
{
	$Record = SelectSingleRow("SELECT id FROM admin WHERE id = '" . $AdminID . "' AND site = '" . $gblSiteName . "'");
	if( $Record->GetValue("id") == "" )
	{
		header("403 Forbidden");
		echo "<a href=/>Please return to the main page</a>";
		exit;
	}
}

// Set global query variables
$GlobalQuery = "AdminID=" . $AdminID;
		
// Check global escapes
function CheckGlobalEscapes( &$tpCurrent )
{
		
	CheckCoreEscapes($tpCurrent);

	global $GlobalQuery;
	global $bDummyDataTipExclude;
	global $EnforceSession;
	
	if( $tpCurrent->IsEscape("GLOBAL-QUERY") ) echo $GlobalQuery;
	else if( $tpCurrent->IsEscape("GLOBAL-IF-SHOW-DUMMY-DATA-TIP") )
	{
		if( !$bDummyDataTipExclude )
			echo $tpCurrent->GetEscapeArgument();
	}
	else if( $tpCurrent->IsEscape("GLOBAL-IF-ENFORCE-SESSION") )
	{
		if( $EnforceSession )
			$tpCurrent->PushArgumentToStream();
	}		
	else if( $tpCurrent->IsEscape("GLOBAL-IF-NOT-ENFORCE-SESSION") )
	{
		if( !$EnforceSession )
			$tpCurrent->PushArgumentToStream();
	}		
	
}	
	
?>