AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.128.168.219


Current Path : /var/www/lhjmq-records.qc.ca/public_html/includes/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/includes/appsettings.php

<?php

if(!defined("CLS_APPSETTINGS")) {	
	define("CLS_APPSETTINGS","");


	class CAppSettings
	{ 
		var $APP_VERSION;

		var $SERVER_ROLE_PUBLIC;

		var $SERVER_ROLE_ADMIN;

		var $ONLINE_SERVER_MASTER_ADMIN_ADDRESS;

		var $ONLINE_SERVER_ADDRESSES;

		var $DEVELOPMENT_SERVER_MASTER_ADMIN_ADDRESS;

		var $DEVELOPMENT_WORKSTATION_REMOTE_ADDRESSES;

		var $server_system_name;

		var $server_role;

		var $running_on_development_server;

		var $accessing_from_development_workstation;

		var $appLogger;

		var $use_stats_cache;

		var $use_player_listing_patch;
		var $player_listing_patch_max_years_in_league;

		// constructor
		function CAppSettings() 
		{ 
			$this->APP_VERSION = '2.0';

			$this->SERVER_ROLE_PUBLIC = "public";

			$this->SERVER_ROLE_ADMIN = "admin";

// simon 20140129
/*
			if (FALSE === ($uname = posix_uname())) {
				//echo "Could not get system information.<br>";
				$this->server_system_name = "***unknown***";
			} else {			
				//print_r($uname);
				//echo "System Name: " . $uname["nodename"]."<br>";
				$this->server_system_name = $uname["nodename"];
			}
*/

// simon 20140129
			$this->ONLINE_SERVER_MASTER_ADMIN_ADDRESS = '10.11.62.110';

			$this->ONLINE_SERVER_ADDRESSES = array(
				'10.11.62.110',
				'10.11.62.111',
				'209.104.115.222',
				'174.142.22.198',
			);

			$this->DEVELOPMENT_SERVER_MASTER_ADMIN_ADDRESS = '209.104.115.216';

			$this->running_on_development_server = TRUE;

			if(in_array($_SERVER['SERVER_ADDR'], $this->ONLINE_SERVER_ADDRESSES) == true) { 
				$this->running_on_development_server = FALSE;
			}

			$this->DEVELOPMENT_WORKSTATION_REMOTE_ADDRESSES = array(
				'207.96.185.210',	// Sajy's office routers
				'207.96.185.222',
				'204.19.191.2',
				'209.104.115.2',
				'69.70.6.130',
				'10.0.0.150',		// ES Work
				'10.0.1.2',			// ES Home
				'10.0.1.10',		// ES Home
				'67.71.35.220',	// ES Home	(ext. IP)	
			);

			$this->accessing_from_development_workstation = FALSE;

			if(in_array($_SERVER['REMOTE_ADDR'], $this->DEVELOPMENT_WORKSTATION_REMOTE_ADDRESSES) == true) { 
				$this->accessing_from_development_workstation = TRUE;
			}

			$this->server_role = $this->SERVER_ROLE_PUBLIC;

			if (file_exists('/home/lhjmq/IDENT_ADMIN')) {

				if ($appSettings->running_on_development_server){
					if($_SERVER['SERVER_ADDR'] != $this->DEVELOPMENT_SERVER_MASTER_ADMIN_ADDRESS){
						$this->server_role = $this->SERVER_ROLE_ADMIN;
					}
				} else {
					if($_SERVER['SERVER_ADDR'] != $this->ONLINE_SERVER_MASTER_ADMIN_ADDRESS){
						$this->server_role = $this->SERVER_ROLE_ADMIN;
					}
				}				
			}

			$this->appLogger = new CAppLogger();
			$this->appLogger->logging = FALSE;

			if ($this->accessing_from_development_workstation)
			{
				$this->appLogger->logging = TRUE;
			}

			$this->use_stats_cache = TRUE;

			if ($this->running_on_development_server ) {
				$this->use_stats_cache = FALSE;
			}

			$this->use_player_listing_patch = TRUE;
			$this->player_listing_patch_max_years_in_league = 5;

			if (!$this->use_player_listing_patch) {
				$this->player_listing_patch_max_years_in_league = 1000; // just in case!
			}		
		} 

		function dump()
		{
			$s = 'APP SETTINGS' . "\n"; 			
			$s .= '$appSettings->server_system_name = [' . $this->server_system_name . ']' . "\n"; 
			$s .= '$appSettings->running_on_development_server = [' . $this->running_on_development_server . ']' . "\n"; 
			$s .= '$appSettings->accessing_from_development_workstation = [' . $this->accessing_from_development_workstation . ']' . "\n"; 
			$s .= '$appSettings->server_system_name = [' . $this->server_system_name . ']' . "\n"; 
			$s .= '$appSettings->server_role = [' . $this->server_role . ']' . "\n";
			$s .= '$appSettings->ONLINE_SERVER_MASTER_ADMIN_ADDRESS = [' . $this->ONLINE_SERVER_MASTER_ADMIN_ADDRESS . ']' . "\n";
			if ($this->running_on_development_server){
				$s .= '$appSettings->DEVELOPMENT_SERVER_MASTER_ADMIN_ADDRESS = [' . $this->DEVELOPMENT_SERVER_MASTER_ADMIN_ADDRESS . ']' . "\n";
			}

			return $s;
		}

	/*
		// usage
		if(isset($appSettings)) {
			$appSettings->logInfo( 'team_get_data(' . $id_equipe . ', \'' . $ondate . '\') [' . $sql . ']');
		}
	*/
		function logInfo($msg)
		{
			if ($msg == '~APPSETTINGS') {
				$this->appLogger->info($this->dump());
			} else {
				$this->appLogger->info($msg);
			}
		}
	} 
}

if(!isset($appSettings)) {
	$appSettings = new CAppSettings();
}

// simon 20140129
// register globals for PHP >= 5.4
extract($_GET);



?>