<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */

defined('IN_UQ') or exit('Access Denied'); class mytpl extends Smarty { function __construct() { $this->template_dir = UQCMS_APP_PATH . 'templates'. DS; $this->compile_dir = 'temp'. DS .'templates_c'. DS .UQCMS_APP; $this->cache_dir = "../cache/"; $this->cache_lifetime = "60*60*24*2"; $this->left_delimiter = '<{'; $this->right_delimiter = '}>'; parent::__construct(); } function load_module($uq0) { $uq1 = []; $uq2 = explode(':',$uq0['c']); $uq3 = strpos($uq2[1], '='); $uq4 = explode('&',$uq2[1]); for($uq5=0;$uq5<count($uq4);$uq5++){ $uq6 = explode('=', $uq4[$uq5]); $uq1[trim($uq6[0])] = trim($this->check_GPRS($uq6[1])); } $uq7 = $uq2[0]; if($uq7){ if(empty($uq1['page'])){ @$uq1['page'] = '1'; } if(empty($uq1['page_size'])){ @$uq1['page_size'] = '10'; } $uq8 = mod($uq0['m'])->$uq7($uq1); $this->assign($uq0['v'], $uq8); } } function load_ads($uq0) { $uq8 = mod('ad')->alias($uq0); $this->assign($uq0['data'], $uq8); } function check_GPRS($uq0) { if(substr($uq0, 0, 6) == 'smarty'){ $uq9 = explode('.', $uq0); if($uq9[1] == 'get'){ $uq8 = $_GET[$uq9[2]]; }elseif($uq9[1] == 'session'){ $uq8 = $_SESSION[$uq9[2]]; }elseif($uq9[1] == 'cookie'){ $uq8 = $_COOKIE[$uq9[2]]; } if(isset($uq9[3])){ return $uq8[$uq9[3]]; } return $uq8; }else{ return $uq0; } } function img_size($uq10, $uq11 = '150x150') { return img_size($uq11, $uq10); } function urldecode($uq12) { return urldecode($uq12); } public function displays($uq13 = NULL, $uq14 = false) { if(cfg['site_status'] == '4'){ if(UQCMS_APP != 'admin'){ error_404('站点维护，临时关闭！'); } }else{ if(cfg['site_pc_status'] == '1' && cfg['site_wap_status'] == '1'){ }elseif(cfg['site_pc_status'] == '1' && cfg['site_wap_status'] == '0'){ if(UQCMS_APP == 'wap'){ location('index/index'); } }elseif(cfg['site_pc_status'] == '0' && cfg['site_wap_status'] == '1'){ if(UQCMS_APP == 'home'){ location('wap/index/index'); } }elseif(cfg['site_pc_status'] == '0' && cfg['site_wap_status'] == '0'){ if(UQCMS_APP != 'admin'){ error_404('显示端关闭'); } } } $uq15 = $_GET['m']??'index'; $uq7 = $_GET['a']??'index'; if(UQCMS_APP == 'home'){ if(empty(cfg['tpl_pc_name'])){ $this->tpl_addr = 'default/'; }else{ $this->tpl_addr = cfg['tpl_pc_name'].'/'; } }elseif(UQCMS_APP == 'wap'){ if(empty(cfg['tpl_wap_name'])){ $this->tpl_addr = 'default/'; }else{ $this->tpl_addr = cfg['tpl_wap_name'].'/'; } }elseif(UQCMS_APP == 'admin' || UQCMS_APP == 'seller'){ $this->tpl_addr = ''; }else{ $this->tpl_addr = '/'; } if(!empty($uq13)){ if($uq14){ $uq16 = $uq13; }else{ $uq16 = UQCMS_APP_PATH.'templates/'.$this->tpl_addr.$uq13.".html"; } }else{ $uq16 = UQCMS_APP_PATH.'templates/'.$this->tpl_addr.$uq15."/".$uq7.".html"; if(!file_exists($uq16)){ } } $this->register_function('uqcms', [$this, 'load_module']); $this->register_function('ads', [$this, 'load_ads']); $this->register_function('import', [$this, 'import']); $this->register_modifier('img_size', [$this, 'img_size']); $this->register_modifier('urldecode', [$this, 'urldecode']); $this->assign('__URI__', cfg['site_url']); $this->assign('__URL__', cfg['site_url']); $this->assign('__WAP__', cfg['site_url'].'wap/'); $this->assign('__ADMIN__', cfg['site_url'].cfg['site_admin_url'].'/'); $this->assign('__SELLER__', cfg['site_url'].'seller/'); $this->assign('__PUBLIC__', cfg['site_path'].'public/'); $this->assign('__APP__', cfg['site_path'].UQCMS_APP.'/templates/'.$this->tpl_addr); $this->assign('__IMG__', img_host()); $this->assign('__HTML__', '.html'); $this->assign('js_version', time()); $this->assign('UQCMS', cfg); parent::display($uq16); } function import($uq2) { if(count($uq2) != '1'){ foreach($uq2 as $uq17=>$uq18){ if($uq17 != 'file'){ if($uq17 == 'css'||$uq17 == 'js'){ $uq18 = explode(',', $uq18); } $this->assign($uq17, $uq18); } } } $uq19 = $uq2['file']?$uq2['file']:''; $uq19 = $this->tpl_addr.$uq19; $this->display($uq19); } } 