= '5.1' && !empty($timezone)) { date_default_timezone_set($timezone); } $php_self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; if ('/' == substr($php_self, -1)) { $php_self .= 'index.php'; } define('PHP_SELF', $php_self); require(ROOT_PATH . 'includes/inc_constant.php'); require(ROOT_PATH . 'includes/cls_ecshop.php'); require(ROOT_PATH . 'includes/cls_error.php'); require(ROOT_PATH . 'includes/lib_time.php'); require(ROOT_PATH . 'includes/lib_base.php'); require(ROOT_PATH . 'includes/lib_common.php'); require(ROOT_PATH . 'includes/lib_main.php'); require(ROOT_PATH . 'includes/lib_insert.php'); /* 將轉入參數都加上quote。*/ if (!get_magic_quotes_gpc()) { if (!empty($_GET)) { $_GET = addslashes_deep($_GET); } if (!empty($_POST)) { $_POST = addslashes_deep($_POST); } $_COOKIE = addslashes_deep($_COOKIE); $_REQUEST = addslashes_deep($_REQUEST); } /* 创建对象 */ $ecs = new ECS($db_name, $prefix); define('DATA_DIR', $ecs->data_dir()); define('IMAGE_DIR', $ecs->image_dir()); /* 初始化数据库类 */ require(ROOT_PATH . 'includes/cls_mysql.php'); $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name); $db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'))); $db_host = $db_user = $db_pass = $db_name = NULL; /* 创建错误处理对象 */ $err = new ecs_error('message.dwt'); /* 载入系统参数 */ $_CFG = load_config(); /* 载入语言文件 */ require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php'); require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user_log.php'); if ($_CFG['shop_closed'] == 1 && real_ip()<>'65.60.2.244') { header('Content-type: text/html; charset='.EC_CHARSET); die('

' . $_LANG['shop_closed'] . '

' . $_CFG['close_comment'] . '

'); } //if (is_spider()) //{ /* 如果是蜘蛛的访问,那么默认为访客方式,并且不记录到日志中 */ // if (!defined('INIT_NO_USERS')) // { // define('INIT_NO_USERS', true); /* 整合UC后,如果是蜘蛛访问,初始化UC需要的常量 */ // if($_CFG['integrate_code'] == 'ucenter') // { // $user = init_users(); // } // } // $_SESSION = array(); // $_SESSION['user_id'] = 0; // $_SESSION['user_name'] = ''; // $_SESSION['email'] = ''; // $_SESSION['user_rank'] = 0; // $_SESSION['discount'] = 1.00; //} if($_SERVER['HTTP_HOST']=='www.'.$_CFG['cf_domain']){ $site_id=1; $site_type='portal'; }else{ $sql = 'SELECT id ' . ' FROM ' .$ecs->table('portal') . " WHERE domain = '" . $_SERVER['HTTP_HOST'] . "'"; $site_id = $db->getOne($sql); if($site_id){ $site_type="portal"; }else{ $sql = 'SELECT a.hs_id ' . ' FROM ' .$ecs->table('hs_web') . " a, ".$ecs->table('users') . " b " . " WHERE a.hs_id=b.user_id and b.status=0 and a.domain = '" . $_SERVER['HTTP_HOST'] . "'"; $site_id = $db->getOne($sql); if($site_id){ $site_type="web"; }else{ exit; } } } if (!defined('INIT_NO_USERS')) { /* 初始化session */ include(ROOT_PATH . 'includes/cls_session.php'); $sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data')); define('SESS_ID', $sess->get_session_id()); } if(isset($_SERVER['PHP_SELF'])) { $_SERVER['PHP_SELF']=htmlspecialchars($_SERVER['PHP_SELF']); } if (!defined('INIT_NO_SMARTY')) { header('Cache-control: private'); header('Content-type: text/html; charset='.EC_CHARSET); /* 创建 Smarty 对象。*/ require(ROOT_PATH . 'includes/cls_template.php'); $smarty = new cls_template; $smarty->cache_lifetime = $_CFG['cache_time']; $smarty->template_dir = ROOT_PATH . 'themes/' . $_CFG['template'].'/'.$site_type; $smarty->cache_dir = ROOT_PATH . 'temp/caches'; $smarty->compile_dir = ROOT_PATH . 'temp/compiled'; $smarty->site_type =$site_type; if ((DEBUG_MODE & 2) == 2) { $smarty->direct_output = true; $smarty->force_compile = true; } else { $smarty->direct_output = false; $smarty->force_compile = false; } $smarty->assign('lang', $_LANG); $smarty->assign('ecs_charset', EC_CHARSET); $smarty->assign('tpl', 'themes/'.$GLOBALS['_CFG']['template'].'/'.$site_type.'/'); if (!empty($_CFG['stylename'])) { $smarty->assign('ecs_css_path', 'themes/' . $_CFG['template'] .'/'.$site_type. '/style_' . $_CFG['stylename'] . '.css'); } else { $smarty->assign('ecs_css_path', 'themes/' . $_CFG['template'] .'/'.$site_type .'/style.css'); } $smarty->assign('_CFG', $_CFG); } if ((DEBUG_MODE & 1) == 1) { error_reporting(E_ALL); } else { error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); } if ((DEBUG_MODE & 4) == 4) { include(ROOT_PATH . 'includes/lib.debug.php'); } /* 判断是否支持 Gzip 模式 */ if (!defined('INIT_NO_SMARTY') && gzip_enabled()) { ob_start('ob_gzhandler'); } else { ob_start(); } ?>