public function __construct() { $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['fcache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['fcache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出在线客服与时间 $qq = explode("|", app_conf("ONLINE_QQ")); $msn = explode("|", app_conf("ONLINE_MSN")); $GLOBALS['tmpl']->assign("online_qq", $qq); $GLOBALS['tmpl']->assign("online_msn", $msn); //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("shop_info", get_shop_info()); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出热门关键词 $hot_kw = get_hot_kw(); $GLOBALS['tmpl']->assign("hot_kw", $hot_kw); if (MODULE_NAME == "deal" && ACTION_NAME == "index" || MODULE_NAME == "deals" && ACTION_NAME == "index" || MODULE_NAME == "dhapi" && ACTION_NAME == "index" || MODULE_NAME == "index" && ACTION_NAME == "index" || MODULE_NAME == "message" && ACTION_NAME == "index" || MODULE_NAME == "order" && ACTION_NAME == "index" || MODULE_NAME == "search" && ACTION_NAME == "index" || MODULE_NAME == "second" && ACTION_NAME == "index") { set_gopreview(); } }
public function __construct() { if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] == "ES_FILE") { logger::write($GLOBALS['distribution_cfg']['OSS_DOMAIN'] . "/es_file.php"); global $syn_image_ci; global $curl_param; //global $syn_image_idx; $syn_image_idx = 0; $syn_image_ci = curl_init($GLOBALS['distribution_cfg']['OSS_DOMAIN'] . "/es_file.php"); curl_setopt($syn_image_ci, CURLOPT_RETURNTRANSFER, true); curl_setopt($syn_image_ci, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($syn_image_ci, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($syn_image_ci, CURLOPT_NOPROGRESS, true); curl_setopt($syn_image_ci, CURLOPT_HEADER, false); curl_setopt($syn_image_ci, CURLOPT_POST, TRUE); curl_setopt($syn_image_ci, CURLOPT_TIMEOUT, 1); curl_setopt($syn_image_ci, CURLOPT_TIMECONDITION, 1); $curl_param['username'] = $GLOBALS['distribution_cfg']['OSS_ACCESS_ID']; $curl_param['password'] = $GLOBALS['distribution_cfg']['OSS_ACCESS_KEY']; $curl_param['act'] = 2; } $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['cache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['cache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); foreach ($nav_list as $k => $v) { $nav_list[$k]['sub_nav'] = init_nav_list($v['sub_nav']); } $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出在线客服与时间 if (app_conf("ONLINE_QQ") != "") { $qq = unserialize(app_conf("ONLINE_QQ")); $GLOBALS['tmpl']->assign("online_qq", $qq); } //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("site_info", get_site_info()); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); if (MODULE_NAME == "acate" && ACTION_NAME == "index" || MODULE_NAME == "article" && ACTION_NAME == "index" || MODULE_NAME == "cate" && ACTION_NAME == "index" || MODULE_NAME == "comment" && ACTION_NAME == "index" || MODULE_NAME == "help" && ACTION_NAME == "index" || MODULE_NAME == "link" && ACTION_NAME == "index" || MODULE_NAME == "mobile" && ACTION_NAME == "index" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "list_notice" || MODULE_NAME == "rec" && ACTION_NAME == "rhot" || MODULE_NAME == "rec" && ACTION_NAME == "rnew" || MODULE_NAME == "rec" && ACTION_NAME == "rbest" || MODULE_NAME == "rec" && ACTION_NAME == "rsale" || MODULE_NAME == "score" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "fav" || MODULE_NAME == "space" && ACTION_NAME == "fans" || MODULE_NAME == "space" && ACTION_NAME == "focus" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "pick" || MODULE_NAME == "sys" && ACTION_NAME == "index" || MODULE_NAME == "sys" && ACTION_NAME == "list_notice" || MODULE_NAME == "vote" && ACTION_NAME == "index") { set_gopreview(); } }
public function __construct() { $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['fcache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['fcache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); foreach ($nav_list as $k => $v) { $nav_list[$k]['sub_nav'] = init_nav_list($v['sub_nav']); } $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出在线客服与时间 if (app_conf("ONLINE_QQ") != "") { $qq = unserialize(app_conf("ONLINE_QQ")); $GLOBALS['tmpl']->assign("online_qq", $qq); } //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("site_info", get_site_info()); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //输出热门关键词 $hot_kw = app_conf("SHOP_SEARCH_KEYWORD"); $hot_kw = preg_split("/[ ,]/i", $hot_kw); $GLOBALS['tmpl']->assign("hot_kw", $hot_kw); if (MODULE_NAME == "acate" && ACTION_NAME == "index" || MODULE_NAME == "article" && ACTION_NAME == "index" || MODULE_NAME == "cate" && ACTION_NAME == "index" || MODULE_NAME == "comment" && ACTION_NAME == "index" || MODULE_NAME == "help" && ACTION_NAME == "index" || MODULE_NAME == "link" && ACTION_NAME == "index" || MODULE_NAME == "mobile" && ACTION_NAME == "index" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "list_notice" || MODULE_NAME == "rec" && ACTION_NAME == "rhot" || MODULE_NAME == "rec" && ACTION_NAME == "rnew" || MODULE_NAME == "rec" && ACTION_NAME == "rbest" || MODULE_NAME == "rec" && ACTION_NAME == "rsale" || MODULE_NAME == "score" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "fav" || MODULE_NAME == "space" && ACTION_NAME == "fans" || MODULE_NAME == "space" && ACTION_NAME == "focus" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "pick" || MODULE_NAME == "sys" && ACTION_NAME == "index" || MODULE_NAME == "sys" && ACTION_NAME == "list_notice" || MODULE_NAME == "vote" && ACTION_NAME == "index") { set_gopreview(); } }
$GLOBALS['tmpl']->assign("user_info", $user_info); } global $ref_uid; //保存返利的cookie if ($_REQUEST['ref']) { $rid = intval(base64_decode($_REQUEST['ref'])); $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval($rid))); es_cookie::set("REFERRAL_USER", intval($ref_uid)); } else { //获取存在的推荐人ID if (intval(es_cookie::get("REFERRAL_USER")) > 0) { $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval(es_cookie::get("REFERRAL_USER")))); } } //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出SEO元素 $GLOBALS['tmpl']->assign("site_name", app_conf("SITE_NAME")); $GLOBALS['tmpl']->assign("seo_title", app_conf("SEO_TITLE")); $GLOBALS['tmpl']->assign("seo_keyword", app_conf("SEO_KEYWORD")); $GLOBALS['tmpl']->assign("seo_description", app_conf("SEO_DESCRIPTION")); //删除超过三天的订单 //$GLOBALS['db']->query("delete from ".DB_PREFIX."deal_order where order_status = 0 and credit_pay = 0 and ".NOW_TIME." - create_time > ".(24*3600*3)); $has_deal_notify = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_notify")); define("HAS_DEAL_NOTIFY", $has_deal_notify); //存在待发的项目通知 if ($user_info) { $user_notify_count = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_notify where user_id = " . intval($user_info['id']) . " and is_read = 0")); $user_message_count = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_message where user_id = " . intval($user_info['id']) . " and is_read = 0"));
/** *取分类导航树 */ function get_nav_list($pid = 0, $child = false) { global $menu_lev; $menu_lev++; $rearr = array(); if (!$child and empty($rearr)) { $rearr[0] = '顶级导航'; } $where['status'] = 1; $where['pid'] = $pid; $list = M('Nav')->where($where)->order('sort asc')->select(); if ($list) { foreach ($list as $val) { if ($child) { $rearr[$val['nav_id']] = get_space($menu_lev) . $val['title']; } else { $rearr[$val['nav_id']] = $val['title']; } $temarr = get_nav_list($val['nav_id'], true); foreach ($temarr as $key => $v) { $rearr[$key] = $v; } } } $menu_lev--; return $rearr; }
/** * 关于页面初始化时需要输出的信息 * 全属使用的模板信息输出 * 1. seo 基本信息 * $GLOBALS['tmpl']->assign("shop_info",get_shop_info()); * 2. 当前城市名称, 单城市不显示 * 3. 输出APP_ROOT */ function init_app_page() { //输出根路径 $GLOBALS['tmpl']->assign("APP_ROOT", APP_ROOT); //定义当前语言包 $GLOBALS['tmpl']->assign("LANG", $GLOBALS['lang']); $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']); $GLOBALS['tmpl']->assign("deal_city", $GLOBALS['city']); //开始输出site_seo $site_seo['keyword'] = $GLOBALS['city']['seo_keyword'] == '' ? app_conf('SHOP_KEYWORD') : $GLOBALS['city']['seo_keyword']; $site_seo['description'] = $GLOBALS['city']['seo_description'] == '' ? app_conf('SHOP_DESCRIPTION') : $GLOBALS['city']['seo_description']; $site_seo['title'] = app_conf("SHOP_TITLE"); $seo_title = $GLOBALS['city']['seo_title'] == '' ? app_conf('SHOP_SEO_TITLE') : $GLOBALS['city']['seo_title']; if ($seo_title != "") { $site_seo['title'] .= " - " . $seo_title; } $GLOBALS['tmpl']->assign("site_seo", $site_seo); //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出热门关键词 $hot_kw = app_conf("SHOP_SEARCH_KEYWORD"); $hot_kw = preg_split("/[ ,]/i", $hot_kw); $hot_kws = array(); foreach ($hot_kw as $k => $v) { $hot_kws[$k]['url'] = url("index", "search#jump", array("kw" => $v)); $hot_kws[$k]['txt'] = $v; } $GLOBALS['tmpl']->assign("hot_kw", $hot_kws); //输出接收到的关键词 global $kw; $kw = strim($_REQUEST['kw']); $GLOBALS['tmpl']->assign("kw", $kw); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //输出城市列表 $city_list = load_auto_cache("city_list_result"); $GLOBALS['tmpl']->assign("city_count", count($city_list['ls'])); $GLOBALS['tmpl']->assign("city_list", $city_list['ls']); //定义展示的下拉菜单类型 if (MODULE_NAME == "mall" || MODULE_NAME == "cate") { $cate_tree_type = 1; } elseif (MODULE_NAME == "scores") { $cate_tree_type = 2; } elseif (MODULE_NAME == "youhuis" || MODULE_NAME == "youhui") { $cate_tree_type = 3; } elseif (MODULE_NAME == "stores" || MODULE_NAME == "store") { $cate_tree_type = 5; } else { $cate_tree_type = 0; } $GLOBALS['tmpl']->assign("cate_tree_type", $cate_tree_type); //定义search_type的默认项 if (MODULE_NAME == "tuan") { $search_type = 0; } elseif (MODULE_NAME == "youhuis" || MODULE_NAME == "youhui") { $search_type = 2; } elseif (MODULE_NAME == "events" || MODULE_NAME == "event") { $search_type = 3; } elseif (MODULE_NAME == "cate" || MODULE_NAME == "mall") { $search_type = 5; } elseif (MODULE_NAME == "discover" || MODULE_NAME == "topic" || MODULE_NAME == "group" || MODULE_NAME == "daren") { $search_type = 6; } else { $search_type = 0; } $GLOBALS['tmpl']->assign("search_type", $search_type); //输出在线客服与时间 $qq = explode("|", app_conf("ONLINE_QQ")); $GLOBALS['tmpl']->assign("online_qq", $qq); /* //输出系统文章 $system_article = get_article_list(8,0,"ac.type_id = 3","",true); $GLOBALS['tmpl']->assign("system_article",$system_article['list']); */ }