/index.php
<?PHP
//* Agares Media CMS- Version 3.0 *//
//* Copyright 2007 � Agares Media. All rights reserved. *//
//* Use of this software is governed by the terms of our license *//
error_reporting(0);
$benchmark_start = microtime();
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
ob_start("ob_gzhandler"); // Compress the HTML
header("Content-Encoding: gzip");
}
require_once("./includes/corefunctions.php"); // Load the AMCMS3 functions
require_once("./includes/db.php"); // Get the database configuration settings & connect to DB.
require_once('./includes/Smarty/libs/Smarty.class.php'); $smartyDeclared = true; // 2.709 adds support for the Smarty templating system
require_once("./includes/config.php"); // Load the admin's preferences
require_once('./language/'.$script_language.'/index.php');
require_once("./includes/gamefunctions.php"); // Load the AMCMS3 game functions
am_session(); // Start the session if nothing else has
require_once("./includes/loginsubmit.php"); // Load login submission
if (isset($_POST['gname']) || isset($_REQUEST['id']) || $_GET['autocom'] || $_POST['autocom'] || $_GET['do'] || $_POST['thescore'] || $_POST['gscore'] || $_GET['scoreVar'] || isset($_POST['sessdo'])) {
require_once('./includes/submitscore.php'); // Handles the submission of high scores.
}
if ($promptToRegister ==true) {
$headload = '
<script type="text/javascript">
jQuery(function(){
setTimeout(function(){
tb_show(\'Register\', \'./highscoreregister.php?height=450&width=425&keepThis=true&TB_iframe=true\', null);
}, 250);
});
</script>
';
}
if ($_GET['loadpage']=='./includes/profile.php' && $_GET['challenge']=='true') {
$authorkey = am_injection($_GET['userkey']);
$headload = '
<script type="text/javascript">
jQuery(function(){
setTimeout(function(){
tb_show(\'Challenge\', \'./challenge.php?height=480&width=425&userkey='.$authorkey.'&keepThis=true&TB_iframe=true\', null);
}, 250);
});
</script>
';
}
$rotationcode = ' <script type="text/javascript" src="./includes/jquery/core.js"></script>
<script type="text/javascript" src="./includes/jquery/selector.js"></script>
<script type="text/javascript" src="./includes/jquery/event.js"></script>
<script type="text/javascript" src="./includes/jquery/ajax.js"></script>
<script type="text/javascript" src="./includes/jquery/fx.js"></script>
<script type="text/javascript" src="./includes/i/iutil.js"></script>
<script type="text/javascript" src="./includes/i/idrag.js"></script>
<script type="text/javascript" src="./includes/i/accordion.js"></script>
<script type="text/javascript" src="./includes/i/carousel.js"></script>';
$reg_pass = am_getuserpass();
if ($themedir=='/theme/Smarty/') {
$smarty->assign('headload',$headload); // Assign to smarty
$smarty->assign('rotationcode',$rotationcode); // Assign to smarty
if($_GET['cat']!=NULL) {
require_once('./logic/gamecategory.php'); // Execute the business logic for the game categories
$smarty->display('gamecategory.tpl'); // Display the template for gamecategory.php
exit;
} elseif($_GET['loadpage']!=NULL) {
require_once('./logic/loadpage.php');
exit;
} elseif($_GET['article']!=NULL) {
require_once('./logic/article.php'); // Execute the business logic for displaying articles
$smarty->display('article.tpl'); // Display the template for articles.php
} else {
$smarty->display('index.tpl'); // Display the template for index.php
exit;
}
} else {
include_once(".".$themepath."top.php"); // Loads the topmost information (do not confuse this with the header)
include_once(".".$themepath."header.php"); // Loads the header and menu
require_once("./includes/cache_top.php"); // Load the page cache code
include_once(".".$themepath."sidebar.php"); // Loads the sidebar
include_once(".".$themepath."frontpage_right.php"); // Loads the right content
am_depthstats(); // Calls DepthStats code.
include_once(".".$themepath."footer.php"); // Loads the footer (there is no bottom.php, this is the last file)
require_once("./includes/cache_bottom.php"); // Load the page cache code
}
$benchmark_end = microtime();
$benchmark = $benchmark_end - $benchmark_start;
print("<!-- Script Execution Time: " . $benchmark . "-->\n");
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
echo '<!-- gzip successful -->';
ob_end_flush(); // Output the uncompressed HTML
} else {
echo '<!-- '.$HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'].' -->';
}
mysql_close($db);
?>