Newer
Older
Digital_Repository / Repositories / statistics / htdocs / index.php
  1. <?php
  2.  
  3. /**
  4. * Project: EprintsStats. Stats of ePrints usage.
  5. * File: index.php
  6. * Project Owner: Information Division : Telars : Web Publishing
  7. */
  8.  
  9. /* Modified by Arthur Sale, University of Tasmania, 2004. */
  10.  
  11. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  12. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  13. header("Cache-Control: no-store, no-cache, must-revalidate");
  14. header("Cache-Control: post-check=0, pre-check=0", false);
  15. header("Pragma: no-cache");
  16.  
  17. $platform = "unix";
  18. $meta_keywords = "";
  19.  
  20. // Load configuration vars into $GLOBALS - Available as $GLOBALS["config_vars"]
  21. // open_basedir safe_mode_gid include_path are set in apache apache.conf vhost section
  22. require("inc.vars.es.php");
  23. require("inc.fns.es.php");
  24. require("inc.class.mysql.es.php");
  25. require("inc.class.input_check.es.php");
  26. require("inc.class.logger.es.php");
  27. require("inc.class.show_debug.es.php");
  28. require("inc.fns.merge.es.php");
  29. $debug = new ShowDebug();
  30.  
  31. $file_log = $GLOBALS["config_vars"]["filelocation"]["base_install_dir"][$platform] . "/" .
  32. $GLOBALS["config_vars"]["filelocation"]["base_log_dir"] . "/" ."general.es.log";
  33. $logger = new Logger($file_log);
  34.  
  35. /*
  36. Are we public or private. This alters which files get included.
  37. We try to keep the public included files separate.
  38. */
  39. $GLOBALS["config_vars"]["thisrequest"] = 'public';
  40. // NJS 2006-06-16
  41. // Use the default site unless the virtual host mapping specifies
  42. // otherwise. If the request variable "default" is set, use the default
  43. // site regardless.
  44. $GLOBALS["config_vars"]["archivename"] = 'default';
  45. if ( isset( $_SERVER["SERVER_NAME"] )
  46. and isset( $GLOBALS["config_vars"]["general"]["virtual_host_to_archive"][$_SERVER["SERVER_NAME"]] )
  47. and !isset( $_REQUEST["default"] ) )
  48. $GLOBALS["config_vars"]["archivename"] = $GLOBALS["config_vars"]["general"]["virtual_host_to_archive"][$_SERVER["SERVER_NAME"]];
  49.  
  50. /*
  51. Check the input GET/POST according to the input_filter vars in inc.vars file.
  52. */
  53. require("inc.fns.input_check.es.php");
  54.  
  55. // Make the db connection
  56. $sql = new sqlconn();
  57. $sql->setDebug($GLOBALS["config_vars"]["debug"][$GLOBALS["config_vars"]["thisrequest"]]);
  58. $connection = $sql->doConnectServer(
  59. $GLOBALS["config_vars"]["connections"]["sqlserver"],
  60. $GLOBALS["config_vars"]["connections"]["sqluser_public"],
  61. $GLOBALS["config_vars"]["connections"]["sqlpass_public"]
  62. );
  63. if (!$connection)
  64. error($GLOBALS["config_vars"]["messages"]["message_noservice"] ,ERROR_EXIT);
  65. $db = $sql->doConnectDb($GLOBALS["config_vars"]["connections"]["sqldatabase"]);
  66. if (!$db) {
  67. error($GLOBALS["config_vars"]["messages"]["message_noservice"],ERROR_EXIT);
  68. loadPages("no_service_public");
  69. exitScript();
  70. }
  71. if (isset($_REQUEST["action"]) and isset($GLOBALS["config_vars"]["actions"]["includes"][$GLOBALS["config_vars"]["thisrequest"]][$GLOBALS["config_vars"]["archivename"]][$_REQUEST["action"]])){
  72. $switchpages = loadPages($_REQUEST["action"]);
  73. if ($switchpages)
  74. loadPages($switchpages);
  75. } else {
  76. loadPages("pub_default");
  77. }
  78.  
  79. // Uncomment to view debug output.
  80. //print $debug->getDebug();
  81. //print $sql->getDebug();
  82.  
  83. // Uncomment to write logs
  84. $logger->writeLog();
  85. ?>