<?php
/*
[Destoon B2B System] Copyright (c) 2008-2016 www.destoon.com
This is NOT a freeware, use is subject to license.txt
*/
define('DT_MOBILE', true);
//加载根目录下的common.inc.php
require substr(str_replace("\\", '/', dirname(__FILE__)), 0, -7).'/common.inc.php';
//加载mobel的公共函数库
require DT_ROOT.'/mobile/include/global.func.php';
if(is_pc()) dheader($EXT['mobile_url'].'mobile.php?action=device');//如果是电脑就去显示"用电脑体验更好"
if(DT_CHARSET != 'UTF-8') header("Content-type:text/html; charset=utf-8");
include load('mobile.lang');//语言包
$EXT['mobile_enable'] or mobile_msg($L['msg_mobile_close']);//如果手机站点关闭就提示站点关闭
if($DT_BOT) $EXT['mobile_ajax'] = 0;//如果是机器人就不让ajax?
//设置设备的环境cookie
$_mobile = get_cookie('mobile');
if($_mobile == '' || $_mobile == 'pc') {
set_cookie('mobile', 'touch', $DT_TIME + 30*86400);
}
$UA = strtoupper($_SERVER['HTTP_USER_AGENT']);//获取环境浏览器标识
$back_link = $head_link = $head_name = '';
//手机上的模块??
$mobile_modules = array('member', 'sell', 'buy', 'quote', 'company', 'exhibit', 'article', 'info', 'job', 'know', 'brand', 'mall', 'group', 'video', 'photo', 'club');
$pages = '';
$areaid = isset($areaid) ? intval($areaid) : 0;
$site_name = $head_title = $EXT['mobile_sitename'] ? $EXT['mobile_sitename'] : $DT['sitename'].$L['mobile_version'];
$kw = $kw ? strip_kw(decrypt($_GET['kw'], DT_KEY.'KW'), $DT['max_kw']) : '';
if(strlen($kw) < $DT['min_kw'] || strlen($kw) > $DT['max_kw']) $kw = '';
$keyword = $kw ? str_replace(array(' ', '*'), array('%', '%'), $kw) : '';
$MURL = $MODULE[2]['linkurl'];
if($DT_MOB['browser'] == 'screen' && $_username) $MURL = 'mobile.php?action=sync&auth='.encrypt($_username.'|'.$DT_IP.'|'.$DT_TIME, DT_KEY.'SCREEN').'&goto=';
$_cart = (isset($MODULE[16]) && $_userid) ? intval(get_cookie('cart')) : 0;
//分享图标
$share_icon = ($DT_MOB['browser'] == 'weixin' || $DT_MOB['browser'] == 'qq') ? DT_PATH.'apple-touch-icon-precomposed.png' : '';
$MOB_MODULE = array();
//$MODULE是所有的功能模块列表,这里是根据后台配置来获取开通的模块。正好解决上面的模块列表写死的问题
foreach($MODULE as $v) {
if(in_array($v['module'], $mobile_modules) && $v['module'] != 'member' && $v['ismenu']) $MOB_MODULE[] = $v;
}
$foot = 'channel';//这是啥?
?>
destoon源码解读lesson2—mobile/common.inc.php(手机端公共配置文件)
最新推荐文章于 2024-04-07 10:48:44 发布