<?php

	Class PHPSET
	{
		// Holds debugTesting status.
		// _______________________________________________________________________
		Const DEBUG_MODE =  true;
		Const LOCAL_MODE =  false;
		Const REPORT_ERROR_LEVEL = 100;
		
		// URLs : Holds the index.php's directory.
		// _______________________________________________________________________
		Public Static $ROOT = '';
		Public Static $SITE_URL = '';
		
		// SQL
		// _______________________________________________________________________
		Public Static $SQL_DATA_SOURCE = "";
		Public Static $SQL_DATABASE_NAME = "";
		Public Static $SQL_DATABASE_USER = "";
		Public Static $SQL_DATABASE_PASSWORD = "";
		
		// Request Parameter
		// _______________________________________________________________________
		Const SITE_ARRAY_REQUEST_LIMIT = 60; // Limit of $_GET / $_POST array per request.
		Public Static $SITE_REQUESTED_TIME = '';
		
		// Paging
		// _______________________________________________________________________
		Const SITE_SHOW_RESULT_PER_PAGE = 30;
		Const SITE_SHOW_RESULT_PER_PAGE_PLAIN_TEXT = 300;
		
		// Time Settings
		// _______________________________________________________________________
		Const SITE_TIME_ZONE = "Asia/Manila";
		Const SITE_TIME_ZONE_HOUR_DIFF = 8;
		Const SITE_TIME_ZONE_MIN_DIFF = 0;
		
		// Session Parameter
		// _______________________________________________________________________
		Public Static $SESSION_NAME = "peakcommissary_session";
		Const SESSION_EXPIRY = 60 * 60; // in minutes
		Const SESSION_NONCE_EXPIRY = 300; // in seconds
		Const SESSION_AGENT_DEPENDENT = True; // When agent does not match, destroy session.
		
		// Chikka Parameter
		// _______________________________________________________________________
		Const CHIKKA_DEFAULT_CHARGE = "P1.00";
		Const CHIKKA_ENABLED = false;
		
		// Encryption Parameter
		// _______________________________________________________________________
		Public Static $SQL_ENCRYPTION_KEY = "fyim19jrvxscgyfrcettozgeu89u795uqo976c0k";
		Public Static $PHP_ENCRYPTION_KEY = "snzSVbk1HsaHK/yOUOabpAmRf1GNmxlVdPrekHyZgrs=";
		Public Static $DEVICE_PUBLIC_KEY = "VKWGX-KUGFI-0TZ7H-ZSGUU-BEUKE-WSYPI-U";
		Public Static $DEVICE_PRIVATE_KEY = "WCJ7S-HDXMP-YSPD6-KJA5P-MIPVI-TVURE-T";
		
		// Mobile Auth
		// _______________________________________________________________________
		Public Static $MOBILE_USERNAME = '';
		Public Static $MOBILE_PASSWORD = '';
		Public Static $MOBILE_URL = '';
		Public Static $MOBILE_BALANCE = '';
		Public Static $MOBILE_OUTBOX = '';
		Public Static $MOBILE_BILLING = '';
		Public Static $MOBILE_COMPANY_NAME = '';
		Public Static $MOBILE_SHORTCODE = '';
		
		// SYSTEM_AUTHENTICATION
		// _______________________________________________________________________
		Public Static $SYSTEM_USERNAME = "system";
		Public Static $SYSTEM_PASSWORD = 'this feature is not';
		
		// FOR SYNC
		// _______________________________________________________________________
		Const SYNC_REQUEST_KEY = "47KTtKAQSoIO9ujDrEx8ASO6hpuZs0gfNncYGxjkRnnmniaBliSbRooYL1";
		
		/**
		 * Loads PHP settings (URLs, Time Setting, Authentication, etc.)
		 * @return null
		 */
		Public Static Function SET_LOAD($ROOT)
		{
			// Offline Mode
			// ...........................................
			if(self::LOCAL_MODE)
			{
				self::$SITE_URL = 'https://' . gethostbyname(gethostname()) . '/peakcommissary';
				self::$SQL_DATA_SOURCE = "localhost";
				self::$SQL_DATABASE_NAME = "peakcommissary";
				self::$SQL_DATABASE_USER = "root";
				self::$SQL_DATABASE_PASSWORD = "";
				
				self::$MOBILE_USERNAME = 'admin';
				self::$MOBILE_PASSWORD = 'Z_0123456';
				self::$MOBILE_URL = 'https://192.168.1.150/semaphore/Record/history/save';
				self::$MOBILE_BALANCE = 'https://192.168.1.150/semaphore/Record/balance/me';
				self::$MOBILE_OUTBOX = 'https://192.168.1.150/semaphore/Record/history/me';
				self::$MOBILE_BILLING = 'https://192.168.1.150/semaphore/Record/reload/me';
				self::$MOBILE_COMPANY_NAME = '';
				self::$MOBILE_SHORTCODE = 'DSASOFT';
			}
			
			// Online Mode : Change this code according to webhost config.
			// ...........................................
			else
			{
				self::$SITE_URL = 'https://prodwater.peakpos.com.ph';
				self::$SQL_DATA_SOURCE = "localhost";
				self::$SQL_DATABASE_NAME = "peakpos_prodwater";
				self::$SQL_DATABASE_USER = "peakpos_commissary";
				self::$SQL_DATABASE_PASSWORD = '<w5sSyEHdxEMXv$inMXT:7Ry8XPY~s;S';
				
				self::$MOBILE_USERNAME = '';
				self::$MOBILE_PASSWORD = '';
				self::$MOBILE_URL = 'https://sms.dsasoftware.com.ph/Record/history/save';
			    self::$MOBILE_BALANCE = 'https://sms.dsasoftware.com.ph/Record/balance/me';
				self::$MOBILE_OUTBOX = 'https://sms.dsasoftware.com.ph/Record/history/me';
				self::$MOBILE_BILLING = 'https://sms.dsasoftware.com.ph/Record/reload/me';
				self::$MOBILE_COMPANY_NAME = '';
				self::$MOBILE_SHORTCODE = '';
			}
			
			// Common Data
			// ...........................................
			self::$ROOT = $ROOT;
			self::$SESSION_NAME = PHPVC_STR::VAR_REPLACE(self::$SITE_URL, "/", "");
			self::$SESSION_NAME = PHPVC_STR::VAR_REPLACE(self::$SESSION_NAME, ":", "_");
			self::$SESSION_NAME = PHPVC_STR::VAR_REPLACE(self::$SESSION_NAME, ".", "_");
			
			date_default_timezone_set(PHPSET::SITE_TIME_ZONE);
			self::$SITE_REQUESTED_TIME = PHPVC_DATETIME::VAR_NOW();
		}
		
	}
?>