<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);

include("oldinclude/dbcommon.php");

##if @BUILDER.m_bCreateLoginPage##
if(!@$_SESSION["UserID"])
{
	header("Location: login.php");
	return;
}
##endif##

##if @BUILDER.arrLanguages.len>1##
include("oldinclude/languages.php");
##endif##

include('oldlibs/Smarty.class.php');
$smarty = new Smarty();

$conn=db_connect();
//	Before Process event
if(function_exists("BeforeProcessMenu"))
	BeforeProcessMenu($conn);


##if @BUILDER.m_bCreateLoginPage##
$smarty->assign("username",$_SESSION["UserID"]);
$smarty->assign("not_a_guest",$_SESSION["AccessLevel"] != ACCESS_LEVEL_GUEST);
##if GroupSecurity##
##foreach @BUILDER.Tables as @t filter @t.bMenuItem##
$strPerm = GetUserPermissions("##@t.strDataSourceTable s##");
$smarty->assign("allow_##@t.strShortTableName##",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
##endfor##
##endif##
##if @BUILDER.bDynamicPermissions##
$smarty->assign("admin",IsAdmin());
##endif##
##endif##

$templatefile="menu.htm";
if(function_exists("BeforeShowMenu"))
	BeforeShowMenu($smarty,$templatefile);

$smarty->display($templatefile);
?>