<?php 
/*********************************************************
 * Author: John Astill (c)
 * Date  : 9th December
 * File  : index.php
 ********************************************************/
// Measure the time taken to load the page.
$starttime = time();

  require_once "systemvars.php";
  require_once "dbasedata.php";
  require_once "configfunctions.php";
  require_once "utilfunctions.php";
  require_once "validatorclass.php";
  require_once "leaguefunctions.php";
  require_once "configvalues.php";
  require_once "sortfunctions.php";
  require_once "filefunctions.php";
  require_once "security.php";
  require_once "userfunctions.php";
  require_once "iconfunctions.php";
  require_once "fixturefunctions.php";
  require_once "jsonfunctions.php";
  require_once "tournamentfunctions.php";
  require_once "shoutboxfunctions.php";
  require_once "teamfunctions.php";
  require_once "privateleaguefunctions.php";
  require_once "controller.php";

  // Enable the logging of queries if logging is turned on.
  $LogQueries = GetParamFromURL("logqueries",$LogQueries);
  // Get the navigation command.
  $cmd = GetCommandFromURL();
  if ($cmd == "" || $cmd == "table") {
    //require_once "checksysconfig.php";
  }

  $lid = GetParamFromURL("lid",$lid);
  $leagueID = $lid;
  
  $week = "";
  $week = GetParamFromURL("week",$week);
  $month = "";
  $month = GetParamFromURL("month",$month);
  if ($month == "") {
    $month = GetLastMonthFromMonthlyWinners();
  }
  $cmd = GetCommandFromURL();
  $controller = new Controller($cmd, $User);

  $globalTeams = GetTeams();
  $globalLeagues = GetLeagues();
  
  if ($controller->is_view() == true) {
    require_once "mainview.php";
  } else {
    $controller->execute();
  }
  $dbase->close();
?>
