public function _initialize() { parent::_initialize(); //print_r($_SESSION);exit(); //网站状态 if (!C('pin_site_status')) { header('Content-Type:text/html; charset=utf-8'); exit(C('pin_closed_reason')); } //初始化访问者 $this->_init_visitor(); //第三方登录模块 $this->_assign_oauth(); //网站导航选中 $this->assign('nav_curr', ''); $this->assign('recommend_cate', $this->post_cate_mod->where("pid=1 and status=1")->select()); $this->assign('tese_cate', $this->post_cate_mod->where("pid=2 and status=1")->select()); $this->assign('main_nav_list', $this->nav_mod->where("type='main' and status=1")->order('ordid')->select()); $this->assign('bottom_nav_list', $this->nav_mod->where("type='bottom' and status=1")->order('ordid')->select()); $this->assign('new_post_list', $this->post_mod->where("status=1")->limit("9")->order("id desc")->select()); $this->assign('flink_list', $this->flink_mod->where("status=1")->order("ordid desc")->select()); $help_list = $this->article_cate_mod->where("pid=1 and status=1")->select(); foreach ($help_list as $key => $val) { $help_list[$key]['articles'] = $this->article_mod->where("cate_id={$val['id']}")->select(); } $this->assign('help_list', $help_list); $this->assign('gonggao_list', $this->article_mod->where('cate_id=13 and status=1')->order("ordid desc")->select()); $this->uid = $this->visitor->info['id']; $this->assign('def', json_encode(array('m' => MODULE_NAME, 'a' => ACTION_NAME))); $this->assign('req', $_REQUEST); }
public function _initialize() { parent::_initialize(); $this->_name = $this->getActionName(); $this->check_priv(); $this->menuid = $this->_request('menuid', 'trim', 0); if ($this->menuid) { $sub_menu = D('menu')->sub_menu($this->menuid, $this->big_menu); $selected = ''; foreach ($sub_menu as $key => $val) { $sub_menu[$key]['class'] = ''; if (MODULE_NAME == $val['module_name'] && ACTION_NAME == $val['action_name'] && strpos(__SELF__, $val['data'])) { $sub_menu[$key]['class'] = $selected = 'on'; } } if (empty($selected)) { foreach ($sub_menu as $key => $val) { if (MODULE_NAME == $val['module_name'] && ACTION_NAME == $val['action_name']) { $sub_menu[$key]['class'] = 'on'; break; } } } $this->assign('sub_menu', $sub_menu); } $this->assign('menuid', $this->menuid); }
protected function _initialize() { parent::_initialize(); // 需要登录权限的操作 $this->_rank = array('user' => array('index', 'profile', 'avatar', 'bind')); $this->_seo(); $this->_user_rank(); }
function _initialize() { parent::_initialize(); //每次显示的时候清除缓存 if (is_dir("./admin/Runtime")) { deleteCacheData("./admin/Runtime"); } $this->cate_list = get_items_cate_list('0', '0', '1', 'collect_miao'); }
public function _initialize() { parent::_initialize(); if (($_REQUEST['act'] == 'del' || $_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit' || in_array(ACTION_NAME, $this->_action)) && !$this->check_login()) { if ($this->isAjax()) { $this->ajaxReturn("not_login"); } else { header('Location:' . U('uc/login')); } } }
public function _initialize() { parent::_initialize(); if (session('entermodel') != 'jcmsmanage') { $this->_empty(); exit; } // 检查登录 $this->_check_admin(); $this->_name = strtolower($this->getActionName()); //小写 $this->assign('action_name', $this->_name); $this->assign('admin_menu', $this->adminMenu()); }
public function _initialize() { parent::_initialize(); //网站状态 if (!C('pin_site_status')) { header('Content-Type:text/html; charset=utf-8'); exit(C('pin_closed_reason')); } //初始化访问者 $this->_init_visitor(); //第三方登陆模块 $this->_assign_oauth(); //网站导航选中 $this->assign('nav_curr', ''); $this->_index_cate(); }
public function update() { if (!isset($_POST['id']) || empty($_POST['id'])) { $this->error('请选择要编辑的数据'); } $ex_order_mod = D('exchange_order'); $id = intval($_POST['id']); if (false === ($data = $ex_order_mod->create())) { $this->error($ex_order_mod->error()); } /* 发送站内信 array(to_user,form_user,title,content,date) 您在本站使用积分兑换的商品订单[STATE]。 */ //0未发货 1部分发货 2全部发货 3部分退货 4全部退货 switch ($_POST['goods_status']) { case 0: $state = "未发货"; break; case 1: $state = "部分发货"; break; case 2: $state = "全部发货"; break; case 3: $state = "部分退货"; break; case 4: $state = "全部退货"; break; } $map['key'] = 'msg_dhjifen'; $msgtitle = "积分兑换短信"; $content = M("user_setmsg")->where($map)->find(); $msgcontent = str_replace("[STATE]", $state, $content['val']); $sendmsg = array("to_user" => "{$_POST['to_user']}", "form_user" => "{$_SESSION['admin_info']['user_name']}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time()); parent::sendMsg($sendmsg); $result = $ex_order_mod->where("id='{$id}'")->save($data); if (false !== $result) { $this->success(L('operation_success')); } else { $this->error(L('operation_failure')); } }
public function _initialize() { parent::_initialize(); //网站状态 if (!C('pin_site_status')) { header('Content-Type:text/html; charset=utf-8'); exit(C('pin_closed_reason')); } if (session('?user_token') || isset($_GET['token'])) { if (isset($_GET['token'])) { $_SESSION['user_token'] = trim($_GET['token']); $this->assign('user_token', trim($_GET['token'])); } } else { $this->_404(); } $this->site_mod = M('user_setting'); $user_site = $this->site_mod->field("set_name,set_company,index_url")->where("token='" . session('user_token') . "'")->find(); if (count($user_site) == 0) { $user_site['set_name'] = 'bismai科技'; $user_site['set_company'] = '@2011-2099 bismai'; $user_site['index_url'] = 'http://shop.bismai.com/index.php'; } $this->assign('user_site', $user_site); //初始化访问者 $this->_init_visitor(); //第三方登陆模块 $this->_assign_oauth(); //网站导航选中 $this->assign('nav_curr', ''); $this->_index_cate(); if (!$this->visitor->is_login && !cookie('login_fail')) { $_SESSION['back_url'] = $_SERVER[QUERY_STRING]; header('Location: /index.php?m=weixin&a=autologin'); } }
function register() { if (isset($_POST)) { $_POST = setHtmlspecialchars(setFormString($_POST)); } if ($this->check_login()) { header('location:' . u('index/index')); } //引入配置文件、类库 $this->require_uc(); if (isset($_POST['dosubmit'])) { if ($this->setting['ucenterlogin']) { //检查UCENTER中是否有此用户 $ucresult = uc_user_checkname(trim($_POST['name'])); if ($ucresult == -1) { $this->assign('err', array('err' => 0, 'msg' => '用户名不合法!')); } elseif ($ucresult == -2) { $this->assign('err', array('err' => 0, 'msg' => '包含要允许注册的词语!')); } elseif ($ucresult == -3) { $this->assign('err', array('err' => 0, 'msg' => '用户名已经存在!')); } } $data = $this->user_mod->create(); $this->assign('data', $data); $flag = true; if ($_SESSION['verify'] == md5(trim($_POST['verify']))) { if ($this->user_mod->where("name='" . trim($data['name']) . "'")->count()) { $this->assign('err', array('err' => 0, 'msg' => '昵称已存在!')); $flag = false; } else { if (strlen(trim($data['email'])) > 0) { if ($this->user_mod->where("email='" . trim($data['email']) . "'")->count()) { $this->assign('err', array('err' => 0, 'msg' => '邮箱已经存在!')); $flag = false; } } } } else { $this->assign('err', array('err' => 0, 'msg' => '验证码不正确!')); $flag = false; } if ($flag) { if ($this->setting['ucenterlogin']) { $uid = uc_user_register($_POST['name'], $_POST['passwd'], $_POST['email']); } $data['ip'] = $_SERVER['REMOTE_ADDR']; $data['add_time'] = time(); $data['passwd'] = md5(trim($data['passwd'])); $data['user_info']['sex'] = $_POST['sex']; $data['user_info']['integral'] = $this->setting['user_register_score']; if ($this->setting['ucenterlogin']) { if ($uid <= 0) { if ($uid == -1) { $this->assign('err', array('err' => 0, 'msg' => '用户名不合法!')); } elseif ($uid == -2) { $this->assign('err', array('err' => 0, 'msg' => '包含要允许注册的词语!')); } elseif ($uid == -3) { $this->assign('err', array('err' => 0, 'msg' => '用户名已经存在!')); } elseif ($uid == -4) { $this->assign('err', array('err' => 0, 'msg' => 'Email 格式有误!')); } elseif ($uid == -5) { $this->assign('err', array('err' => 0, 'msg' => 'Email 不允许注册')); } elseif ($uid == -6) { $this->assign('err', array('err' => 0, 'msg' => '该 Email 已经被注册')); } else { $this->assign('err', array('err' => 0, 'msg' => '未定义')); } } else { $id = $this->user_mod->relation('user_info')->add($data); //用户登陆成功,设置 Cookie,加密直接用 uc_authcode 函数,用户使用自己的函数 setcookie('Ucenter_auth', uc_authcode($uid . "\t" . $data['name'], 'ENCODE')); } } else { $id = $this->user_mod->relation('user_info')->add($data); } //$_SESSION['user_id']=$id; //注册以后同步dengl /* 发送站内信 array(to_user,form_user,title,content,date) 注册短信:尊敬的[name]您好:欢迎注册[WEBTITLE],凡是通过[WEBTITLE]提供的链接去淘宝购物进行购物, 都将享受到1%到50%成交额的返现,推广其他用户,即可获取被推广用户返现额的[tg]%的推广佣金, 推广越多挣钱越轻松。祝您购物愉快!也欢迎您把我们的网站告诉更多的淘宝买家,谢谢! 注册送积分:恭喜您,您获得本站注册赠送积分[ZSJIFEN]。 */ $patterns[0] = "/\\[name\\]/"; $patterns[1] = "/\\[WEBTITLE\\]/"; $patterns[2] = "/\\[tg\\]/"; $replacements[2] = $data['name']; $replacements[1] = $this->setting['site_name']; $replacements[0] = $this->setting["cashback_rate"]; $map['key'] = 'msg_zhuce'; $msgtitle = "用户注册短信"; $fromUser = getAdminUserName(); $content = M("user_setmsg")->where($map)->find(); $msgcontent = preg_replace($patterns, $replacements, $content); $sendmsg = array("to_user" => "{$data['name']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time()); parent::sendMsg($sendmsg); //送积分 $map['key'] = 'msg_zsjifen'; $msgtitle = "赠送积分短信"; $jifen = M('setting')->where("name='user_register_score'")->find(); $content = M("user_setmsg")->where($map)->find(); $msgcontent = str_replace("[ZSJIFEN]", $jifen['data'], $content); $sendmsg = array("to_user" => "{$data['name']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time()); parent::sendMsg($sendmsg); // $last_time=$data['add_time']; // $key=md5($id.$data['name'].$last_time); // cookie('user[id]',$id); // cookie('user[name]',$data['name']); // cookie('user[login_time]',$last_time); // cookie('user[key]',$key); // //设置本程序cookie $last_time = time(); $key = md5($id . $data['name'] . $last_time); cookie('user[id]', $id, 3600 * 24 * 7); cookie('user[name]', $data['name'], 3600 * 24 * 7); cookie('user[login_time]', $last_time, 3600 * 24 * 7); cookie('user[key]', $key, 3600 * 24 * 7); // if($this->setting['ucenterlogin']){ // echo $ucsynlogin = uc_user_synlogin($uid); //生成同步登录的代码 // } //如果购买商品的时候跳转过来的则跳转回购买商品页面 if (isset($_GET['item_id']) && intval($_GET['item_id']) != '') { $item_id = intval($_GET['item_id']); header('location:' . u('item/index', array('id' => $item_id))); } else { header('location:' . u('uc/index')); } } } $this->display(); }
function _initialize() { $this->nav_mod = M('nav'); parent::_initialize(); $this->cate_list = get_items_cate_list('0', '0', '1', 'collect_miao'); }
public function _initialize() { parent::_initialize(); $this->mod = D('cache'); }
public function ok_update() { if (!isset($_POST['id']) || empty($_POST['id'])) { $this->error('请选择要编辑的数据'); } $type = $_REQUEST['type']; //判断是集分宝还是其他的提现 $user_tixian_mod = D('user_tixian'); if (false === ($data = $user_tixian_mod->create())) { $this->error($user_tixian_mod->error()); } $result = $user_tixian_mod->save($data); /* 发送站内信 array(to_user,form_user,title,content,date) 尊敬的[ddusername],您好:您的提现申请已经受理完毕! 本次提现金额[txje]已经支付到您提供的账户,查看明细进入“我的账户明细”![addition] */ //0未审核 1提现成功 2提现失败 $patterns[0] = "/\\[ddusername\\]/"; $patterns[1] = "/\\[txje\\]/"; $patterns[2] = "/\\[addition\\]/"; $replacements[0] = $_POST['uname']; if ($type == 2) { //2表示集分宝提现 if ($this->setting['cashback_type'] == 1) { $replacements[1] = $_POST['jifenbao'] . $this->setting['tb_fanxian_unit'] . '集分宝'; } else { $replacements[1] = $_POST['jifenbao'] . $this->setting['tb_fanxian_unit'] . $this->setting['tb_fanxian_name']; } } else { $replacements[1] = $_POST['money'] . '元'; } $replacements[2] = $_POST['reply']; $map['key'] = 'msg_tixianok'; $msgtitle = "提现成功短信"; $fromUser = $_SESSION['admin_info']['user_name']; $content = M("user_setmsg")->where($map)->find(); $msgcontent = preg_replace($patterns, $replacements, $content); $sendmsg = array("to_user" => "{$data['uname']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time()); parent::sendMsg($sendmsg); if (false !== $result) { $this->success(L('operation_success')); } else { $this->error(L('operation_failure')); } }
function _initialize() { $this->nav_mod = M('nav'); parent::_initialize(); }
public function _initialize() { parent::_initialize(); $this->_mod = D('items_cate'); }