<?php
if(!defined('SOFTPUBS_IN')){
    die('Hacking attempt');
}
@ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
//time zone
	if(function_exists('date_default_timezone_set')) {
	  date_default_timezone_set('Asia/Shanghai');
	}	

//version
	$glo_site_version	=	'1.0 Beta';
	$glo_lang			=	'zh_cn_UTF-8';

$glo_domain_name	 		=		'http://'.$_SERVER['SERVER_NAME'];
$glo_domain_directory	=		preg_replace('|install\/[^\/]*$|si','',$_SERVER['REQUEST_URI']);


//clear file cache
clearstatcache();

//root path
define('ROOT_PATH', str_replace('install/includes/init.php', '', str_replace('\\', '/', __FILE__)));
define('DATA_DIR', ROOT_PATH . 'data/');
define('SIT_CHARSET','utf-8');
define('SIT_DB_CHARSET','utf8');
define('SMARTY_DIR', ROOT_PATH . '/lib/Smarty/');
define('TEMPLATE_DIR',ROOT_PATH.'install/tpl_'.$glo_lang);
define('TEMPLATE_C_DIR',ROOT_PATH.'install/compiler_tpl');

define('TEMPLATE_COMPILATION_DIR',ROOT_PATH.'/tpls/');
define('TEMPLATE_COMPILATION_URL',$glo_domain_directory.'tpls/');
define('TEMPLATE_COMPILATION_C_DIR',ROOT_PATH.'/compiler_tpl');

define('UPLOAD_DIR', ROOT_PATH . 'upload/');
define('ADMIN_TEMPLATE_C_DIR', ROOT_PATH . 'admin/compiler_tpl/');

//is install?
if (file_exists(ROOT_PATH . 'data/install.lock')){
	header("Location: ".$glo_domain_directory."\n");
	exit;
}



header('Content-type: text/html; charset='.SIT_CHARSET);

if(!empty($_GET)){
    $_GET   =    array_map('stripslashes_deep',$_GET);
}
if(!empty($_COOKIE)){
    $_COOKIE   =    array_map('stripslashes_deep',$_COOKIE);
}
if(!empty($_POST)){
    $_POST   =    array_map('stripslashes_deep',$_POST);
}	
function  stripslashes_deep($value)
{
    if(empty($value)){
       return $value;
    }else{
       if(is_array($value)){
			 return array_map('stripslashes_deep', $value);
		 }else{
			 if(get_magic_quotes_gpc()){
				$value	=	stripslashes($value);	
			 }
			 return trim($value);
   	} 
	}
}

@set_time_limit(360);



$check_file_arr	=	array(
	DATA_DIR,
	UPLOAD_DIR,
	TEMPLATE_COMPILATION_C_DIR,
	ADMIN_TEMPLATE_C_DIR,
);




require_once(ROOT_PATH.'includes/function.php');

