main flow
check IN_ECS
set error report all
extract ROOT_PATH
memory_limit | 64M |
---|---|
session.cache_expire | 180 |
session.use_trans_sid | 0 |
session.use_cookies | 1 |
session.auto_start | 0 |
display_errors | 1 |
include_path
include ecshop/data/config.php
define 'DEBUG_MODE', false => 0
if PHP_VERSION > '5.1' then set default timezone
regular '/' ($_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME']) to 'index.php'
include ecshop/includes/inc_constant.php
include ecshop/includes/cls_ecshop.php
include ecshop/includes/cls_error.php
include ecshop/includes/lib_time.php
include ecshop/includes/lib_base.php
include ecshop/includes/lib_common.php
include ecshop/includes/lib_main.php
include ecshop/includes/lib_insert.php
include ecshop/includes/lib_goods.php
include ecshop/includes/lib_article.php
对用户传入的变量进行转义操作
- $_GET, $_POST, $_COOKIE, $_REQUEST
创建 ECSHOP 对象
- new ECS($db_name, $prefix)
- define DATA_DIR
- define IMAGE_DIR
初始化数据库类
- include ecshop/includes/cls_mysql.php
- $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name)
- disable cache tables sessions, sessions_data, cart
创建错误处理对象
- $err = new ecs_error('message.dwt')
载入系统参数
- $_CFG = load_config();
载入语言文件
- include ecshop/languages/zh_cn/common.php
- include ecshop/languages/en_us/common.php
- include ecshop/languages/zh_tw/common.php
商店关闭控制 shop_closed
蜘蛛的访问判断 is_spider
- 默认为访客方式,并且不记录到日志中
整合UC后($_CFG['integrate_code'] == 'ucenter'),如果是蜘蛛访问
- 初始化UC需要的常量 $user = & init_users();
初始化Session,当 !defined('INIT_NO_USERS')
- include ecshop/includes/cls_session.php
- $sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'))
- define 'SESS_ID'
正规化PHP_SELF $_SERVER['PHP_SELF']=htmlspecialchars($_SERVER['PHP_SELF']);
初始化Smarty,当!defined('INIT_NO_SMARTY')
- include ecshop/includes/cls_template.php
- $smarty = new cls_template
当 DEBUG_MODE & 2
- 直接输出 $smarty->direct_output = true
- 强制编译 $smarty->force_compile = true
对smarty设定
- lang
- ecs_charset
- ecs_css_path = ecshop/template/style_<stylename>.css
- ecs_css_path = ecshop/template/style.css
初始化会员信息 当!defined('INIT_NO_USERS')
- $user =& init_users()
获取广告投放站点的名称,当!$_SESSION['user_id']
- 用户点击的广告ID $_GET['ad_id']
- 用户来源 $_GET['from']
- 统计来访 visit_stats() 当!defined('INGORE_VISIT_STATS')
empty($_SESSION['user_id']), 当 ! $user->get_cookie(),登陆失败
如果会员已经登录并且还没有获得会员的帐户余额、积分以及优惠券,当$_SESSION['user_id'] > 0
- update_user_info()
设置推荐会员,当$_GET['u']
- set_affiliate
session 不存在,检查cookie $_COOKIE['ECS']['user_id'], $_COOKIE['ECS']['password']
验证cookie信息 users, !!!存在安全隐患
- 设定 $_SESSION['user_id']
- 设定 $_SESSION['user_name']
- 更新 update_user_info()
设定'ecs_session' = $_SESSION
DEBUG_MODE
- DEBUG_MODE & 1 then E_ALL else E_ALL ^ E_NOTICE
- DEBUG_MODE & 4 then include ecshop/includes/lib.debug.php
判断是否支持 Gzip 模式 gzip_enabled()
- ob_start('ob_gzhandler')