include("include/config.php");
include("include/db.php");
include("include/func.php");
include("include/init.php");
include("include/lastRSS.php");
include("include/cbparser.php");
if(!bCheckRegcode($HTTP_SERVER_VARS["SERVER_NAME"], $GLOBALS["RegKey"], $GLOBALS["RegKeyCheck"]))
{
?>Wrong license key entered.
Please check that the registration keys are for the server name: echo $HTTP_SERVER_VARS["SERVER_NAME"]; ?>
exit();
}
// SET USER ACCESS GLOBALS (for preformance enhancements)
SetUserAccessGlobals();
include("prototypes/process/main.php");
//Start_Timer();
// Check if update stats is enabled.
if(strGetFldTblValue("vccsettings", "vsName", "sta_enabled", "vsValue") == "1") Update_Stats();
clearCache();
import_request_variables("gP", "GP_");
global $strIdPage;
global $strPage;
global $strBlockName;
global $strParsedVarName;
if($GLOBALS["GP_pageid"] == "" && $GLOBALS["GP_pageid_source"] != "")
{
$strIdPage = $GLOBALS["GP_pageid_source"];
}
else
{
$strIdPage = $HTTP_GET_VARS["pageid"];
if($strIdPage == '')
{
$strIdPage = $HTTP_POST_VARS["pageid"];
if($strIdPage == '')
{
$strIdPage = "main";
}
}
}
// Form validation part. If there are errors on submition form and the pageid_fail is set,
// then show contents of that page.
if($GLOBALS["nErrorCount"] > 0)
{
if($GLOBALS["GP_pageid_fail"] != "")
{
$strIdPage = $GLOBALS["GP_pageid_fail"];
}
else
{
$strIdPage = $GLOBALS["GP_pageid_source"];
}
}
if(isset($HTTP_GET_VARS["catid"]))
$GLOBALS["GP_catid"] = $HTTP_GET_VARS["catid"];
elseif (isset($HTTP_POST_VARS["catid"]))
$GLOBALS["GP_catid"] = $HTTP_POST_VARS["catid"];
else
$GLOBALS["GP_catid"] = strGetHomeCat();
//echo "Debug:".$GLOBALS["GP_catid"];
// FORUM MODULE variables
if(isset($HTTP_GET_VARS["frmid"]))
$GLOBALS["GP_frmid"] = $HTTP_GET_VARS["frmid"];
elseif (isset($HTTP_POST_VARS["frmid"]))
$GLOBALS["GP_frmid"] = $HTTP_POST_VARS["frmid"];
else
$GLOBALS["GP_frmid"] = "";
if(isset($HTTP_GET_VARS["frtid"]))
$GLOBALS["GP_frtid"] = $HTTP_GET_VARS["frtid"];
elseif (isset($HTTP_POST_VARS["frtid"]))
$GLOBALS["GP_frtid"] = $HTTP_POST_VARS["frtid"];
else
$GLOBALS["GP_frtid"] = "";
if(isset($HTTP_GET_VARS["frpid"]))
$GLOBALS["GP_frpid"] = $HTTP_GET_VARS["frpid"];
elseif (isset($HTTP_POST_VARS["frpid"]))
$GLOBALS["GP_frpid"] = $HTTP_POST_VARS["frpid"];
else
$GLOBALS["GP_frpid"] = "";
if(isset($HTTP_GET_VARS["blk"]))
$GLOBALS["GP_blk"] = $HTTP_GET_VARS["blk"];
elseif (isset($HTTP_POST_VARS["blk"]))
$GLOBALS["GP_blk"] = $HTTP_POST_VARS["blk"];
else
$GLOBALS["GP_blk"] = "";
if(isset($HTTP_GET_VARS["sblk"]))
$GLOBALS["GP_sblk"] = $HTTP_GET_VARS["sblk"];
elseif (isset($HTTP_POST_VARS["sblk"]))
$GLOBALS["GP_sblk"] = $HTTP_POST_VARS["sblk"];
else
$GLOBALS["GP_sblk"] = "";
$result = dbExecute("select * from ".$GLOBALS["vsCmsPrefix"]."pages where pgName='".$strIdPage."'", true);
if($rs = dbFetch($result))
{
$GLOBALS["PageContentType"] = $rs["pgContentType"];
// Send the correct page header
if($rs["pgContentType"] == "")
header("Content-type: text/html");
else
header("Content-type: ".$rs["pgContentType"]);
if(!bCheckPageAccess($rs["pgAccess"]))
{
$strNoAccessPageId = $rs["pgNoAccessPage"];
if($strNoAccessPageId != "")
{
dbFreeResult($result);
$result = dbExecute("select * from ".$GLOBALS["vsCmsPrefix"]."pages where pgName='".$strNoAccessPageId."'", true);
if($rs = dbFetch($result))
{
$strIdPage = $strNoAccessPageId;
$strTemplate = $rs["pgCode"];
}
else
{
echo userError("The (no access) page ".$strNoAccessPageId." does not exist!", true);
dbFreeResult($result);
exit();
}
}
else
{
$strTemplate = $rs["pgCode"];
}
}
else
{
$strTemplate = $rs["pgCode"];
}
}
else
{
echo userError("The page ".$strIdPage." does not exist!", true);
dbFreeResult($result);
exit();
}
dbFreeResult($result);
// Set Forum Cookies (Must be after the sending of headers)
strSetLastVisitCookie();
// Find all blocks that are used in a page. The code below also checks if there are parsing errors.
$arBlocks = splitBlocks($strTemplate, "%", true);
// When no %tags% are present just show it as it is.
$strPage = $strTemplate;
// All the blocks that are used are stored in $arBlocks array. Below we explode the blocks on a page.
foreach ($arBlocks as $strBlockName)
{
$blocks = explode("[%".$strBlockName."%]", $strTemplate);
$count = count($blocks);
$i = 0;
$strPage = "";
foreach ($blocks as $block)
{
$strPage .= $block;
$i++;
if ($i >= $count) break;
// Include the correct file
$strProt = findProtoype($strBlockName, $GLOBALS["nBlockAccess"]);
// DEBUG: echo "prototypes/".$strProt.".php, blockname=$strBlockName
";
if($strProt <> "")
include("prototypes/".$strProt.".php");
else
$strPage .= userError("No such block");
}
$strTemplate = $strPage;
}
///////////////////////////////////////////////////////////////////////////
// Parse the blocks inside contents or other blocks!
// Find all blocks that are used in a page. The code below also checks if there are parsing errors.
$arBlocks = splitBlocks($strTemplate, "%", true);
// When no %tags% are present just show it as it is.
$strPage = $strTemplate;
// All the blocks that are used are stored in $arBlocks array. Below we explode the blocks on a page.
foreach ($arBlocks as $strBlockName)
{
$blocks = explode("[%".$strBlockName."%]", $strTemplate);
$count = count($blocks);
$i = 0;
$strPage = "";
foreach ($blocks as $block)
{
$strPage .= $block;
$i++;
if ($i >= $count) break;
// Include the correct file
$strProt = findProtoype($strBlockName, $GLOBALS["nBlockAccess"]);
if($strProt <> "")
include("prototypes/".$strProt.".php");
else
$strPage .= userError("No such block");
}
$strTemplate = $strPage;
}
///////////////////////////////////////////////////////////////////////////
// Parse the blocks inside contents or other blocks! (2ND LEVEL) BLOCKS inside BLOCKS
// Find all blocks that are used in a page. The code below also checks if there are parsing errors.
$arBlocks = splitBlocks($strTemplate, "%", true);
// When no %tags% are present just show it as it is.
$strPage = $strTemplate;
// All the blocks that are used are stored in $arBlocks array. Below we explode the blocks on a page.
foreach ($arBlocks as $strBlockName)
{
$blocks = explode("[%".$strBlockName."%]", $strTemplate);
$count = count($blocks);
$i = 0;
$strPage = "";
foreach ($blocks as $block)
{
$strPage .= $block;
$i++;
if ($i >= $count) break;
// Include the correct file
$strProt = findProtoype($strBlockName, $GLOBALS["nBlockAccess"]);
//echo "Found block:".$strBlockName." prototype: ".$strProt."
";
if($strProt <> "")
include("prototypes/".$strProt.".php");
else
$strPage .= userError("No such block");
}
$strTemplate = $strPage;
}
///////////////////////////////////////////////////////////////////////////
// Parse global variables inside a page
$strHtmlCode = $strPage;
$arVars = splitBlocks($strHtmlCode, "$", true);
foreach ($arVars as $strVarName)
{
$blocks2 = explode("[$".$strVarName."$]", $strHtmlCode);
$count2 = count($blocks2);
$i2 = 0;
$strBlock = "";
foreach ($blocks2 as $block2)
{
$strBlock .= $block2;
$i2++;
if ($i2 >= $count2) break;
include("./prototypes/process/globalvalues.php");
//if(!$bVarFound)
// $strBlock .= userError("[$".$strVarName."$] : No such variable");
}
$strHtmlCode = $strBlock;
}
$strPage = $strHtmlCode;
///////////////////////////////////////////////////////////////////////////
if($GLOBALS["strDesignErrors"] != "")
echo $GLOBALS["strDesignErrors"];
echo $strPage;
if($GLOBALS["GP_refreshframes"] == "1")
{
?>
}
if($GLOBALS["GP_updateframes"] == "1")
{
?>
}
//echo chr(13)."".chr(13);
//End_Timer();
?>