<?php /**************************************************************************************************

* File 			: For Configuration Setting *********************************************************************************/
//error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
error_reporting(E_ALL);
if ($_SERVER['HTTP_HOST'] == "localhost") {
    define('LOCAL_MODE', true);
} else {
 	define('LOCAL_MODE', false);
}

// File system path
$tmp = dirname(__FILE__);
$tmp = str_replace('\\' ,'/',$tmp);
$tmp = substr($tmp, 0, strrpos($tmp, '/'));
define('SITE_FS_PATH', $tmp); 

// include all the library files needed here
require_once(SITE_FS_PATH."/includes/config.inc.php");
require_once(SITE_FS_PATH."/includes/funcs_lib.inc.php");
require_once(SITE_FS_PATH."/includes/funcs_cur.inc.php");
require_once(SITE_FS_PATH."/includes/arrays.inc.php");
//require_once(SITE_FS_PATH."/includes/crypt.php");
/*if(strtolower($_SERVER['HTTPS'])=='on') 
{
	define('IN_SSL', true);
	define('HTTP_OR_HTTPS_PATH', SITE_SSL_PATH);
} 
else 
{
	define('IN_SSL', false);
	define('HTTP_OR_HTTPS_PATH', SITE_WS_PATH);
}
*/
//session_start();

// Script start time used to test site performance
// Script start time used to test site performance
define('SCRIPT_START_TIME', getmicrotime());
//echo("<br>SCRIPT_START_TIME: ".SCRIPT_START_TIME);

// magic_quotes_gpc needs to be "on"
/*if(get_magic_quotes_gpc()==0) {
	$_GET		= ms_addslashes($_GET);
	$_POST		= ms_addslashes($_POST);
	$_COOKIE	= ms_addslashes($_COOKIE);
	@extract($_GET);
	@extract($_POST);
} else {
	$_GET		= ms_trim($_GET);
	$_POST		= ms_trim($_POST);
	$_COOKIE	= ms_trim($_COOKIE);
	import_request_variables('gp');
}

// magic_quotes_runtime needs to be "off"
if(get_magic_quotes_runtime()) {
	set_magic_quotes_runtime(0);
}
*/
if ($handle = opendir(SITE_FS_PATH.'/'.PLUGINS_DIR)) { 
   while (false !== ($file = readdir($handle))) { 
       if ($file != "." && $file != "..") { 
		   $curr_dir = SITE_FS_PATH.'/'.PLUGINS_DIR.'/'.$file;
           if(is_dir($curr_dir)) {
			   if(file_exists($curr_dir.'/plugin.php')) {
				   require_once($curr_dir.'/plugin.php');
			   }
		   }
       } 
   } 
   closedir($handle); 
} 
// Protect admin pages

define('MYSQL_DATE',date('Y-m-d'));
define('MYSQL_DATE_TIME',date('Y-m-d H:i:s'));

$admin_email	=	searchSingleRecord("tbl_config","config_value","config_id",1);
define('ADMIN_EMAIL', $admin_email);

$PHP_SELF = $_SERVER['PHP_SELF'];
$cur_page = basename($_SERVER['PHP_SELF']);
$admin_pos  = strpos($PHP_SELF, '/'.ADMIN_DIR.'/');

if($admin_pos!== false) {
	// Remove following comment to enable admin login check
	$adm_mysql_date=date('Y-m-d');
	$adm_mysql_date_time=date('Y-m-d H:i:s');	
	if(!strstr($PHP_SELF,PLUGINS_DIR)){
		protect_admin_page();
	}
}
elseif(!empty($page_array) && in_array($cur_page,$page_array)){
	//$ses_id	=	session_id();
	// Validate user to go in inner page without login
	//validate_user();
}
?>