/** * 模块初始化,获取当前用户管理的应用 */ public function _initialize() { $this->appList = model('App')->getManageApp($this->mid); if (empty($this->appList)) { $this->error(L('PUBLIC_NO_FRONTPLATFORM_PERMISSION')); } }
/** * 渲染分享发布框模板 * @example * $data['send_type'] string 分享发送类型 * $data['app_name'] string 发布分享所在的应用名称 * $data['initHtml'] string 发布分享框中的默认内容 * $data['cancomment'] integer 是否可以评论 *$data['channelID'] 发布到某个频道的id * @param array $data 发布分享框的配置参数 * @return string 渲染后的模板内容 */ public function render($data) { $var = array(); //频道id $var['channelID'] = $data['channelID']; $var['initHtml'] = ''; $var['post_event'] = 'post_group_feed'; $var['cancomment'] = 0; is_array($data) && ($var = array_merge($var, $data)); !$var['send_type'] && ($var['send_type'] = 'send_weibo'); $weiboSet = model('Xdata')->get('admin_Config:feed'); $var['initNums'] = $weiboSet['weibo_nums']; $var['weibo_type'] = $weiboSet['weibo_type']; $var['weibo_premission'] = $weiboSet['weibo_premission']; !$var['type'] && ($var['type'] = 'post'); !$var['app_name'] && ($var['app_name'] = 'public'); !$var['prompt'] && ($var['prompt'] = '转发成功'); $var['time'] = $_SERVER['REQUEST_TIME']; $var['topicHtml'] = t($data['topicHtml']); // 获取安装的应用列表 $var['hasChannel'] = model('App')->isAppNameOpen('channel'); // 权限控制 $type = array('face', 'at', 'image', 'video', 'file', 'topic', 'contribute'); foreach ($type as $value) { !isset($var['actions'][$value]) && ($var['actions'][$value] = true); } // 渲染模版 $content = $this->renderFile(dirname(__FILE__) . "/SendGroupWeibo.html", $var); self::$rand++; unset($var, $data); // 输出数据 return $content; }
public function weibo() { // 解析参数 $_REQUEST['param'] = unserialize(urldecode($_REQUEST['param'])); $active_field = $_REQUEST['param']['active_field'] == 'title' ? 'title' : 'body'; $this->assign('has_status', $_REQUEST['param']['has_status']); $this->assign('is_success_status', $_REQUEST['param']['is_success_status']); $this->assign('status_title', t($_REQUEST['param']['status_title'])); // 解析模板(统一使用模板的body字段) $_REQUEST['data'] = unserialize(urldecode($_REQUEST['data'])); $content = model('Template')->parseTemplate(t($_REQUEST['tpl_name']), array($active_field => $_REQUEST['data'])); // 设置微博发布框的权限 $type = array('at', 'image', 'video', 'file', 'contribute'); $actions = array(); foreach ($type as $value) { $actions[$value] = false; } $this->assign('actions', $actions); $this->assign('title', $content['title']); $this->assign('initHtml', $content['body']); $this->assign('content', h($content[$active_field])); $this->assign('source', $_REQUEST['data']['source']); $this->assign('sourceUrl', $_REQUEST['data']['url']); $this->assign('type', $_REQUEST['data']['type']); $this->assign('type_data', $_REQUEST['data']['type_data']); $this->assign('button_title', t(urldecode($_REQUEST['button_title']))); $this->assign('addon_info', urldecode($_REQUEST['addon_info'])); $this->display(); }
/** * Sets a configuration value - updates if it exists otherwise insert. * @param string $key * @param string $value * @param integer $user_id */ public function setConfig($key = false, $value = false, $user_id = NULL) { $new_rc = array('current_value' => $value, 'config_key' => $key, 'user_id' => $user_id); $cfg_model = model()->open('config'); $cfg = $this->configRecord($key, $user_id); return is_array($cfg) ? $cfg_model->update($new_rc, $cfg['id']) : $cfg_model->insert($new_rc); }
/** * 我的收藏页面 */ public function index() { $map['uid'] = $GLOBALS['ts']['uid']; $weiboSet = model('Xdata')->get('admin_Config:feed'); $this->assign($weiboSet); // TODO:后续可能由表中获取语言KEY $d['tabHash'] = array('feed' => L('PUBLIC_WEIBO')); $d['tab'] = model('Collection')->getCollTab($map); $this->assign($d); // 安全过滤 $t = t($_GET['t']); !empty($t) && ($map['source_table_name'] = $t); $key = t($_POST['collection_key']); if ($key === '') { $list = model('Collection')->getCollectionList($map, 20); } else { $list = model('Collection')->searchCollections($key, 20); $this->assign('collection_key', $key); $this->assign('jsonKey', json_encode($key)); } $this->assign($list); $this->setTitle(L('PUBLIC_COLLECTION_INDEX')); // 我的收藏 // 是否有返回按钮 $this->assign('isReturn', 1); // 获取用户统计信息 $userData = model('UserData')->getUserData($GLOBALS['ts']['mid']); $this->assign('favoriteCount', $userData['favorite_count']); $userInfo = model('User')->getUserInfo($this->mid); $this->setTitle('我的收藏'); $this->setKeywords($userInfo['uname'] . '的收藏'); $this->display(); }
public function doSwitch() { global $_W, $_GPC; $m = array_merge($_W['modules']['userapi'], $_W['account']['modules'][$_W['modules']['userapi']['mid']]); $cfg = $m['config']; if ($_W['ispost']) { $rids = explode(',', $_GPC['rids']); if (is_array($rids)) { $cfg = array(); foreach ($rids as $rid) { $cfg[intval($rid)] = true; } $this->saveSettings($cfg); } exit; } require model('rule'); $rs = rule_search("weid = 0 AND module = 'userapi' AND `status`=1"); $ds = array(); foreach ($rs as $row) { $reply = pdo_fetch('SELECT * FROM ' . tablename($this->tablename) . ' WHERE `rid`=:rid', array(':rid' => $row['id'])); $r = array(); $r['title'] = $row['name']; $r['rid'] = $row['id']; $r['description'] = $reply['description']; $r['switch'] = $cfg[$r['rid']] ? ' checked="checked"' : ''; $ds[] = $r; } include $this->template('switch'); }
/** * 编辑活动 */ public function edit() { $id = I('id'); if (IS_POST) { $data = I('data'); if ($_FILES['act_banner']['name']) { $result = $this->ectouchUpload('act_banner', 'banner_image'); if ($result['error'] > 0) { $this->message($result['message'], NULL, 'error'); } /* 生成banner链接 */ $data2['act_banner'] = substr($result['message']['act_banner']['savepath'], 2) . $result['message']['act_banner']['savename']; $this->model->table('touch_activity')->data($data2)->where('act_id=' . $id)->update(); } $this->message(L('edit_favourable_ok'), url('index')); } /* 查询附表信息 */ $touch_result = $this->model->table('touch_activity')->where('act_id=' . $id)->find(); $favourable = model('GoodsBase')->favourable_info($id); /* 附表信息不存在则生成 */ if (empty($touch_result)) { $data['act_id'] = $id; $this->model->table('touch_activity')->data($data)->insert(); } else { $favourable['act_banner'] = $touch_result['act_banner']; $favourable['act_content'] = html_out($touch_result['act_content']); } /* 模板赋值 */ $this->assign('favourable', $favourable); $this->assign('ur_here', L('edit_favourable')); $this->assign('action_link', array('text' => L('06_goods_brand_list'), 'href' => url('index'))); $this->display(); }
/** * 用户的通知统计数目 * @return mix 通知统计状态和数目 */ public function getUnreadCount() { $count = model('UserCount')->getUnreadCount($this->mid); $data['status'] = 1; $data['data'] = $count; echo json_encode($data); }
public function search() { if (empty($_REQUEST["start_time"])) { $datas['start_time'] = 0; } else { $datas['start_time'] = $_REQUEST['start_time']; } if (empty($_REQUEST["end_time"])) { $datas['end_time'] = date("Y-m-d H:i:s"); } else { $datas['end_time'] = $_REQUEST['end_time']; } if (!empty($_REQUEST["account"])) { $datas['username'] = $_REQUEST['account']; } if (!empty($_REQUEST["ip"])) { $datas['ip'] = $_REQUEST['ip']; } if ($_REQUEST['status'] != 'all') { $datas['status'] = $_REQUEST['status']; } $datas['date'] = array('between', "{$datas['start_time']},{$datas['end_time']}"); $page_data = model("Log")->logList($datas); $this->assign("list", $page_data["data"]); $this->assign("page", $page_data["page"]); $this->display("Log:index"); }
public function unsetNotificationCount() { if (empty($this->user_id) && isset($this->mid)) { switch ($this->data['type']) { // 暂仅允许message/weibo_commnet/atMe case 'message': return (int) model('Message')->setAllIsRead($this->mid); case 'weibo_comment': return (int) model('UserCount')->setZero($this->mid, 'comment'); case 'atMe': return (int) model('UserCount')->setZero($this->mid, 'atme'); default: return 0; } } else { switch ($this->data['type']) { // 暂仅允许message/weibo_commnet/atMe case 'message': return (int) model('Message')->setAllIsRead($this->user_id); case 'weibo_comment': return (int) model('UserCount')->setZero($this->user_id, 'comment'); case 'atMe': return (int) model('UserCount')->setZero($this->user_id, 'atme'); default: return 0; } } }
public function doRegister() { $email = safe($_POST['email']); $uname = safe($_POST['uname']); $password = safe($_POST['password']); $repassword = safe($_POST['re_password']); if ($password != $repassword) { redirect(U('/Public/register', $_POST), 3, '两次的密码不符'); } $service = model('UserRegister'); $uid = $service->register($email, $uname, $password, true); if (!$uid) { redirect(U('/Public/register', $_POST), 3, $service->getLastError()); } else { //redirect(U('/Public/login'), 1, '注册成功'); if ($user = model('Passport')->getLocalUser($email, $password)) { if ($user['is_active'] == 0) { redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录'); } $result = model('Passport')->registerLogin($user); redirect(U('wap/Index/index')); } else { redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入'); } } }
public function getZBConfig() { //获取配置简单加密 $key = $this->data['key']; if (md5($this->key) != $key) { return $this->rd('', '认证失败', 1); } $chongzhi_info = model('Xdata')->get('admin_Config:charge'); $info['cash_exchange_ratio_list'] = getExchangeConfig('cash'); $info['charge_ratio'] = $chongzhi_info['charge_ratio'] ?: '100'; //1人民币等于多少积分 $info['charge_description'] = $chongzhi_info['description'] ?: '充值描述'; //充值描述 $field = $this->data['field']; //关键字 不传为全部 if ($field) { $field = explode(',', $field); foreach ($info as $key => $value) { if (!in_array($key, $field)) { unset($info[$key]); } } } return $this->rd($info); }
/** * 添加意见反馈操作 */ public function feedback() { if (t($_POST['textarea'])) { $feedbacktype = D('')->table(C('DB_PREFIX') . 'feedback_type')->where('type_name = "' . t($_POST['select']) . '"')->find(); $map['feedbacktype'] = $feedbacktype['type_id']; $map['feedback'] = t($_POST['textarea']); $map['uid'] = $this->mid; $map['cTime'] = time(); $map['type'] = 0; $res = model('Feedback')->add($map); if ($map['feedback'] == '') { $this->error(L('PUBLIC_INPUT_FEEDBACK')); // 请填写反馈内容 } if ($res) { $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); foreach ($touid as $k => $v) { model('Notify')->sendNotify($v['uid'], 'feedback_audit'); } $return = array('status' => 1, 'data' => L('PUBLIC_REPORTING_INFO')); $this->assign('jumpUrl', U('public/Index/index')); $this->success(L('PUBLIC_SUBMIT_FEEDBACK_SUCCESS')); // 提交成功,感谢您的反馈 } else { $this->error(model()->getError()); } } else { $this->error(L('PUBLIC_INPUT_FEEDBACK')); // 请填写反馈内容 } }
function test() { $a = model('Test'); $key = '1234'; $this->swoole->cache->delete($key); $this->db->getAffectedRows(); }
public function doshorturl() { $data['shorturl_type'] = $_POST['shorturl_type']; $data['customize_url'] = h($_POST['customize_url']); model('Xdata')->lput('shorturl', $data); $this->redirect('admin/Plugin/shorturl'); }
public function index() { if ($this->isAjax()) { $params = $_REQUEST; if (!$this->mid) { $this->_error('请先登录'); } $params['uid'] = $this->mid; $params['addtime'] = time(); $params['source'] = $params['source']; $flash_info = model('video')->_weiboTypePublish($params['url']); if (is_array($flash_info)) { if ($flash_info['flashvar']) { $params['url'] = $flash_info['flashvar']; } $params['source'] = $flash_info['source']; $params['host'] = $flash_info['host']; } $info = M('V')->publish($params); if (is_string($info)) { $this->_error($info); } model('Feed')->syncToFeed('我发布了一个新视频“' . $params['title'] . '”,详情请点击' . U('video/Index/detail', array('id' => $info, 'uid' => $this->mid)), $this->mid, $params['attach_id']); $this->_success(null, '发布成功'); return; } $this->display(); }
/** * 获取用户的相关数据 * * @param array $data * 配置相关数据 * @return array 显示所需数据 */ private function _getRelatedZhanggui($data) { // 用户ID $var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid']; // 显示相关人数 $var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4; // 掌柜信息 $key = '_getRelatedZhanggui' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd'); $var['user'] = S($key); if ($var['user'] === false || intval($_REQUEST['rel']) == 1) { $sql = "SELECT uid FROM `ts_user_verified` WHERE usergroup_id=5 AND verified=1 order by rand() limit " . $var['limit']; $list = M()->query($sql); // dump($list); $uids = getSubByKey($list, 'uid'); $userInfos = model('User')->getUserInfoByUids($uids); $userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids); foreach ($list as $v) { $key = $v['uid']; $arr[$key]['userInfo'] = $userInfos[$key]; $arr[$key]['followState'] = $userStates[$key]; $arr[$key]['info']['msg'] = '掌柜'; $arr[$key]['info']['extendMsg'] = ''; } $var['user'] = $arr; S($key, $var['user'], 86400); // S ( 'now_'.$key, $var ['user'], 86400 ); } // dump($var); return $var; }
public function goods_listOp() { /** * 处理商品分类 */ $choose_gcid = ($t = intval($_REQUEST['choose_gcid'])) > 0 ? $t : 0; $gccache_arr = Model('goods_class')->getGoodsclassCache($choose_gcid, 3); Tpl::output('gc_json', json_encode($gccache_arr['showclass'])); Tpl::output('gc_choose_json', json_encode($gccache_arr['choose_gcid'])); $model_booth = Model('p_booth'); $where = array(); if (intval($_GET['choose_gcid']) > 0) { $where['gc_id'] = intval($_GET['choose_gcid']); } $goods_list = $model_booth->getBoothGoodsList($where, 'goods_id', 10); if (!empty($goods_list)) { $goodsid_array = array(); foreach ($goods_list as $val) { $goodsid_array[] = $val['goods_id']; } $goods_list = Model('goods')->getGoodsList(array('goods_id' => array('in', $goodsid_array))); } Tpl::output('gc_list', Model('goods_class')->getGoodsClassForCacheModel()); Tpl::output('goods_list', $goods_list); Tpl::output('show_page', $model_booth->showpage(2)); // 输出自营店铺IDS Tpl::output('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds())); Tpl::showpage('promotion_booth_goods.list'); }
/** * 架构函数,处理核心变量 * 使用字符串返回 不能有任何输出 */ public function __construct() { //当前登录者uid $GLOBALS['ts']['mid'] = $this->mid = intval($_SESSION['mid']); //当前访问对象的uid $GLOBALS['ts']['uid'] = $this->uid = intval($_REQUEST['uid'] == 0 ? $this->mid : $_REQUEST['uid']); // 赋值当前访问者用户 $GLOBALS['ts']['user'] = $this->user = model('User')->getUserInfo($this->mid); if ($this->mid != $this->uid) { $GLOBALS['ts']['_user'] = model('User')->getUserInfo($this->uid); } else { $GLOBALS['ts']['_user'] = $GLOBALS['ts']['user']; } //当前用户的所有已添加的应用 $GLOBALS['ts']['_userApp'] = $userApp = model('UserApp')->getUserApp($this->uid); //当前用户的统计数据 $GLOBALS['ts']['_userData'] = $userData = model('UserData')->getUserData($this->uid); $this->site = D('Xdata')->get('admin_Config:site'); $this->site['logo'] = getSiteLogo($this->site['site_logo']); $GLOBALS['ts']['site'] = $this->site; //语言包判断 if (TRUE_APPNAME != 'public' && APP_NAME != TRUE_APPNAME) { addLang(TRUE_APPNAME); } Addons::hook('core_filter_init_widget'); }
/** * 获取用户的相关数据 * * @param array $data * 配置相关数据 * @return array 显示所需数据 */ private function _getRelatedDaren($data) { // 用户ID $var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid']; // 显示相关人数 $var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4; // 收藏达人的信息 $key = '_getRelatedDaren' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd'); $var['user'] = S($key); if ($var['user'] === false || intval($_REQUEST['rel']) == 1) { $sql = "select * from \n\t\t\t(SELECT DISTINCT uid FROM `ts_user_data` WHERE `key`='collect_total_count' ORDER BY `value` DESC LIMIT 100) as t\n\t\t\torder by rand() limit " . $var['limit']; $list = M()->query($sql); $uids = getSubByKey($list, 'uid'); $userInfos = model('User')->getUserInfoByUids($uids); $userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids); foreach ($list as $v) { $key = $v['uid']; $arr[$key]['userInfo'] = $userInfos[$key]; $arr[$key]['followState'] = $userStates[$key]; $arr[$key]['info']['msg'] = '掌柜'; $arr[$key]['info']['extendMsg'] = ''; } $var['user'] = $arr; S($key, $var['user'], 86400); } return $var; }
function cart_list() { $data = array(); if (!isset($_SESSION['cart'])) { $data['error'] = 'Giỏ trống trơn!'; } else { $data['cart'] = $_SESSION['cart']; $fromDB = model('book')->getCartList($data['cart']); $merge = array(); foreach ($data['cart'] as $cart) { foreach ($fromDB as $value) { if (intval($value['id']) == $cart['book_id']) { $merge[] = array_merge($cart, $value); } } } //var_dump($merge); $data['merge'] = $merge; } //Submit cart if (isPostRequest()) { $postData = postData(); for ($i = 1; $i <= count($_SESSION['cart']); $i++) { foreach ($_SESSION['cart'] as $key => $cart) { if ($postData['bookid' . $i] == $cart['book_id']) { $_SESSION['cart'][$key]['quantity'] = $postData['quantity' . $i]; } } } redirect('index.php?c=bill&m=view'); } $data['template_file'] = 'cart/list.php'; render('layout.php', $data); }
/** * @abstract Saves page section data to the main section list, unique data to special tables * @param unknown_type $id * @return unknown */ public function savePageSections($id) { $sections = array(); $post = post()->getRawSource(); if (isset($post['page_sections']) && is_array($post['page_sections'])) { // first, wipe all section content so that our saves are new foreach ($post['page_sections'] as $section) { if (array_key_exists($section['section_type'], $this->sections)) { model()->open('section_' . $section['section_type'])->delete($id, 'page_id'); } } // then, loop and save all sections foreach ($post['page_sections'] as $val) { if (array_key_exists($val['section_type'], $this->sections)) { $section = $this->sections[$val['section_type']]; if (isset(app()->{$section['module']}) && method_exists(app()->{$section['module']}, 'saveSection')) { $new_sections = app()->{$section['module']}->saveSection($val, $id); $sections = array_merge($sections, $new_sections); } } } } // return an array of section details, for saving in the section list table return $sections; }
public function index() { $page = t($_GET['page']); $map['domain'] = $page; if (!model('UserGroup')->isAdmin($this->mid)) { $map['status'] = 1; //显示 $map['guest'] = 1; //游客是否可见 } $databaseData = model('Page')->getPageInfo($map, 'id,page_name,canvas,layout_data,widget_data'); if (!$databaseData) { $this->error("Error! 找不到该页面或者该页面已隐藏!"); } $parseTag = model('ParseTag'); $this->setTitle($databaseData['page_name']); $this->assign('tempData', $databaseData['layout_data']); $this->assign('layoutData', unserialize($databaseData['widget_data'])); $pageData = $parseTag->parseId($databaseData['layout_data'], 180); $this->assign('data', $pageData); $this->assign('page', $page); $databaseData['canvas'] = CANVAS_PATH . $databaseData['canvas']; model('Page')->addReader($databaseData['id']); if (!file_exists($databaseData['canvas'])) { $this->display(); } else { $this->display($databaseData['canvas']); } }
/** * 搜索最近@的人 * @return array 搜索状态及用户列表数据 */ public function searchAt() { $users = model('UserData')->where("`key`='user_recentat' and uid=" . $GLOBALS['ts']['mid'])->getField('value'); $data = unserialize($users); $msg = array('data' => $data); exit(json_encode($msg)); }
function bill_detail() { $data = array(); $user = adminLogged(); if (!adminLogged()) { redirect('/index.php?c=admin&m=login'); } else { $bill_detail = model('bill')->getBillDetails($_GET['id']); $data['total'] = 0; foreach ($bill_detail as $key => $b) { $book = model('book')->getSingle($b['book_id']); $bill_detail[$key]['name'] = $book['name']; $bill_detail[$key]['price'] = intval($book['price']); $bill_detail[$key]['total'] = $book['price'] * $b['quantity']; $bill_detail[$key]['image'] = $book['image']; $data['total'] += $book['price'] * $b['quantity']; } $data['bill_detail'] = $bill_detail; } $data['statuses'] = array('Chờ duyệt', 'Đang giao hàng', 'Đã giao hàng', 'Hủy'); $data['stt'] = model('bill')->getOneBy($_GET['id'], null)['status']; if (isPostRequest()) { $postData = postData(); db_update('bills', $postData, 'id=' . $_GET['id']); $data['stt'] = $postData['status']; $data['error'] = 'Tình trạng đơn hàng update thành công.'; } $data['user'] = model('user')->getOneBy(model('bill')->getOneBy($_GET['id'], null)['user_id'], null); $data['template_file'] = 'bill/detail.php'; render('layout.php', $data); }
/** * 官方服务器生成语言同步文件 * */ public function createLangPHPFile() { set_time_limit(0); // 判断文件夹路径是否存在 if (!file_exists(LANG_PATH)) { mkdir(LANG_PATH, 0777); } $data = model('Lang')->order('lang_id asc')->findAll(); $fileName = LANG_PATH . '/langForLoadUpadte.php'; // 权限处理 $fp = fopen($fileName, 'w+'); $fileData = "<?php\n"; $fileData .= "return array(\n"; foreach ($data as $val) { if (empty($val['key']) || empty($val['appname']) || empty($val['filetype'])) { continue; } $val['zh-cn'] = htmlspecialchars($val['zh-cn'], ENT_QUOTES); $val['en'] = htmlspecialchars($val['en'], ENT_QUOTES); $val['zh-tw'] = htmlspecialchars($val['zh-tw'], ENT_QUOTES); $content[] = "'{$val['key']}-{$val['appname']}-{$val['filetype']}'=>array(0=>'{$val['zh-cn']}',1=>'{$val['en']}',2=>'{$val['zh-tw']}',)"; } $fileData .= implode(",\n", $content); $fileData .= "\n);"; fwrite($fp, $fileData); fclose($fp); unset($fileData); unset($content); @chmod($fileName, 0775); tsload(ADDON_PATH . '/library/Update.class.php'); $updateClass = new Update(); $res = $updateClass->zipPackage($fileName, LANG_PATH, 'langForLoadUpadte', LANG_PATH); unlink($fileName); echo $res; }
public function __construct() { $this->mid = $_SESSION['mid']; $this->model = model("AddonData"); $this->view = Think::instance('View'); $this->start(); }
private function _initialize() { //初始化设置 @ini_set('memory_limit', '64M'); @ini_set('session.cache_expire', 180); @ini_set('session.use_cookies', 1); @ini_set('session.auto_start', 0); @ini_set('display_errors', 1); @ini_set("arg_separator.output", "&"); @ini_set('include_path', '.;' . BASE_PATH); //加载系统常量和函数库 require BASE_PATH . 'base/constant.php'; require BASE_PATH . 'base/function.php'; //对用户传入的变量进行转义操作 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); } //创建 ECSHOP 对象 self::$ecs = new EcsEcshop(C('DB_NAME'), C('DB_PREFIX')); //初始化数据库类 self::$db = new EcsMysql(C('DB_HOST'), C('DB_USER'), C('DB_PWD'), C('DB_NAME')); //创建错误处理对象 self::$err = new EcsError('message.dwt'); //载入系统参数 C('CFG', model('Base')->load_config()); }
/** * 初始化相关信息 * @return void */ public function __construct() { $this->mid = @intval($_SESSION['mid']); $this->model = model("AddonData"); $this->tVar = array(); $this->start(); }
/** * 获得指定页面的动态内容 * * @access public * @param string $tmp 模板名称 * @return void */ function assign_dynamic($tmp) { $sql = 'SELECT id, number, type FROM ' . $this->pre . "template WHERE filename = '{$tmp}' AND type > 0 AND remarks ='' AND theme='" . C('template') . "'"; $res = $this->query($sql); foreach ($res as $row) { switch ($row['type']) { case 1: /* 分类下的商品 */ ECTouch::view()->assign('goods_cat_' . $row['id'], model('Goods')->assign_cat_goods($row['id'], $row['number'])); break; case 2: /* 品牌的商品 */ $brand_goods = model('Goods')->assign_brand_goods($row['id'], $row['number']); ECTouch::view()->assign('brand_goods_' . $row['id'], $brand_goods['goods']); ECTouch::view()->assign('goods_brand_' . $row['id'], $brand_goods['brand']); break; case 3: /* 文章列表 */ $cat_articles = model('Article')->assign_articles($row['id'], $row['number']); ECTouch::view()->assign('articles_cat_' . $row['id'], $cat_articles['cat']); ECTouch::view()->assign('articles_' . $row['id'], $cat_articles['arr']); break; } } }