<?php

	/*
		Configuration for ePrintstats project.
		The serialized vars in user.serialized.es.cfg are read after this
		so may override any values. This is done to allow settings to be 
		changed via the web admin interface. 

		Note that many of the variables are actually not used as eprintstats uses
		code from another project.
	*/

	// These are available globally by default.
	// Not all are relevant as code was copied from another project.
	define("ERROR_EXIT", 1); 
	define("ERROR_CONTINUE", 0); 
	define("GET_POST_PROCESS_INVALID", TRUE);
	define("UNSET_REQUEST", 1);
	define("UNSET_KEY", 2);
	define("UNSET_CONTINUE", 3);
	define("UNSET_ACTION", 4);
	define("UNSET_REPLACE", 5);
	define("NOT_EMPTY", 1);
	
	// These are loaded to $GLOBALS and are available throughout the program without using "global"
	$GLOBALS["config_vars"] = array(
		"debug" => array(
			"vTITLE" => "Debug output",
			"vDESCRIPTION" => "TRUE or FALSE selected for public or private",
			/* the initial page needs to be able to identify if public (no auth) or private (auth) */
			"public" => 1
		),
		"connections" => array(
			"vTITLE" => "SQL server settings",
			"vDESCRIPTION" => "Specify the server name, database name, and user accounts to use.",
			"sqlserver" => "localhost",
			"sqldatabase" => "eprintstats",
			"sqluser_public" => "eprintstatspub",
			"sqlpass_public" => "AuldGrizzel",
			// NJS 2006-06-14: Generalised the connection list to support
			// multiple EPrints archives. Also added the natural-language
			// archive name for easy reference.
			"eprints_archives" => array(
				"otago_eprints" => array(
					"sqlserver_eprints" => "localhost",
					"sqluser_eprints" => "otago_eprints",
					"sqlpass_eprints" => "DrSyntaxRidesAgain",
				),
				"cardrona" => array(
					"sqlserver_eprints" => "localhost",
					"sqluser_eprints" => "cardrona",
					"sqlpass_eprints" => "chautquau",
				),
			),
		),
		"filelocation" => array(
			"vTITLE" => "File locations",
			"vDESCRIPTION" => "Install directory and location of required files.",
			"base_install_dir" => array(
				"unix" => "##EPRINTSSTATS##",
				"windows" => "C:/ePrintsStats",
			),
			"base_log_dir" => "logs",
			"base_includes_dir" => "includes",
			"base_session_dir" => "session",
			"base_config_dir" => "config",
		),
		"input_filter" => array(
			"vTITLE" => "Input filtering.",
			"vDESCRIPTION" => "Input checking for GET POST",
			/* List of allowed key/value pairs and COOKIES Values either explicit or a function */
			/* Escaping of strings destined for sql are dealt with by the sql object. */
			/* Excludes the action array which is explicitly named below. */
			/* How to deal with sets of parameters. Define arrays of them? */
			"keys" => array(
				"public" => array(
					"action" => array(
						"maxlength" => "25",
						"type" => "string",
						"action" => UNSET_REQUEST,
						"pattern" => "/[^\w]/i",
						"values" => array(
							'show_detail_date',
							'show_detail_country',
							'show_detail_eprint',
							'cumulative_usage',
							'cumulative_usage_country',
							'cumulative_usage_map',
						),
					),
					"year" => array(
						"maxlength" => "50",
						"type" => "freetext",
						"action" => UNSET_REPLACE,
						"pattern" => "/[%;#--<>\(\)]/i",
						"replacement" => "",
						"content" => NOT_EMPTY,
					),
					"month" => array(
						"maxlength" => "50",
						"type" => "freetext",
						"action" => UNSET_REPLACE,
						"pattern" => "/[%;#--<>\(\)]/i",
						"replacement" => "",
						"content" => NOT_EMPTY,
					),
					"range" => array(
						"maxlength" => "20",
						"type" => "string",
						"action" => UNSET_REQUEST,
						"pattern" => "/[^\w]/i",
						"values" => array('4w','all',''),
					),
					"code" => array(
						"maxlength" => "4",
						"type" => "string",
						"action" => UNSET_REQUEST,
						"pattern" => "/[^@\w]/i",
					),
					/* maxlength here refers to largest integer */
					"id" => array(
						"maxlength" => "1005",
						"type" => "integer",
						"action" => UNSET_REQUEST,
					),
				),
			),
		),
		"general" => array(
			"vTITLE" => "General progam details",
			"vDESCRIPTION" => "Admin name and contact, prog title",
			"admin_name" => "ePrints Administrator",
			"admin_email" => "##EPRINTS_ADMIN_EMAIL##",
			"support_name" => "ePrints Administrator",
			"support_email" => "##EPRINTS_ADMIN_EMAIL##",
			"prog_title" => "ePrints Statistics",
			"prog_title_public" => "ePrints Statistics",
			"short_prog_title" => "es",
			"public_prog" => "index.php",
			"public_prog_request_uri" => "/index.php",
			// NJS 2007-07-24: Added EPrints version setting, as the
			// repository database structure changed between version
			// 2.x and 3.x. Use the major version number only.
			"eprints_version" => 3,
			// NJS 2006-06-15: Made location URL a list and added list of
			// full repository names.
			"eprints_location" => array(
				"default" => "http://##EPRINTS_HOST####EPRINTS_PORT##",
				"otago_eprints" => "http://##EPRINTS_HOST####EPRINTS_PORT##",
				"cardrona" => "http://cardrona.eprints.otago.ac.nz",
			),
			"repository_name" => array(
				"default" => "EPrints Repositories @ Otago",
				"otago_eprints" => "Otago Eprints Repository",
				"cardrona" => "Cardrona Community Repository",
			),
			// NJS 2006-06-16: Added reverse lookup list of server names.
			"virtual_host_to_archive" => array(
				"##EPRINTS_HOST##" => "otago_eprints",
				"cardrona.eprints.otago.ac.nz" => "cardrona",
			),
			/* replaced admin_prog */
			"prog_address" => array(
				"public" => "index.php",
			),
		),
		/* NJS 2005-12-16
			Local network setup. Must correspond to the $local_IPs
			variable in eprints-usage.php.
		*/
		"local_networks" => array(
			"XA" => "Repository Admin",
			"XI" => "Otago Intranet",
		),
		/* NJS 2007-01-31
		   List of known search engines. Must correspond to the
		   $bot_patterns variable in eprints-usage.php.
		*/
		"search_engines" => array(
			"X@GG" => "Google",
			"X@YH" => "Yahoo!",
			"X@MS" => "Windows Live Search",
			"X@AC" => "Ask.com",
			"X@OS" => "Other search engine",
		),
		"messages" => array(
			"vTITLE" => "Messages",
			"vDESCRIPTION" => "Error messages.",
			"message_noservice" => "This service is currently unavailable.",
			"message_missing_include" => "Missing include file.",
		),
		"actions" => array(
			"vTITLE" => "Form actions",
			"vDESCRIPTION" => "Which files are included for get/post actions. i.e the pub_default action will include the files listed in the array",
			"includes" => array(
				'public' => array(
					// NJS 2006-06-14
					'default' => array(
						'pub_default' => array ('inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.pub_default.es.php','inc.html.footer.es.php'),
						'no_service_public' => array ('inc.html.header.es.php','inc.html.no_service_public.es.php','inc.html.footer.es.php'),
						'cumulative_usage' => array ('inc.fns.cumulative_usage.es.php','inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage.es.php','inc.html.footer.es.php'),
						'cumulative_usage_country' => array ('inc.fns.cumulative_usage_country.es.php','inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage_country.es.php','inc.html.footer.es.php'),
						'show_detail_date' => array ('inc.fns.show_detail_date.es.php','inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_date.es.php','inc.html.footer.es.php'),
						'show_detail_country' => array ('inc.fns.show_detail_country.es.php','inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_country.es.php','inc.html.footer.es.php'),
						'show_detail_eprint' => array ('inc.fns.show_detail_eprint.es.php','inc.html.header.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_eprint.es.php','inc.html.footer.es.php'),
					),
					'otago_eprints' => array(
						'pub_default' => array ('inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.pub_default.es.php','inc.html.footer.otago_eprints.es.php'),
						'no_service_public' => array ('inc.html.header.otago_eprints.es.php','inc.html.no_service_public.es.php','inc.html.footer.otago_eprints.es.php'),
						'cumulative_usage' => array ('inc.fns.cumulative_usage.es.php','inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage.es.php','inc.html.footer.otago_eprints.es.php'),
						'cumulative_usage_country' => array ('inc.fns.cumulative_usage_country.es.php','inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage_country.es.php','inc.html.footer.otago_eprints.es.php'),
						'show_detail_date' => array ('inc.fns.show_detail_date.es.php','inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_date.es.php','inc.html.footer.otago_eprints.es.php'),
						'show_detail_country' => array ('inc.fns.show_detail_country.es.php','inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_country.es.php','inc.html.footer.otago_eprints.es.php'),
						'show_detail_eprint' => array ('inc.fns.show_detail_eprint.es.php','inc.html.header.otago_eprints.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_eprint.es.php','inc.html.footer.otago_eprints.es.php'),
					),
					'cardrona' => array(
						'pub_default' => array ('inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.pub_default.es.php','inc.html.footer.cardrona.es.php'),
						'no_service_public' => array ('inc.html.header.cardrona.es.php','inc.html.no_service_public.es.php','inc.html.footer.cardrona.es.php'),
						'cumulative_usage' => array ('inc.fns.cumulative_usage.es.php','inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage.es.php','inc.html.footer.cardrona.es.php'),
						'cumulative_usage_country' => array ('inc.fns.cumulative_usage_country.es.php','inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.cumulative_usage_country.es.php','inc.html.footer.cardrona.es.php'),
						'show_detail_date' => array ('inc.fns.show_detail_date.es.php','inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_date.es.php','inc.html.footer.cardrona.es.php'),
						'show_detail_country' => array ('inc.fns.show_detail_country.es.php','inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_country.es.php','inc.html.footer.cardrona.es.php'),
						'show_detail_eprint' => array ('inc.fns.show_detail_eprint.es.php','inc.html.header.cardrona.es.php','inc.fns.navbar.es.php','inc.html.navbar_global.es.php','inc.html.show_detail_eprint.es.php','inc.html.footer.cardrona.es.php'),
					),
				),
			),
		),
	);

