Newer
Older
Digital_Repository / Repositories / statistics / htdocs / index.php
<?php

/**
 * Project:        EprintsStats. Stats of ePrints usage.
 * File:           index.php
 * Project Owner:  Information Division : Telars : Web Publishing
 */

/* Modified by Arthur Sale, University of Tasmania, 2004. */

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");   
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");  

$platform = "unix";
$meta_keywords = "";

// Load configuration vars into $GLOBALS - Available as $GLOBALS["config_vars"]
// open_basedir safe_mode_gid include_path are set in apache apache.conf vhost section
require("inc.vars.es.php"); 
require("inc.fns.es.php");
require("inc.class.mysql.es.php");
require("inc.class.input_check.es.php");
require("inc.class.logger.es.php");
require("inc.class.show_debug.es.php");
require("inc.fns.merge.es.php");
$debug = new ShowDebug();

$file_log = $GLOBALS["config_vars"]["filelocation"]["base_install_dir"][$platform] . "/" .
	    $GLOBALS["config_vars"]["filelocation"]["base_log_dir"]  . "/" ."general.es.log";
$logger = new Logger($file_log);

/*
	Are we public or private. This alters which files get included.
	We try to keep the public included files separate.
*/
$GLOBALS["config_vars"]["thisrequest"] = 'public';
// NJS 2006-06-16
// Use the default site unless the virtual host mapping specifies
// otherwise. If the request variable "default" is set, use the default
// site regardless.
$GLOBALS["config_vars"]["archivename"] = 'default';
if (    isset( $_SERVER["SERVER_NAME"] )
	and isset( $GLOBALS["config_vars"]["general"]["virtual_host_to_archive"][$_SERVER["SERVER_NAME"]] )
	and !isset( $_REQUEST["default"] ) )
	$GLOBALS["config_vars"]["archivename"] = $GLOBALS["config_vars"]["general"]["virtual_host_to_archive"][$_SERVER["SERVER_NAME"]];

/*
	Check the input GET/POST according to the input_filter vars in inc.vars file.
*/
require("inc.fns.input_check.es.php");

// Make the db connection
$sql = new sqlconn();
$sql->setDebug($GLOBALS["config_vars"]["debug"][$GLOBALS["config_vars"]["thisrequest"]]);
$connection = $sql->doConnectServer(
		$GLOBALS["config_vars"]["connections"]["sqlserver"],
		$GLOBALS["config_vars"]["connections"]["sqluser_public"],
		$GLOBALS["config_vars"]["connections"]["sqlpass_public"]
		);
if (!$connection) 
	error($GLOBALS["config_vars"]["messages"]["message_noservice"] ,ERROR_EXIT);
$db = $sql->doConnectDb($GLOBALS["config_vars"]["connections"]["sqldatabase"]);
if (!$db) {
	error($GLOBALS["config_vars"]["messages"]["message_noservice"],ERROR_EXIT);
	loadPages("no_service_public");
	exitScript();
}
	
if (isset($_REQUEST["action"]) and isset($GLOBALS["config_vars"]["actions"]["includes"][$GLOBALS["config_vars"]["thisrequest"]][$GLOBALS["config_vars"]["archivename"]][$_REQUEST["action"]])){
	$switchpages = loadPages($_REQUEST["action"]);
	if ($switchpages)
		loadPages($switchpages);
} else {
	loadPages("pub_default");
}

// Uncomment to view debug output.
//print $debug->getDebug();
//print $sql->getDebug();

// Uncomment to write logs
$logger->writeLog();
?>