Exemplo n.º 1
0
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $data['qq_login_url'] = $this->url->link('extension/module/qq_login/login', '', true);
         $this->load->language('extension/module/qq_login');
         $data['text_qq_login'] = $this->language->get('text_qq_login');
         if ($this->customer->isLogged()) {
             $data['logged'] = 1;
         } else {
             $data['logged'] = 0;
         }
         if (isset($this->session->data['qq_login_openid'])) {
             $data['qq_login_authorized'] = 1;
         } else {
             $data['qq_login_authorized'] = 0;
         }
         $this->load->helper('mobile');
         if (is_weixin()) {
             $data['is_weixin'] = 1;
         } else {
             $data['is_weixin'] = 0;
         }
         return $this->load->view('extension/module/qq_login', $data);
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     check_shop_auth();
     if (is_weixin()) {
         m('member')->checkMember();
     }
 }
 public function __construct()
 {
     if (is_weixin() === true) {
         header('Location: http://m.renrenlie.com/');
     }
     parent::__construct();
     if (!empty($_SESSION['username']) || !empty($_SESSION['cusername'])) {
         $username = $_SESSION['username'] ? $_SESSION['username'] : $_SESSION['cusername'];
         $decide = M('userinfo')->where("username='******'")->select();
         if (!empty($decide)) {
             $table = array();
             foreach ($decide as $key => $val) {
                 $table = $decide[$key];
             }
             //判断是企业or推荐人 1企业用户 0推荐人
             if ($table["flag"] == "0") {
                 $data['url'] = U('Login/userinfo');
                 $data['logout'] = U('Login/logout');
                 $data['savepass'] = U('Login/savepass');
             } else {
                 if ($table["flag"] == "1") {
                     $data['url'] = U('Company/EnterpriseInformation');
                     $data['logout'] = U('Login/logout');
                     $data['savepass'] = U('Login/savepass');
                 }
             }
             $this->assign("data", $data);
         }
     }
 }
Exemplo n.º 4
0
 public function index()
 {
     $this->load->model('account/customer');
     $this->load->language('extension/module/weixin_login');
     $this->document->setTitle($this->language->get('heading_title'));
     $data['text_weixin_login'] = $this->language->get('text_weixin_login');
     if ($this->customer->isLogged()) {
         $data['logged'] = 1;
     } else {
         $data['logged'] = 0;
     }
     if (isset($this->session->data['weixin_login_unionid'])) {
         $data['weixin_login_authorized'] = 1;
     } else {
         $data['weixin_login_authorized'] = 0;
     }
     $this->load->helper('mobile');
     if (is_weixin()) {
         $data['is_weixin'] = 1;
     } else {
         $data['is_weixin'] = 0;
     }
     if (is_mobile()) {
         $data['is_mobile'] = 1;
     } else {
         $data['is_mobile'] = 0;
     }
     $appid = $this->config->get('weixin_login_appid');
     $appkey = $this->config->get('weixin_login_appkey');
     $data['weixin_login'] = $this->url->link('extension/module/weixin_login/login', '', 'SSL');
     $weixin_pclogin_redirect_uri = HTTPS_SERVER . 'index.php?route=extension/module/weixin_login/weixin_pclogin_code';
     $data['wxpclogin_url'] = 'https://open.weixin.qq.com/connect/qrconnect?appid=' . $appid . '&redirect_uri=' . urlencode($weixin_pclogin_redirect_uri) . '&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect';
     return $this->load->view('extension/module/weixin_login', $data);
 }
Exemplo n.º 5
0
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $appkey = $this->config->get('weibo_login_appkey');
         $appsecret = $this->config->get('weibo_login_appsecret');
         $callback_url = $this->url->link('extension/module/weibo_login/callback', '', true);
         $this->load->language('extension/module/weibo_login');
         $data['text_weibo_login'] = $this->language->get('text_weibo_login');
         include_once DIR_SYSTEM . 'library/weibo/saetv2.ex.class.php';
         $o = new SaeTOAuthV2($appkey, $appsecret);
         $data['code_url'] = $o->getAuthorizeURL($callback_url);
         if ($this->customer->isLogged()) {
             $data['logged'] = 1;
         } else {
             $data['logged'] = 0;
         }
         if (isset($this->session->data['weibo_login_access_token']) && isset($this->session->data['weibo_login_uid'])) {
             $data['weibo_login_authorized'] = 1;
         } else {
             $data['weibo_login_authorized'] = 0;
             unset($this->session->data['weibo_login_access_token']);
             unset($this->session->data['weibo_login_uid']);
         }
         $this->load->helper('mobile');
         if (is_weixin()) {
             $data['is_weixin'] = 1;
         } else {
             $data['is_weixin'] = 0;
         }
         return $this->load->view('extension/module/weibo_login', $data);
     }
 }
Exemplo n.º 6
0
 public function getMethod($address, $total)
 {
     $this->load->language('extension/payment/alipay_wap');
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('alipay_wap_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
     if ($this->config->get('alipay_wap_total') > $total) {
         $status = false;
     } elseif (!$this->config->get('alipay_wap_geo_zone_id')) {
         $status = true;
     } elseif ($query->num_rows) {
         $status = true;
     } else {
         $status = false;
     }
     //判断是否移动设备访问
     $this->load->helper('mobile');
     if (is_mobile()) {
         if (is_weixin()) {
             $status = false;
         } else {
             $status = true;
         }
     } else {
         $status = false;
     }
     $currencies = array('CNY');
     if (!in_array(strtoupper($this->session->data['currency']), $currencies)) {
         $status = false;
     }
     $method_data = array();
     if ($status) {
         $method_data = array('code' => 'alipay_wap', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('alipay_wap_sort_order'));
     }
     return $method_data;
 }
Exemplo n.º 7
0
 public function __construct()
 {
     global $_W;
     $this->autoFinishOrders();
     if (is_weixin()) {
         m('member')->checkMember();
     }
 }
 public function __construct()
 {
     if (is_weixin() === true) {
         header('Location: http://m.renrenlie.com/');
     }
     parent::__construct();
     $linkArr = M("friendlink")->where("status=0")->order("orderid desc,id asc")->select();
     $this->assign("linkArr", $linkArr);
 }
Exemplo n.º 9
0
 function get_user_wecha_id_new()
 {
     $rt = $this->action('common', '_get_appid_appsecret');
     if (is_weixin() == false || $rt['is_oauth'] == '0') {
         unset($rt);
         return "";
     }
     unset($rt);
     $t = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('user' . $t);
     $uid = $this->Session->read('User.uid');
     $fn = $cache->fpath(array('0' => $uid));
     if (file_exists($fn) && !$cache->GetClose() && !isset($_GET['code'])) {
         include $fn;
     } else {
         if (!isset($_GET['code'])) {
             $this->action('common', 'get_user_code');
             //授权跳转
         }
         $code = isset($_GET['code']) ? $_GET['code'] : '';
         if (!empty($code)) {
             $rr = $this->action('common', '_get_appid_appsecret');
             $appid = $rr['appid'];
             $appsecret = $rr['appsecret'];
             $access_token = $this->action('common', '_get_access_token');
             $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $appsecret . '&code=' . $code . '&grant_type=authorization_code';
             $con = $this->action('common', 'curlGet', $url);
             $json = json_decode($con);
             if (empty($access_token)) {
                 $access_token = $json->access_token;
             }
             $wecha_id = $json->openid;
             $refresh_token = $json->refresh_token;
             //获取 refresh_token
             if (!empty($refresh_token) && !empty($access_token)) {
                 if (empty($wecha_id)) {
                     $url = 'https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=' . $appid . '&grant_type=refresh_token&refresh_token=' . $refresh_token;
                     $con = $this->action('common', 'curlGet', $url);
                     $json = json_decode($con);
                     $wecha_id = $json->openid;
                     //获取 openid
                 }
             }
         }
         $cache->write($fn, $wecha_id, 'wecha_id');
     }
     return $wecha_id;
 }
Exemplo n.º 10
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->customer->logout();
         unset($this->session->data['shipping_address']);
         unset($this->session->data['shipping_method']);
         unset($this->session->data['shipping_methods']);
         unset($this->session->data['payment_address']);
         unset($this->session->data['payment_method']);
         unset($this->session->data['payment_methods']);
         unset($this->session->data['comment']);
         unset($this->session->data['order_id']);
         unset($this->session->data['coupon']);
         unset($this->session->data['reward']);
         unset($this->session->data['voucher']);
         unset($this->session->data['vouchers']);
         unset($this->session->data['qq_nickname']);
         unset($this->session->data['weixin_login_openid']);
         unset($this->session->data['weixin_login_unionid']);
         unset($this->session->data['weixin_pclogin_openid']);
         unset($this->session->data['weixin_pclogin_unionid']);
         //remember weixin click logout
         $this->load->helper('mobile');
         if (is_weixin()) {
             $this->session->data['weixin_logout_status'] = 1;
         }
         $this->response->redirect($this->url->link('account/logout', '', true));
     }
     $this->load->language('account/logout');
     $this->document->setTitle($this->language->get('heading_title'));
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', true));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_logout'), 'href' => $this->url->link('account/logout', '', true));
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_message'] = $this->language->get('text_message');
     $data['button_continue'] = $this->language->get('button_continue');
     $data['continue'] = $this->url->link('common/home');
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['column_right'] = $this->load->controller('common/column_right');
     $data['content_top'] = $this->load->controller('common/content_top');
     $data['content_bottom'] = $this->load->controller('common/content_bottom');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/success', $data));
 }
Exemplo n.º 11
0
 public function __construct($name = '')
 {
     parent::__construct();
     $this->modulename = 'ewei_shop';
     $this->pluginname = $name;
     $this->loadModel();
     if (strexists($_SERVER['REQUEST_URI'], '/web/')) {
         cpa($this->pluginname);
     } else {
         if (strexists($_SERVER['REQUEST_URI'], '/app/')) {
             if (is_weixin()) {
                 $this->setFooter();
             }
         }
     }
     $this->module['title'] = pdo_fetchcolumn('select title from ' . tablename('modules') . " where name='ewei_shop' limit 1");
 }
Exemplo n.º 12
0
 function _initialize()
 {
     $is_weixin = is_weixin();
     if ($is_weixin) {
         $code = $_REQUEST["code"];
         if (!empty($code)) {
             $this->_welogin($code);
         }
     }
     $auth_id = session(C('USER_AUTH_KEY'));
     if (!isset($auth_id)) {
         //跳转到认证网关
         redirect(U(C('USER_AUTH_GATEWAY')));
     }
     $this->assign('js_file', 'js/' . ACTION_NAME);
     $this->_assign_menu();
     $this->_assign_new_count();
 }
Exemplo n.º 13
0
$php_self = php_self();
////////////////////////////////////
$wap_user = !empty($_SESSION['wap_user']) ? $_SESSION['wap_user'] : array();
//检测分销商是否存在
if (!empty($_SESSION['wap_drp_store']) && $_SESSION['wap_drp_store']['store_id'] != $tmp_store_id) {
    $store_exists = D('Store')->where(array('store_id' => $_SESSION['wap_drp_store']['store_id'], 'status' => 1))->find();
    if (empty($store_exists)) {
        //店铺不存在或已删除
        unset($_SESSION['wap_drp_store']);
        //删除保存在session中分销商
    }
}
/*是否移动端*/
$is_mobile = is_mobile();
/*是否微信端*/
$is_weixin = is_weixin();
//热门关键词
$hot_keyword = D('Search_hot')->where('1')->order('sort DESC')->limit(8)->select();
//合并SESSION和UID的购物车、订单、收货地址等信息
function mergeSessionUserInfo($sessionid, $uid)
{
    //购物车
    D('User_cart')->where(array('uid' => 0, 'session_id' => $sessionid))->data(array('uid' => $uid, 'session_id' => ''))->save();
    //订单
    $edit_rows = D('Order')->where(array('uid' => 0, 'session_id' => $sessionid))->data(array('uid' => $uid, 'session_id' => ''))->save();
    if ($edit_rows && $_COOKIE['wap_store_id']) {
        //分销订单
        D('Fx_order')->where(array('uid' => 0, 'session_id' => $sessionid))->data(array('uid' => $uid, 'session_id' => ''))->save();
        M('Store_user_data')->updateData($_COOKIE['wap_store_id'], $uid);
    }
    //收货地址
Exemplo n.º 14
0
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 15/9/16
 * Time: 下午2:04
 */
include 'library/init.inc.php';
$code = getGET('code');
$log->record_array($_GET);
if ($code != '') {
    $code = $db->escape($code);
    $url = $db->fetchOne('select `url` from ' . $db->table('short_link') . ' where `hash`=\'' . $code . '\'');
    $log->record($url . ',' . $_SERVER['REQUEST_URI']);
    $url = 'http://' . $_SERVER['HTTP_HOST'] . preg_replace('/d\\/[a-zA-Z].*$/', $url, $_SERVER['REQUEST_URI']);
    $log->record('target url:' . $url);
    if (is_weixin() && $_SESSION['openid'] == '') {
        $oathor_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_userinfo&state=2048#wechat_redirect';
        $url = sprintf($oathor_url, $config['appid'], urlencode($url));
        redirect($url);
    } else {
        redirect($url);
    }
    exit;
}
$opera = getPOST('opera');
if ($opera == 'get_url') {
    $response = array('error' => 1, 'msg' => '');
    if (true || !check_cross_domain()) {
        $url = getPOST('url');
        $account = getPOST('account');
        if ($url == '') {
 public function __construct()
 {
     if (is_weixin() === true) {
         header('Location: http://m.renrenlie.com/');
     }
     parent::__construct();
     $linkArr = M("friendlink")->where("status=0")->order("orderid desc,id asc")->select();
     $this->assign("linkArr", $linkArr);
     import('ORG.Util.Page');
     $model2 = M('userinfo', 'stj_', 'DB_CONFIG1');
     $model = M('casclist', 'stj_', 'DB_CONFIG1');
     $model3 = M('member', 'stj_', 'DB_CONFIG1');
     $username = $_SESSION['username'];
     $userinfo = M('member')->where("username='******'")->find();
     $this->userinfo = $userinfo;
     if (!empty($_SESSION['username']) || !empty($_SESSION['cusername'])) {
         $username = $_SESSION['username'] ? $_SESSION['username'] : $_SESSION['cusername'];
         $decide = $model2->where("username='******'")->select();
         if (!empty($decide)) {
             $table = array();
             foreach ($decide as $key => $val) {
                 $table = $decide[$key];
             }
             $cUserInfo = $this->getCompanyInfo();
             //判断基本资料是否填写完整
             if ($cUserInfo['cpname'] && isset($cUserInfo['mobile'])) {
                 $leftNavCompleted['userinfo_completed'] = true;
             } else {
                 $leftNavCompleted['userinfo_completed'] = false;
             }
             //判断合同
             if (isset($cUserInfo['contract']) && $cUserInfo['checkcontract'] == 1) {
                 $leftNavCompleted['contract_completed'] = true;
             } else {
                 $leftNavCompleted['contract_completed'] = false;
             }
             $isJob = M("job")->where("cpid='" . $cUserInfo['id'] . "'")->find();
             if (!empty($isJob)) {
                 $leftNavCompleted['job_completed'] = true;
             } else {
                 $leftNavCompleted['job_completed'] = false;
             }
             $sql = "select r.id from stj_record as r left join stj_job as j on r.j_id=j.id where j.cpid='{$cUserInfo['id']}'";
             $jlist = M("record")->query($sql);
             if (!empty($jlist)) {
                 $leftNavCompleted['record_completed'] = true;
             } else {
                 $leftNavCompleted['record_completed'] = false;
             }
             $this->assign("leftNavCompleted", $leftNavCompleted);
             //判断是企业or推荐人 1企业用户 0推荐人
             if ($table["flag"] == "0") {
                 $data['url'] = U('Login/userinfo');
                 $data['logout'] = U('Login/logout');
                 $data['savepass'] = U('Login/savepass');
             } else {
                 if ($table["flag"] == "1") {
                     $data['url'] = U('Company/EnterpriseInformation');
                     $data['logout'] = U('Login/logout');
                     $data['savepass'] = U('Login/savepass');
                 }
             }
             $this->assign("data", $data);
         }
     } else {
         $this->error("您长时间未操作,已登录超时,若想继续操作,请重新登录!", U('Index/index'));
     }
 }
    function content_5656ce9706c355_65233174($_smarty_tpl)
    {
        ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title><?php 
        echo $_smarty_tpl->tpl_vars['config']->value['site_name'];
        ?>
</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="application-name" content="<?php 
        echo $_smarty_tpl->tpl_vars['config']->value['site_name'];
        ?>
">
    <link rel="apple-touch-icon-precomposed" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/touch/touch-icon-iphone.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/touch/touch-icon-ipad.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/touch/touch-icon-iphone4.png">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="author" content="www.kwanson.com">
    <meta name="version" content="v.1.0.0">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta name="format-detection" content="telephone=no, address=no">
    <link rel="stylesheet" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
css/common.css">
    <link rel="stylesheet" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
css/app.css">
    <link rel="stylesheet" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
css/index.css">
    <link rel="stylesheet" href="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
css/fonts.css">
    <script type="text/javascript" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
js/jquery-1.11.0.min.js"></script>
    <?php 
        if (is_weixin()) {
            ?>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <?php 
        }
        ?>
</head>
<body>

    <!-- 首页头部 -->
    <header class="header">
        <div class="logo">
            <a href="#"><?php 
        echo $_smarty_tpl->tpl_vars['config']->value['site_name'];
        ?>
</a>
        </div>
        <div class="search_box" style="text-align: center">
            <?php 
        echo $_smarty_tpl->tpl_vars['config']->value['site_name'];
        ?>

            <!--
            <a href="#" >
                <div class="search">
                    <form method="get" action="">
                        <div class="text_box">
                            <input id="keyword" name="keyword" type="text" placeholder="搜索商品/店铺" class="keyword text" onkeydown="this.style.color='#404040'" autocomplete="off">
                        </div>
                        <input type="submit" value="" class="submit" dd_name="搜索">
                    </form>
                </div>
            </a>
            -->
        </div>
    </header>


    <!-- 广告轮播区 -->
    <section id="focus" class="focus">
        <div class="hd">
            <ul></ul>
        </div>
        <div class="bd">
            <ul>
                <?php 
        $_smarty_tpl->tpl_vars['ad'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['ad']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['cycle_ad']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['ad']->key => $_smarty_tpl->tpl_vars['ad']->value) {
            $_smarty_tpl->tpl_vars['ad']->_loop = true;
            ?>
                <li><a href="#"><img _src="<?php 
            echo $_smarty_tpl->tpl_vars['ad']->value['img'];
            ?>
" src="<?php 
            echo $_smarty_tpl->tpl_vars['template_dir']->value;
            ?>
images/blank.png" /></a></li>
                <?php 
        }
        ?>
            </ul>
        </div>
    </section>
    <script type="text/javascript" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
js/TouchSlide.1.1.js"></script>
    <script type="text/javascript">
    TouchSlide({
        slideCell:"#focus",
        titCell:".hd ul", //开启自动分页 autoPage:true ,此时设置 titCell 为导航元素包裹层
        mainCell:".bd ul",
        effect:"left",
        autoPlay:true,//自动播放
        autoPage:true, //自动分页
        switchLoad:"_src" //切换加载,真实图片路径为"_src"
    });
    </script>
    <!-- 广告轮播区 end -->

    <!-- 首页公告区 -->
    <section class="index-news clearfix">
        <div class="index-news-l fl">
            <span class="icon">&#xe613;</span>
        </div>
        <div id="myscroll" class="index-news-r">
            <ul id="notice" class="news-title">
                <?php 
        $_smarty_tpl->tpl_vars['content'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['content']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['notice']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['content']->key => $_smarty_tpl->tpl_vars['content']->value) {
            $_smarty_tpl->tpl_vars['content']->_loop = true;
            ?>
                <li><a href="article.php?id=<?php 
            echo $_smarty_tpl->tpl_vars['content']->value['id'];
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['content']->value['title'], ENT_QUOTES, 'UTF-8', true);
            ?>
</a></li>
                <?php 
        }
        ?>
            </ul>
        </div>
    </section>
    <script type="text/javascript" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
js/scrolltext.js"></script>
    <script type="text/javascript">
        var newsHeight = $(".index-news").height();
        if(document.getElementById("notice")){
            var scrollup = new ScrollText("notice");
            scrollup.LineHeight =  (newsHeight ==120)?40:20;//单排文字滚动的高度
            scrollup.Amount = 1;            //注意:子模块(LineHeight)一定要能整除Amount.
            scrollup.Delay = 35;           //延时
            scrollup.Start();             //文字自动滚动
            scrollup.Direction = "down"; //文字向下滚动
        }
    </script>

    <!-- 首页功能区 -->
    <ul class="index-nav">
        <li><a href="reward.php" title="我的奖金"><img class="" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/jifen.png"><span>我的奖金</span></a></li>
        <li><a href="withdraw.php" title="账户提现"><img class="" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/tixian.png"><span>账户提现</span></a></li>
        <li><a href="order.php" title="我的订单"><img class="" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/dingdan.png"><span>我的订单</span></a></li>
        <li><a href="address.php" title="收货地址"><img class="" src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/dizhi.png"><span>收货地址</span></a></li>
    </ul>

    <!-- 商家推荐区 -->
    <section class="floor">
    <h2>
        <a class="title"><i class="icon">&#xe610;</i>商家推荐</a>
    </h2>
    </section>
    <?php 
        $_smarty_tpl->tpl_vars['ad'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['ad']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['perform_ad_4']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['ad']->key => $_smarty_tpl->tpl_vars['ad']->value) {
            $_smarty_tpl->tpl_vars['ad']->_loop = true;
            ?>
    <section class="index-floor">
        <div class="floor-con">
            <a href="<?php 
            echo $_smarty_tpl->tpl_vars['ad']->value['url'];
            ?>
"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ad']->value['img'];
            ?>
" alt="<?php 
            echo $_smarty_tpl->tpl_vars['ad']->value['alt'];
            ?>
" width="100%"></a>
        </div>
    </section>
    <?php 
        }
        ?>

    <div style="height:2.2rem; "></div>


<section class="menu">
    <ul>
        <li><a class="active" href="index.php"><em class="icon">&#xe601;</em><span>首页</span></a></li>
        <li><a href="article_list.php"><em class="icon">&#xe603;</em><span>资讯</span></a></li>
        <li><a href="cart.php"><em class="icon">&#xe602;</em><span>购物车</span></a></li>
        <li><a href="user.php"><em class="icon">&#xe600;</em><span>我</span></a></li>
    </ul>
</section>


<div class="cd-popup" role="alert">
    <div class="cd-popup-container" id="confirm_dialog" style="display: none;">
        <p id="confirm-message"></p>
        <ul class="cd-buttons">
            <li><a id="dialog_confirm_btn" href="javascript:void(0);"></a></li>
            <li><a id="dialog_confirm_cancel" href="javascript:close_operation_dialog('confirm_dialog');"></a></li>
        </ul>
        <a href="javascript:close_operation_dialog('confirm_dialog');" class="cd-popup-close img-replace" id="dialog_confirm_close">X</a>
    </div>

    <div class="cd-popup-container" id="message_dialog" style="display: none;">
        <p id="dialog-message"></p>
        <ul class="cd-buttons">
            <li class="cd-signle-button"><a href="javascript:close_message_dialog();" id="dialog_close_btn">确认</a></li>
        </ul>
        <a href="javascript:close_message_dialog();" class="cd-popup-close img-replace" id="dialog_close">X</a>
    </div>

    <div class="progressbar">
        <img src="<?php 
        echo $_smarty_tpl->tpl_vars['template_dir']->value;
        ?>
images/loading.gif"/>
    </div>
</div>
<script type="text/javascript">
    function show_message_dialog(message) {
        $(".cd-popup").addClass("is-visible");
        $(".progressbar").hide();
        $("#dialog-message").html(message);
        $("#message_dialog").show();
    }

    function close_message_dialog() {
        $(".cd-popup").removeClass("is-visible");
        $("#message_dialog").hide();
    }

    function show_mask() {
        $(".cd-popup").addClass("is-visible");
        $(".progressbar").show();
    }

    function hide_mask() {
        $(".cd-popup").removeClass("is-visible");
        $(".progressbar").hide();
    }

    function show_operation_dialog() {
        $(".cd-popup").addClass("is-visible");
        $(".progressbar").hide();
        $("#confirm_dialog").show();
    }

    function close_operation_dialog() {
        $(".cd-popup").removeClass("is-visible");
        $("#confirm_dialog").hide();
    }
</script>

</body>
</html>
<?php 
    }
Exemplo n.º 17
0
 public function wap_getStore($store_id)
 {
     $store = $this->db->where(array('store_id' => $store_id, 'status' => 1))->find();
     if (!empty($store)) {
         $_SESSION['tmp_store_id'] = $store_id;
         //解决用户访问不同店铺重复授权生成新用户问题
         /*if (empty($_SESSION['wap_user']) && !empty($_COOKIE['uid'])) { //COOKIE中有用户信息
               $tmp_user = M('User')->checkUser(array('uid' => $_COOKIE['uid']));
               if (!empty($tmp_user)) {
                   $_SESSION['wap_user'] = $tmp_user;
                   $tmp_seller = D('Store')->where(array('drp_supplier_id' => $store_id, 'uid' => $_COOKIE['uid'], 'status' => 1))->find();
                   if (!empty($tmp_seller)) {
                       $_SESSION['wap_drp_store'] = $tmp_seller;
                       if (!empty($tmp_seller['oauth_url'])) { //对接微店
                           $_SESSION['sync_user'] = true;
                       }
                   }
                   setcookie('uid', $_COOKIE['uid'], $_SERVER['REQUEST_TIME']+10000000, '/'); //延长cookie有效期
               } else {
                   unset($_SESSION['sync_user']); //删除同步标识
                   unset($_SESSION['wap_user']); //删除用户登录状态
               }
           }*/
         //判断是否为对接微店
         if (!empty($store['oauth_url'])) {
             if (!empty($_SESSION['wap_user']) && $_SESSION['wap_user']['store_id'] != $store_id) {
                 //非当前店铺粉丝,重新授权登陆
                 unset($_SESSION['sync_user']);
                 //删除同步标识
                 unset($_SESSION['wap_user']);
                 //删除用户登录状态
             }
         } else {
             unset($_SESSION['sync_user']);
             //非对接店铺 删除同步标识
         }
         //对接网站用户授权登陆
         //授权条件:非对接同步用户,是对接店铺,店铺管理后台未登录(不加此条件,店铺管理后台的所有链接无法在pc端打开,都会跳转授权)
         if (empty($_SESSION['sync_user']) && !empty($store['oauth_url']) && empty($_SESSION['sync_store'])) {
             $return_url = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             if (!empty($store['oauth_url'])) {
                 if (stripos($store['oauth_url'], '?') === false) {
                     redirect($store['oauth_url'] . '?return_url=' . $return_url . '&store_id=' . $store_id . '&token=' . $store['token']);
                 } else {
                     redirect($store['oauth_url'] . '&return_url=' . $return_url . '&store_id=' . $store_id . '&token=' . $store['token']);
                 }
             }
         } else {
             if (empty($_SESSION['sync_user']) && empty($store['oauth_url']) && empty($_SESSION['store'])) {
                 //默认授权
                 //授权条件:非对接同步用户,非对接店铺,店铺管理后台未登录(不加此条件,店铺管理后台的所有链接无法在pc端打开,都会跳转授权)
                 /*是否移动端*/
                 $is_mobile = is_mobile();
                 /*是否微信端*/
                 $is_weixin = is_weixin();
                 //调试  清除登录信息
                 //setcookie('pigcms_sessionid','',$_SERVER['REQUEST_TIME']-10000000,'/');
                 //$_SESSION = null;
                 //session_destroy();
                 /*如果是微信端,且配置文件中配置了微信信息,得到openid*/
                 if ($is_weixin && (empty($_SESSION['openid']) || empty($_SESSION['wap_user']))) {
                     //openid存在 通过openid查找用户
                     if (!empty($_SESSION['openid'])) {
                         $userinfo = M('User')->get_user('openid', $_SESSION['openid']);
                         $_SESSION['wap_user'] = $userinfo['user'];
                         mergeSessionUserInfo(session_id(), $userinfo['user']['uid']);
                         unset($_SESSION['wap_drp_store']);
                     }
                     //用户未登录 调用授权获取openid, 通过openid查找用户,如果已经存在,设置登录,如果不存在,添加一个新用户和openid关联
                     if (empty($_SESSION['wap_user'])) {
                         $customeUrl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                         //判断店铺是否绑定过认证服务号
                         $wx_bind = D('Weixin_bind')->where(array('store_id' => $store['store_id']))->find();
                         if (empty($_GET['code'])) {
                             $_SESSION['weixin']['state'] = md5(uniqid());
                             if (!empty($wx_bind) && $wx_bind['service_type_info'] == 2 && $wx_bind['verify_type_info'] == 0) {
                                 $oauthUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $wx_bind['authorizer_appid'] . '&redirect_uri=' . urlencode($customeUrl) . '&response_type=code&scope=snsapi_userinfo&state=' . $_SESSION['weixin']['state'] . '&component_appid=' . option('config.wx_appid') . '#wechat_redirect';
                             } else {
                                 //店铺非认证服务号走总后台授权
                                 $oauthUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . option('config.wechat_appid') . '&redirect_uri=' . urlencode($customeUrl) . '&response_type=code&scope=snsapi_userinfo&state=' . $_SESSION['weixin']['state'] . '#wechat_redirect';
                             }
                             redirect($oauthUrl);
                             exit;
                         } else {
                             if (isset($_GET['code']) && isset($_GET['state']) && $_GET['state'] == $_SESSION['weixin']['state']) {
                                 unset($_SESSION['weixin']);
                                 import('Http');
                                 $http = new Http();
                                 if (!empty($wx_bind) && $wx_bind['service_type_info'] == 2 && $wx_bind['verify_type_info'] == 0) {
                                     $component_token = M('Weixin_bind')->get_access_token($store['store_id'], true);
                                     $tokenUrl = 'https://api.weixin.qq.com/sns/oauth2/component/access_token?appid=' . $wx_bind['authorizer_appid'] . '&code=' . $_GET['code'] . '&grant_type=authorization_code&component_appid=' . option('config.wx_appid') . '&component_access_token=' . $component_token;
                                 } else {
                                     $tokenUrl = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . option('config.wechat_appid') . '&secret=' . option('config.wechat_appsecret') . '&code=' . $_GET['code'] . '&grant_type=authorization_code';
                                 }
                                 $return = $http->curlGet($tokenUrl);
                                 $jsonrt = json_decode($return, true);
                                 if ($jsonrt['errcode']) {
                                     $error_msg_class = new GetErrorMsg();
                                     exit('授权发生错误:' . $jsonrt['errcode']);
                                 }
                                 if ($jsonrt['openid']) {
                                     //微信中打开直接登陆
                                     $url = 'https://api.weixin.qq.com/sns/userinfo?access_token=' . $jsonrt['access_token'] . '&openid=' . $jsonrt['openid'] . '&lang=zh_CN';
                                     $wxuser = $http->curlGet($url);
                                     $wxuser = json_decode($wxuser, true);
                                     $_SESSION['openid'] = $jsonrt['openid'];
                                     $userinfo = M('User')->get_user('openid', $_SESSION['openid']);
                                     if (empty($userinfo['user'])) {
                                         //用户不存在,添加新用户,并设置登录
                                         $data = array();
                                         $data['phone'] = '';
                                         $data['nickname'] = $wxuser['nickname'];
                                         $data['openid'] = $_SESSION['openid'];
                                         $data['avatar'] = $wxuser['headimgurl'];
                                         $data['password'] = '';
                                         $data['check_phone'] = 1;
                                         $data['login_count'] = 1;
                                         $add_result = M('User')->add_user($data);
                                         if ($add_result['err_code'] == 0) {
                                             $_SESSION['wap_user'] = $add_result['err_msg'];
                                             $_SESSION['wap_user']['sex'] = $wxuser['sex'];
                                             $_SESSION['wap_user']['province'] = $wxuser['province'];
                                             $_SESSION['wap_user']['city'] = $wxuser['city'];
                                             mergeSessionUserInfo(session_id(), $add_result['err_msg']['uid']);
                                         }
                                     } else {
                                         //用户已存在,设置登录
                                         $_SESSION['wap_user'] = $userinfo['user'];
                                         $_SESSION['wap_user']['sex'] = $wxuser['sex'];
                                         $_SESSION['wap_user']['province'] = $wxuser['province'];
                                         $_SESSION['wap_user']['city'] = $wxuser['city'];
                                         mergeSessionUserInfo(session_id(), $userinfo['user']['uid']);
                                     }
                                     unset($_SESSION['wap_drp_store']);
                                     //删除保存在session中的分销店铺
                                 }
                             }
                         }
                     }
                 }
                 //}
             }
         }
         $store['url'] = option('config.wap_site_url') . '/home.php?id=' . $store['store_id'];
         if (empty($store['logo'])) {
             $store['logo'] = getAttachmentUrl('images/default_shop_2.jpg', false);
         } else {
             if (stripos($store['logo'], 'http://') === false && stripos($store['logo'], 'https://') === false) {
                 $store['logo'] = getAttachmentUrl($store['logo']);
             }
         }
         $store['ucenter_url'] = option('config.wap_site_url') . '/ucenter.php?id=' . $store['store_id'];
         $store['physical_url'] = option('config.wap_site_url') . '/physical.php?id=' . $store['store_id'];
         option('now_store', $store);
     }
     return $store;
 }
Exemplo n.º 18
0
 public function index()
 {
     $wechat_url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"];
     $this->load->helper('mobile');
     if (is_weixin()) {
         if (!$this->customer->isLogged()) {
             if ($this->config->get('weixin_login_status')) {
                 if ($this->config->get('wxpay_status')) {
                     if (isset($this->session->data['weixin_login_openid']) && isset($this->session->data['weixin_login_unionid'])) {
                         if (isset($this->session->data['weixin_logout_status'])) {
                             if ($this->session->data['weixin_logout_status'] == 0) {
                                 if ($this->customer->login_weixin($this->session->data['weixin_login_unionid'])) {
                                     unset($this->session->data['guest']);
                                     // Default Shipping Address
                                     $this->load->model('account/address');
                                     if ($this->config->get('config_tax_customer') == 'payment') {
                                         $this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
                                     }
                                     if ($this->config->get('config_tax_customer') == 'shipping') {
                                         $this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
                                     }
                                 } else {
                                 }
                             }
                         } else {
                             if ($this->customer->login_weixin($this->session->data['weixin_login_unionid'])) {
                                 unset($this->session->data['guest']);
                                 // Default Shipping Address
                                 $this->load->model('account/address');
                                 if ($this->config->get('config_tax_customer') == 'payment') {
                                     $this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
                                 }
                                 if ($this->config->get('config_tax_customer') == 'shipping') {
                                     $this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
                                 }
                                 $this->response->redirect($wechat_url);
                             } else {
                             }
                         }
                     } elseif (isset($this->request->get['code'])) {
                         $appid = $this->config->get('wxpay_appid');
                         $appsecret = $this->config->get('wxpay_appsecret');
                         $openid_result = getOpenid($appid, $appsecret, $this->request->get['code']);
                         $unionid_result = getWeiXinUserInfo($appid, $appsecret, $openid_result['openid']);
                         if ($openid_result && $unionid_result) {
                             $this->session->data['weixin_login_openid'] = $openid_result['openid'];
                             $this->session->data['weixin_openid'] = $openid_result['openid'];
                             $this->session->data['weixin_login_unionid'] = $unionid_result['unionid'];
                         } else {
                             $this->session->data['weixin_login_openid'] = '';
                             $this->session->data['weixin_openid'] = '';
                             $this->session->data['weixin_login_unionid'] = '';
                         }
                         header('Location: ' . $wechat_url);
                     } else {
                         $appid = $this->config->get('wxpay_appid');
                         header('Location: https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $appid . '&redirect_uri=' . $wechat_url . '&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect');
                     }
                 }
             } else {
                 //if weixin login disabled
                 if ($this->config->get('wxpay_status')) {
                     if (isset($this->session->data['weixin_login_openid'])) {
                     } elseif (isset($this->request->get['code'])) {
                         $appid = $this->config->get('wxpay_appid');
                         $appsecret = $this->config->get('wxpay_appsecret');
                         $openid_result = getOpenid($appid, $appsecret, $this->request->get['code']);
                         $this->session->data['weixin_login_openid'] = '';
                         $this->session->data['weixin_openid'] = $openid_result['openid'];
                         $this->session->data['weixin_login_unionid'] = '';
                     } else {
                         $appid = $this->config->get('wxpay_appid');
                         header('Location: https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $appid . '&redirect_uri=' . $wechat_url . '&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect');
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 19
0
 function user_auto_login()
 {
     $rt = $this->_get_appid_appsecret();
     if (is_weixin() == false || $rt['is_oauth'] == '0') {
         return;
     }
     //一下用于测试
     /*		if($GLOBALS['LANG']['is_cache']=='1'&&!isset($_GET['code'])){
     			session_destroy();
     			$this->Session->write('User',null);
     			//$this->Session->write('Agent',null);
     			setcookie(CFGH.'USER[TOOPENID]', "", mktime()-3600);
     			setcookie(CFGH.'USER[UKEY]', "", mktime()-3600);
     			setcookie(CFGH.'USER[PASS]', "", mktime()-3600);
     			setcookie(CFGH.'USER[TID]', "", mktime()-3600);
     			setcookie(CFGH.'USER[CODETIME]', "", mktime()-3600);
     			setcookie(CFGH.'USER[ISOAUTH]', "", mktime()-3600);
     			setcookie(CFGH.'USER[APPID]', "", mktime()-3600);
     			setcookie(CFGH.'USER[APPSECRET]', "", mktime()-3600);
     			die('这是测试阶段,缓存已经清空完成....');
     		}*/
     //授权判断
     $wecha_id = $this->Session->read('User.wecha_id');
     if (empty($wecha_id)) {
         $wecha_id = isset($_COOKIE[CFGH . 'USER']['UKEY']) ? $_COOKIE[CFGH . 'USER']['UKEY'] : '';
     }
     $appid = $rt['appid'];
     $appsecret = $rt['appsecret'];
     $codetime = $this->Session->read('User.codetime');
     if (empty($codetime)) {
         $codetime = isset($_COOKIE[CFGH . 'USER']['CODETIME']) ? $_COOKIE[CFGH . 'USER']['CODETIME'] : 0;
     }
     if (empty($appid) || empty($appsecret)) {
         $sql = "SELECT appid,appsecret,is_oauth,winxintype FROM `{$this->App->prefix()}wxuserset` WHERE id='1'";
         $rt = $this->App->findrow($sql);
         $appid = $rt['appid'];
         $appsecret = $rt['appsecret'];
         $this->Session->write('User.isoauth', $rt['is_oauth']);
         setcookie(CFGH . 'USER[ISOAUTH]', $rt['is_oauth'], mktime() + 3600 * 24);
     }
     if (empty($rt['is_oauth'])) {
         $rt['is_oauth'] = '1';
     }
     if (empty($rt['winxintype'])) {
         $rt['winxintype'] = '3';
     }
     //授权获取用户openid
     //if( (empty($wecha_id) || ((mktime() - intval($codetime)) > 10)) && $rt['is_oauth']=='1' && $rt['winxintype']=='3' ){
     if (empty($wecha_id) && $rt['winxintype'] == '3') {
         //echo "run................1";
         if (!isset($_GET['code'])) {
             $this->get_user_code();
             //授权跳转
         }
         $code = isset($_GET['code']) ? $_GET['code'] : '';
         if (!empty($code)) {
             $access_token = $this->_get_access_token();
             $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $appsecret . '&code=' . $code . '&grant_type=authorization_code';
             $con = $this->curlGet($url);
             if (!empty($con)) {
                 $json = json_decode($con);
                 if (empty($access_token)) {
                     $access_token = $json->access_token;
                 }
                 $wecha_id = $json->openid;
                 $refresh_token = $json->refresh_token;
                 //获取 refresh_token
                 if (!empty($refresh_token) && !empty($access_token)) {
                     if (empty($wecha_id)) {
                         $url = 'https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=' . $appid . '&grant_type=refresh_token&refresh_token=' . $refresh_token;
                         $con = $this->curlGet($url);
                         $json = json_decode($con);
                         $wecha_id = $json->openid;
                         //获取 openid
                     }
                     $this->Session->write('User.wecha_id', $wecha_id);
                     setcookie(CFGH . 'USER[UKEY]', $wecha_id, mktime() + 2592000);
                     //获取缓存信息
                     $userinfo = $this->get_user_wecha_id_info($wecha_id);
                     if (empty($userinfo) || empty($userinfo['nickname']) || empty($userinfo['city']) || empty($userinfo['province']) || empty($userinfo['headimgurl'])) {
                         //获取用户信息
                         $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $access_token . '&openid=' . $wecha_id . '&lang=zh_CN';
                         $con = $this->curlGet($url);
                         if (!empty($con)) {
                             $json = json_decode($con);
                             $subscribe = $json->subscribe;
                             if ($subscribe == '1') {
                                 $this->Session->write('User.nickname', isset($json->nickname) ? $json->nickname : '');
                                 $this->Session->write('User.sex', isset($json->sex) ? $json->sex : '');
                                 $this->Session->write('User.city', isset($json->city) ? $json->city : '');
                                 $this->Session->write('User.province', isset($json->province) ? $json->province : '');
                                 $this->Session->write('User.headimgurl', isset($json->headimgurl) ? $json->headimgurl : '');
                                 $this->Session->write('User.subscribe_time', isset($json->subscribe_time) ? $json->subscribe_time : '');
                                 $nickname = $this->Session->read('User.nickname');
                                 $sex = $this->Session->read('User.sex');
                                 $city = $this->Session->read('User.city');
                                 $province = $this->Session->read('User.province');
                                 $headimgurl = $this->Session->read('User.headimgurl');
                                 $subscribe_time = $this->Session->read('User.subscribe_time');
                                 if (!empty($wecha_id)) {
                                     $sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1";
                                     $uid = $this->App->findvar($sql);
                                     if ($uid > 0) {
                                         $ddl = array();
                                         if (!empty($nickname)) {
                                             $ddl['nickname'] = $nickname;
                                         }
                                         if (!empty($city)) {
                                             $ddl['cityname'] = $city;
                                         }
                                         if (!empty($province)) {
                                             $ddl['provincename'] = $province;
                                         }
                                         if (!empty($headimgurl)) {
                                             $ddl['headimgurl'] = $headimgurl;
                                         }
                                         if ($sex > 0) {
                                             $ddl['sex'] = $sex;
                                         }
                                         if (!empty($ddl)) {
                                             $this->App->update('user', $ddl, 'user_id', $uid);
                                             $this->Session->write('User.uid', $uid);
                                             setcookie(CFGH . 'USER[UID]', $uid, mktime() + 2592000);
                                         }
                                     }
                                 } else {
                                     //写入日记,获取openid为空
                                 }
                             }
                             $this->Session->write('User.subscribe', $subscribe);
                             setcookie(CFGH . 'USER[SUBSCRIBE]', $subscribe, mktime() + 2592000);
                         }
                     }
                 } else {
                     die("非法错误:获取refresh_token或者access_token为空,麻烦联系网站管理员解决,谢谢!");
                 }
             }
         } else {
             die("非法错误:获取code码为空,麻烦联系网站管理员解决,谢谢!");
         }
     }
     $uid = $this->Session->read('User.uid');
     if (empty($wecha_id)) {
         $wecha_id = isset($_COOKIE[CFGH . 'USER']['UKEY']) ? $_COOKIE[CFGH . 'USER']['UKEY'] : '';
         if (empty($wecha_id)) {
             if ($uid > 0) {
                 $sql = "SELECT wecha_id FROM `{$this->App->prefix()}user` WHERE user_id ='{$uid}' LIMIT 1";
                 $wecha_id = $this->App->findvar($sql);
                 if (!empty($wecha_id)) {
                     $this->Session->write('User.wecha_id', $wecha_id);
                     setcookie(CFGH . 'USER[UKEY]', $wecha_id, mktime() + 2592000);
                 }
             }
         } else {
             $this->Session->write('User.wecha_id', $wecha_id);
         }
     }
     //双重记录UID
     if (!($uid > 0)) {
         $uid = isset($_COOKIE[CFGH . 'USER']['UID']) ? $_COOKIE[CFGH . 'USER']['UID'] : '0';
         if ($uid > 0) {
             $this->Session->write('User.uid', $uid);
         } else {
             if (!empty($wecha_id)) {
                 $sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id ='{$wecha_id}' LIMIT 1";
                 $uid = $this->App->findvar($sql);
                 if ($uid > 0) {
                     $this->Session->write('User.uid', $uid);
                     setcookie(CFGH . 'USER[UID]', $uid, mktime() + 2592000);
                 } else {
                     //die("非法错误:初始化账户失败,麻烦联系网站管理员解决,谢谢!");
                 }
             }
         }
     }
     $tid = 0;
     if (!($uid > 0)) {
         $tid = isset($_GET['tid']) ? intval($_GET['tid']) : '0';
         //用户入来的id
         if (empty($tid)) {
             $tid = isset($_COOKIE[CFGH . 'USER']['TID']) ? $_COOKIE[CFGH . 'USER']['TID'] : '';
         }
         if (!($tid > 0)) {
             $tid = $this->Session->read('User.tid');
         }
     } else {
         //清空
         $this->Session->write('User.tid', null);
         setcookie(CFGH . 'USER[TID]', '', mktime() - 2592000);
     }
     $toid = 0;
     $userinfo = $this->get_user_wecha_id_info($wecha_id, 1);
     $is_subscribe = isset($userinfo['is_subscribe']) ? $userinfo['is_subscribe'] : '0';
     if ($is_subscribe == '0') {
         $toid = isset($_GET['toid']) ? intval($_GET['toid']) : '0';
         //这个是关注后转发的用户ID
         if (empty($toid)) {
             $toid = isset($_COOKIE[CFGH . 'USER']['TOOPENID']) ? $_COOKIE[CFGH . 'USER']['TOOPENID'] : '';
         }
         if (!($toid > 0)) {
             $toid = $this->Session->read('User.to_wecha_id');
         }
         if ($toid > 0) {
             //从新记录TID
             setcookie(CFGH . 'USER[TOOPENID]', $toid, mktime() + 2592000);
             $this->Session->write('User.to_wecha_id', $toid);
         }
     } else {
         //清空
         $this->Session->write('User.to_wecha_id', null);
         setcookie(CFGH . 'USER[TOOPENID]', '', mktime() - 2592000);
     }
     //以后数据量大可去掉,前期方便调试
     /*		if($uid > 0){
     			$sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE user_id ='$uid' LIMIT 1";
     			$uid = $this->App->findvar($sql);
     		}*/
     //不是第一次进入
     if ($uid > 0) {
         //不做处理
     } else {
         //第一次进来或者已经超过缓存期
         if (empty($wecha_id)) {
             $wecha_id = $this->Session->read('User.wecha_id');
             if (empty($wecha_id)) {
                 $wecha_id = isset($_COOKIE[CFGH . 'USER']['UKEY']) ? $_COOKIE[CFGH . 'USER']['UKEY'] : '';
                 if (empty($wecha_id)) {
                     if ($rt['is_oauth'] == '1') {
                         die("非法错误:获取微信用户openid为空,麻烦联系网站管理员解决,谢谢!");
                     }
                 }
             }
         }
         $sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id ='{$wecha_id}' ORDER BY user_id ASC LIMIT 1";
         $uid = $this->App->findvar($sql);
         if ($uid > 0) {
             //暂不做处理
         } else {
             //end if uid
             $rrL = $this->get_userconfig();
             //重新创建账号
             $thisurl = $this->Session->read('User.url');
             //记录当前进入连接
             if (empty($thisurl)) {
                 $thisurl = isset($_COOKIE[CFGH . 'USER']['URL']) ? $_COOKIE[CFGH . 'USER']['URL'] : '0';
             }
             if (empty($nickname)) {
                 $nickname = $this->Session->read('User.nickname');
             }
             if (empty($sex)) {
                 $sex = $this->Session->read('User.sex');
             }
             if (empty($city)) {
                 $city = $this->Session->read('User.city');
             }
             if (empty($province)) {
                 $province = $this->Session->read('User.province');
             }
             if (empty($headimgurl)) {
                 $headimgurl = $this->Session->read('User.headimgurl');
             }
             if (empty($subscribe_time)) {
                 $subscribe_time = $this->Session->read('User.subscribe_time');
             }
             $datas = array();
             if (!empty($nickname)) {
                 $datas['nickname'] = $nickname;
             }
             if (!empty($city)) {
                 $datas['cityname'] = $city;
             }
             if (!empty($province)) {
                 $datas['provincename'] = $province;
             }
             if (!empty($headimgurl)) {
                 $datas['headimgurl'] = $headimgurl;
             }
             if ($sex > 0) {
                 $datas['sex'] = $sex;
             }
             $datas['user_name'] = !empty($wecha_id) ? $wecha_id : 'GZSH' . $tid . mktime();
             $datas['wecha_id'] = $datas['user_name'];
             $t = mktime();
             $datas['password'] = md5('A123456');
             //自动开通代理
             if ($rrL['openfxauto'] == '1') {
                 $datas['user_rank'] = 12;
                 //普通分销商
             } else {
                 $datas['user_rank'] = 1;
             }
             $ip = Import::basic()->getip();
             $datas['reg_ip'] = $ip ? $ip : '0.0.0.0';
             $datas['reg_time'] = $t;
             $datas['reg_from'] = Import::ip()->ipCity($ip);
             $datas['last_login'] = mktime();
             $datas['last_ip'] = $datas['reg_ip'];
             $datas['active'] = 1;
             $issubscribe = $this->Session->read('User.subscribe');
             if (empty($issubscribe)) {
                 $issubscribe = isset($_COOKIE[CFGH . 'USER']['SUBSCRIBE']) ? $_COOKIE[CFGH . 'USER']['SUBSCRIBE'] : '0';
             }
             if ($issubscribe == '1') {
                 $datas['is_subscribe'] = 1;
             }
             $uid = $this->Session->read('User.uid');
             if ($uid > 0) {
                 return true;
             }
             if ($this->App->insert('user', $datas)) {
                 //添加账户
                 $uid = $this->App->iid();
                 $this->Session->write('User.uid', $uid);
                 if ($tid != $uid) {
                     //加入分享表
                     $dd = array();
                     $dd['share_uid'] = $tid;
                     //分享者uid
                     $dd['parent_uid'] = $toid > 0 ? $toid : $tid;
                     //关注者分享ID
                     $dd['uid'] = $uid;
                     $puid = $dd['parent_uid'];
                     $duid = 0;
                     if ($puid > 0) {
                         //检查是否是代理
                         $rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '{$puid}' LIMIT 1");
                         if ($rank != '1') {
                             $duid = $puid;
                         } else {
                             //检查推荐的代理ID
                             /*+++++++++++++++++++++++++++++++++++++++++++=*/
                             $ds = $this->App->findvar("SELECT daili_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '{$puid}' LIMIT 1");
                             if ($ds > 0) {
                                 $rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '{$ds}' LIMIT 1");
                                 if ($rank != '1') {
                                     $duid = $ds;
                                 } else {
                                     $ds = $this->App->findvar("SELECT share_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '{$ds}' LIMIT 1");
                                     if ($ds > 0) {
                                         $rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '{$ds}' LIMIT 1");
                                         if ($rank != '1') {
                                             $duid = $ds;
                                         }
                                     }
                                 }
                             } else {
                                 $ds = $this->App->findvar("SELECT share_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '{$puid}' LIMIT 1");
                                 if ($ds > 0) {
                                     $rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '{$ds}' LIMIT 1");
                                     if ($rank != '1') {
                                         $duid = $ds;
                                     } else {
                                         $ds = $this->App->findvar("SELECT daili_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '{$ds}' LIMIT 1");
                                         if ($ds > 0) {
                                             $rank = $this->App->findvar("SELECT user_rank FROM `{$this->App->prefix()}user` WHERE user_id = '{$ds}' LIMIT 1");
                                             if ($rank != '1') {
                                                 $duid = $ds;
                                             }
                                         }
                                     }
                                 }
                             }
                             //end if
                             /*+++++++++++++++++++++++++++++++++++++++++++=*/
                         }
                     }
                     $dd['daili_uid'] = $duid;
                     $dd['url'] = $thisurl;
                     $dd['addtime'] = mktime();
                     if ($this->App->insert('user_tuijian', $dd)) {
                         //添加推荐用户
                         //统计分享 跟 关注数
                         if ($issubscribe == '1') {
                             //当前用户关注了的
                             if ($dd['parent_uid'] == $dd['share_uid'] && $dd['share_uid'] > 0) {
                                 $sql = "UPDATE `{$this->App->prefix()}user` SET `share_ucount` = `share_ucount`+1,`guanzhu_ucount` = `guanzhu_ucount`+1 WHERE user_id = '{$tid}'";
                                 $this->App->query($sql);
                             } else {
                                 if ($dd['parent_uid'] > 0) {
                                     $id = $dd['parent_uid'];
                                     $sql = "UPDATE `{$this->App->prefix()}user` SET `guanzhu_ucount` = `guanzhu_ucount`+1 WHERE user_id = '{$id}' AND is_subscribe='1'";
                                     $this->App->query($sql);
                                 }
                                 if ($dd['share_uid'] > 0) {
                                     $id = $dd['share_uid'];
                                     $sql = "UPDATE `{$this->App->prefix()}user` SET `share_ucount` = `share_ucount`+1 WHERE user_id = '{$id}'";
                                     $this->App->query($sql);
                                 }
                             }
                         } else {
                             //统计分享用户数
                             if ($dd['share_uid'] > 0) {
                                 $id = $dd['share_uid'];
                                 $sql = "UPDATE `{$this->App->prefix()}user` SET `share_ucount` = `share_ucount`+1 WHERE user_id = '{$id}'";
                                 $this->App->query($sql);
                             }
                         }
                         //end if subscribe
                         if ($tid > 0) {
                             //发送推荐用户通知
                             $pwecha_id = $this->App->findvar("SELECT wecha_id FROM `{$this->App->prefix()}user` WHERE user_id='{$tid}' LIMIT 1");
                             $rr = $this->_get_appid_appsecret();
                             $appid = $rr['appid'];
                             $appsecret = $rr['appsecret'];
                             $na = !empty($nickname) ? $nickname : '(UID:' . $uid . ')';
                             //推荐用户
                             $this->action('api', 'send', array('openid' => $pwecha_id, 'appid' => $appid, 'appsecret' => $appsecret, 'nickname' => $na), 'share');
                             //代理用户
                             if ($duid > 0 && $duid != $tid) {
                                 $pwecha_id = $this->App->findvar("SELECT wecha_id FROM `{$this->App->prefix()}user` WHERE user_id='{$duid}' LIMIT 1");
                                 $this->action('api', 'send', array('openid' => $pwecha_id, 'appid' => $appid, 'appsecret' => $appsecret, 'nickname' => $na), 'sharedaili');
                             }
                         }
                     }
                     unset($dd);
                 }
                 //添加地址
                 if (!empty($city) && !empty($province)) {
                     $sql = "SELECT region_id FROM `{$this->App->prefix()}region` WHERE region_name LIKE '%{$city}%' LIMIT 1";
                     $cityid = $this->App->findvar($sql);
                     $sql = "SELECT region_id FROM `{$this->App->prefix()}region` WHERE region_name LIKE '%{$province}%' LIMIT 1";
                     $provinceid = $this->App->findvar($sql);
                     if ($cityid > 0 && $provinceid > 0) {
                         $dd = array();
                         $dd['consignee'] = $nickname;
                         $dd['user_id'] = $uid;
                         $dd['sex'] = $sex;
                         $dd['city'] = $cityid;
                         $dd['province'] = $provinceid;
                         $dd['country'] = 1;
                         $dd['is_own'] = 1;
                         $this->App->insert('user_address', $dd);
                         unset($dd);
                     }
                 }
                 $this->Session->write('User.username', $datas['user_name']);
                 $this->Session->write('User.uid', $uid);
                 $this->Session->write('User.active', '1');
                 $this->Session->write('User.rank', '1');
                 $this->Session->write('User.ukey', $datas['wecha_id']);
                 $this->Session->write('User.addtime', mktime());
                 //写入cookie
                 setcookie(CFGH . 'USER[UKEY]', $datas['wecha_id'], mktime() + 2592000);
                 setcookie(CFGH . 'USER[UID]', $uid, mktime() + 2592000);
                 //开通分销
                 if ($rrL['openfxauto'] == '1') {
                     $dd = array();
                     $ss = array();
                     $ss[] = $uid;
                     $dd['uid'] = $uid;
                     $dd['p1_uid'] = 0;
                     $dd['p2_uid'] = 0;
                     $dd['p3_uid'] = 0;
                     $p1_uid = $this->return_daili_uid($uid);
                     if ($p1_uid > 0 && !in_array($p1_uid, $ss)) {
                         $dd['p1_uid'] = $p1_uid;
                         $p2_uid = $this->return_daili_uid($p1_uid);
                         $ss[] = $p1_uid;
                         $ss[] = $uid;
                         if ($p2_uid > 0 && !in_array($p2_uid, $ss)) {
                             $dd['p2_uid'] = $p2_uid;
                             $p3_uid = $this->return_daili_uid($p2_uid);
                             $ss[] = $p2_uid;
                             if ($p3_uid > 0 && !in_array($p3_uid, $ss)) {
                                 $dd['p3_uid'] = $p3_uid;
                             }
                         }
                     }
                     //
                     $sql = "SELECT id FROM `{$this->App->prefix()}user_tuijian_fx` WHERE uid='{$uid}' LIMIT 1";
                     $id = $this->App->findvar($sql);
                     if ($id > 0) {
                         $this->App->update('user_tuijian_fx', $dd, 'id', $id);
                     } else {
                         $this->App->insert('user_tuijian_fx', $dd);
                     }
                     //////////
                 }
             } else {
                 die('初始化帐号失败,请联系管理员解决这个问题,谢谢!');
             }
             //end if insert
         }
         /******************************************/
     }
     //end if
 }
Exemplo n.º 20
0
//用户id
$day = date("Y-m-d", time());
$long = $_SERVER["HTTP_REFERER"];
$ip = GetIP();
$_ip = explode('.', $ip);
$ip2 = $_ip[0] . '.' . $_ip[1];
//2段ip
$ip3 = $_ip[0] . '.' . $_ip[1] . '.' . $_ip[2];
//3段ip
//访问限制
if ($config['fangwen'] == 1) {
    if (is_mobile() == false) {
        exit('仅限手机访问');
    }
} elseif ($config['fangwen'] == 2) {
    if (is_weixin() == false) {
        exit('仅限微信访问');
    }
} else {
}
if (is_numeric($aid)) {
    $row = $mysql->query("select * from `article` where `id` in({$aid}) limit 1");
    $row_type = $mysql->query("select name from `typedata` where id=" . $row[0]['type']);
    if ($row) {
        $data = $row[0];
        $顶部广告 = $mysql->query("select * from `addata` where `ad_type`='顶部广告' and `ad_list`='" . $row_type[0]['name'] . "' limit 1");
        //广告
        $底部广告 = $mysql->query("select * from `addata` where `ad_type`='底部广告' and `ad_list`='" . $row_type[0]['name'] . "' limit 1");
        //广告
        $统计代码 = $mysql->query("select * from `addata` where `ad_type`='统计代码' and `ad_list`='" . $row_type[0]['name'] . "' limit 1");
        //广告
Exemplo n.º 21
0
    }
    return false;
}
function get_device_type()
{
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = 'other';
    if (strpos($agent, 'iphone') || strpos($agent, 'ipad')) {
        $type = 'ios';
    }
    if (strpos($agent, 'android')) {
        $type = 'android';
    }
    return $type;
}
$iswx = is_weixin();
$devicetype = 'android';
if (get_device_type() == 'ios') {
    $devicetype = 'ios';
}
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<title>红圈营销</title>
	<meta http-equiv="pragram" content="no-cache">
        <meta content="user-scalable=0;" name="viewport" />
        <meta name="apple-itunes-app" content="app-id=967499300" />
	<style>
		body{
Exemplo n.º 22
0
<?php

require_once "../include/define.php";
if (is_weixin()) {
    echo file_get_contents('recommend.html');
} else {
    header("Location: http://shop114244839.taobao.com/");
}
Exemplo n.º 23
0
 public function index()
 {
     $this->load->language('common/footer');
     $data['scripts'] = $this->document->getScripts('footer');
     $data['text_information'] = $this->language->get('text_information');
     $data['text_service'] = $this->language->get('text_service');
     $data['text_extra'] = $this->language->get('text_extra');
     $data['text_contact'] = $this->language->get('text_contact');
     $data['text_return'] = $this->language->get('text_return');
     $data['text_sitemap'] = $this->language->get('text_sitemap');
     $data['text_manufacturer'] = $this->language->get('text_manufacturer');
     $data['text_voucher'] = $this->language->get('text_voucher');
     $data['text_affiliate'] = $this->language->get('text_affiliate');
     $data['text_special'] = $this->language->get('text_special');
     $data['text_account'] = $this->language->get('text_account');
     $data['text_order'] = $this->language->get('text_order');
     $data['text_wishlist'] = $this->language->get('text_wishlist');
     $data['text_newsletter'] = $this->language->get('text_newsletter');
     $this->load->model('catalog/information');
     $data['informations'] = array();
     foreach ($this->model_catalog_information->getInformations() as $result) {
         if ($result['bottom']) {
             $data['informations'][] = array('title' => $result['title'], 'href' => $this->url->link('information/information', 'information_id=' . $result['information_id']));
         }
     }
     $data['contact'] = $this->url->link('information/contact');
     $data['return'] = $this->url->link('account/return/add', '', true);
     $data['sitemap'] = $this->url->link('information/sitemap');
     $data['manufacturer'] = $this->url->link('product/manufacturer');
     $data['voucher'] = $this->url->link('account/voucher', '', true);
     $data['affiliate'] = $this->url->link('affiliate/account', '', true);
     $data['special'] = $this->url->link('product/special');
     $data['account'] = $this->url->link('account/account', '', true);
     $data['order'] = $this->url->link('account/order', '', true);
     $data['wishlist'] = $this->url->link('account/wishlist', '', true);
     $data['newsletter'] = $this->url->link('account/newsletter', '', true);
     $data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
     $data['miit'] = $this->config->get('config_miit');
     //Mobile & Weixin
     $this->load->helper('mobile');
     if (is_mobile()) {
         $data['is_mobile'] = 1;
         if (is_weixin()) {
             $data['is_weixin'] = 1;
         } else {
             $data['is_weixin'] = 0;
         }
     } else {
         $data['is_mobile'] = 0;
         $data['is_weixin'] = 0;
     }
     // Whos Online
     if ($this->config->get('config_customer_online')) {
         $this->load->model('tool/online');
         if (isset($this->request->server['REMOTE_ADDR'])) {
             $ip = $this->request->server['REMOTE_ADDR'];
         } else {
             $ip = '';
         }
         if (isset($this->request->server['HTTP_HOST']) && isset($this->request->server['REQUEST_URI'])) {
             $url = 'http://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
         } else {
             $url = '';
         }
         if (isset($this->request->server['HTTP_REFERER'])) {
             $referer = $this->request->server['HTTP_REFERER'];
         } else {
             $referer = '';
         }
         $this->model_tool_online->addOnline($ip, $this->customer->getId(), $url, $referer);
     }
     return $this->load->view('common/footer', $data);
 }
Exemplo n.º 24
0
function from_to_weixin()
{
    if (is_weixin() === false) {
        if (is_mobile_request() === false) {
            //                        header('Location: http://www.renrenlie.com/');
            //                        die;
        }
    }
}
Exemplo n.º 25
0
 public function index()
 {
     // Analytics
     $this->load->model('extension/extension');
     $data['analytics'] = array();
     $analytics = $this->model_extension_extension->getExtensions('analytics');
     foreach ($analytics as $analytic) {
         if ($this->config->get($analytic['code'] . '_status')) {
             $data['analytics'][] = $this->load->controller('extension/analytics/' . $analytic['code'], $this->config->get($analytic['code'] . '_status'));
         }
     }
     if ($this->request->server['HTTPS']) {
         $server = $this->config->get('config_ssl');
     } else {
         $server = $this->config->get('config_url');
     }
     if (is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
         $this->document->addLink($server . 'image/' . $this->config->get('config_icon'), 'icon');
     }
     $data['title'] = $this->document->getTitle();
     $data['base'] = $server;
     $data['description'] = $this->document->getDescription();
     $data['keywords'] = $this->document->getKeywords();
     $data['links'] = $this->document->getLinks();
     $data['styles'] = $this->document->getStyles();
     $data['scripts'] = $this->document->getScripts();
     $data['lang'] = $this->language->get('code');
     $data['direction'] = $this->language->get('direction');
     $data['name'] = $this->config->get('config_name');
     if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
         $data['logo'] = $server . 'image/' . $this->config->get('config_logo');
     } else {
         $data['logo'] = '';
     }
     $this->load->language('common/header');
     $data['text_home'] = $this->language->get('text_home');
     // Wishlist
     if ($this->customer->isLogged()) {
         $this->load->model('account/wishlist');
         $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist());
     } else {
         $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0);
     }
     $data['text_shopping_cart'] = $this->language->get('text_shopping_cart');
     $data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFullName(), $this->url->link('account/logout', '', true));
     $data['text_account'] = $this->language->get('text_account');
     $data['text_register'] = $this->language->get('text_register');
     $data['text_login'] = $this->language->get('text_login');
     $data['text_order'] = $this->language->get('text_order');
     $data['text_transaction'] = $this->language->get('text_transaction');
     $data['text_download'] = $this->language->get('text_download');
     $data['text_logout'] = $this->language->get('text_logout');
     $data['text_checkout'] = $this->language->get('text_checkout');
     $data['text_category'] = $this->language->get('text_category');
     $data['text_all'] = $this->language->get('text_all');
     $data['text_blog'] = $this->language->get('text_blog');
     $data['text_press'] = $this->language->get('text_press');
     $data['text_faq'] = $this->language->get('text_faq');
     $data['home'] = $this->url->link('common/home');
     $data['wishlist'] = $this->url->link('account/wishlist', '', true);
     $data['logged'] = $this->customer->isLogged();
     $data['account'] = $this->url->link('account/account', '', true);
     $data['register'] = $this->url->link('account/register', '', true);
     $data['login'] = $this->url->link('account/login', '', true);
     $data['order'] = $this->url->link('account/order', '', true);
     $data['transaction'] = $this->url->link('account/transaction', '', true);
     $data['download'] = $this->url->link('account/download', '', true);
     $data['logout'] = $this->url->link('account/logout', '', true);
     $data['shopping_cart'] = $this->url->link('checkout/cart');
     $data['checkout'] = $this->url->link('checkout/checkout', '', true);
     $data['contact'] = $this->url->link('information/contact');
     $data['telephone'] = $this->config->get('config_telephone');
     $data['blog'] = $this->url->link('blog/all');
     $data['press'] = $this->url->link('press/all');
     $data['faq'] = $this->url->link('faq/faq');
     //Mobile & Weixin
     $this->load->helper('mobile');
     if (is_mobile()) {
         $data['is_mobile'] = 1;
         if (is_weixin()) {
             $data['is_weixin'] = 1;
         } else {
             $data['is_weixin'] = 0;
         }
     } else {
         $data['is_mobile'] = 0;
         $data['is_weixin'] = 0;
     }
     //qq nickname for check and approve
     if (isset($this->session->data['qq_nickname'])) {
         $data['qq_nickname'] = $this->session->data['qq_nickname'];
     } else {
         $data['qq_nickname'] = '';
     }
     $data['qq_login_url'] = $this->url->link('extension/module/qq_login/login', '', true);
     // Menu
     $this->load->model('catalog/category');
     $this->load->model('catalog/product');
     $data['categories'] = array();
     $categories = $this->model_catalog_category->getCategories(0);
     foreach ($categories as $category) {
         if ($category['top']) {
             // Level 2
             $children_data = array();
             $children = $this->model_catalog_category->getCategories($category['category_id']);
             foreach ($children as $child) {
                 $filter_data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true);
                 $children_data[] = array('name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']));
             }
             // Level 1
             $data['categories'][] = array('name' => $category['name'], 'children' => $children_data, 'column' => $category['column'] ? $category['column'] : 1, 'href' => $this->url->link('product/category', 'path=' . $category['category_id']));
         }
     }
     $data['language'] = $this->load->controller('common/language');
     $data['currency'] = $this->load->controller('common/currency');
     $data['search'] = $this->load->controller('common/search');
     $data['cart'] = $this->load->controller('common/cart');
     // For page specific css
     if (isset($this->request->get['route'])) {
         if (isset($this->request->get['product_id'])) {
             $class = '-' . $this->request->get['product_id'];
         } elseif (isset($this->request->get['path'])) {
             $class = '-' . $this->request->get['path'];
         } elseif (isset($this->request->get['manufacturer_id'])) {
             $class = '-' . $this->request->get['manufacturer_id'];
         } elseif (isset($this->request->get['information_id'])) {
             $class = '-' . $this->request->get['information_id'];
         } else {
             $class = '';
         }
         $data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
     } else {
         $data['class'] = 'common-home';
     }
     return $this->load->view('common/header', $data);
 }
Exemplo n.º 26
0
 public function index()
 {
     // Validate cart has products and has stock.
     if (!$this->cart->hasProducts() && empty($this->session->data['vouchers']) || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $this->response->redirect($this->url->link('checkout/cart'));
     }
     //判断是否微信访问,是否获得了微信openid
     $this->load->helper('mobile');
     unset($this->session->data['redirect']);
     //如果是微信浏览器,并且不存在微信openid,则转去获取微信openid获取程序
     if (is_weixin() && !isset($this->session->data['weixin_openid'])) {
         $this->session->data['redirect'] = HTTPS_SERVER . 'index.php?route=checkout/checkout';
         header('Location: ' . HTTPS_SERVER . 'system/weixin/get_weixin_openid.php');
         //exit();
     }
     // Validate minimum quantity requirements.
     $products = $this->cart->getProducts();
     foreach ($products as $product) {
         $product_total = 0;
         foreach ($products as $product_2) {
             if ($product_2['product_id'] == $product['product_id']) {
                 $product_total += $product_2['quantity'];
             }
         }
         if ($product['minimum'] > $product_total) {
             $this->response->redirect($this->url->link('checkout/cart'));
         }
     }
     $this->load->language('checkout/checkout');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js');
     $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');
     $this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');
     // Required by klarna
     if ($this->config->get('klarna_account') || $this->config->get('klarna_invoice')) {
         $this->document->addScript('http://cdn.klarna.com/public/kitt/toc/v1.0/js/klarna.terms.min.js');
     }
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_cart'), 'href' => $this->url->link('checkout/cart'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('checkout/checkout', '', 'SSL'));
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_checkout_option'] = $this->language->get('text_checkout_option');
     $data['text_checkout_account'] = $this->language->get('text_checkout_account');
     $data['text_checkout_payment_address'] = $this->language->get('text_checkout_payment_address');
     $data['text_checkout_shipping_address'] = $this->language->get('text_checkout_shipping_address');
     $data['text_checkout_shipping_method'] = $this->language->get('text_checkout_shipping_method');
     $data['text_checkout_payment_method'] = $this->language->get('text_checkout_payment_method');
     $data['text_checkout_confirm'] = $this->language->get('text_checkout_confirm');
     if (isset($this->session->data['error'])) {
         $data['error_warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     } else {
         $data['error_warning'] = '';
     }
     $data['logged'] = $this->customer->isLogged();
     if (isset($this->session->data['account'])) {
         $data['account'] = $this->session->data['account'];
     } else {
         $data['account'] = '';
     }
     $data['shipping_required'] = $this->cart->hasShipping();
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['column_right'] = $this->load->controller('common/column_right');
     $data['content_top'] = $this->load->controller('common/content_top');
     $data['content_bottom'] = $this->load->controller('common/content_bottom');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/checkout.tpl')) {
         $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/checkout/checkout.tpl', $data));
     } else {
         $this->response->setOutput($this->load->view('default/template/checkout/checkout.tpl', $data));
     }
 }
Exemplo n.º 27
0
 public function __construct()
 {
     if (is_weixin()) {
         m('member')->checkMember();
     }
 }
 public function __construct()
 {
     if (is_weixin() === true) {
         header('Location: http://m.renrenlie.com/');
     }
     parent::__construct();
     //获取友情链接
     $linkArr = M("friendlink")->where("status=0")->order("orderid desc,id asc")->select();
     $this->assign("linkArr", $linkArr);
     import('ORG.Util.Page');
     $username = $_SESSION['username'];
     $userinfo = M('member')->where("username='******'")->select();
     $this->userinfo = $userinfo;
     if (!empty($_SESSION['username']) || !empty($_SESSION['cusername'])) {
         $username = $_SESSION['username'] ? $_SESSION['username'] : $_SESSION['cusername'];
         $decide = M('userinfo')->where("username='******'")->select();
         if (!empty($decide)) {
             $table = array();
             foreach ($decide as $key => $val) {
                 $table = $decide[$key];
             }
             if ($table["flag"] == "0") {
                 $uid = $userinfo[0]['id'];
                 $leftNavCompleted = array();
                 //判断基本资料是否填写完整
                 if (isset($userinfo[0]['cnname']) && isset($userinfo[0]['sex']) && isset($userinfo[0]['age']) && isset($userinfo[0]['mobile']) && isset($userinfo[0]['email'])) {
                     $leftNavCompleted['userinfo_completed'] = true;
                 } else {
                     $leftNavCompleted['userinfo_completed'] = false;
                 }
                 //判断简历库是否有数据
                 $isResume = M("resume")->where("t_id=" . $uid)->find();
                 if (!empty($isResume)) {
                     $leftNavCompleted['resume_completed'] = true;
                 } else {
                     $leftNavCompleted['resume_completed'] = false;
                 }
                 //判断是否有推荐职位
                 $isRecord = M("record")->where("t_id=" . $uid)->find();
                 if (!empty($isRecord)) {
                     $leftNavCompleted['record_completed'] = true;
                 } else {
                     $leftNavCompleted['record_completed'] = false;
                 }
                 $isMoney = M("account")->where("username='******'")->find();
                 if (!empty($isMoney)) {
                     $leftNavCompleted['money_completed'] = true;
                 } else {
                     $leftNavCompleted['money_completed'] = false;
                 }
                 $this->assign("leftNavCompleted", $leftNavCompleted);
             }
             //判断是企业or推荐人 1企业用户 0推荐人
             if ($table["flag"] == "0") {
                 $data['url'] = U('Login/userinfo');
                 $data['logout'] = U('Login/logout');
                 $data['savepass'] = U('Login/savepass');
             } else {
                 if ($table["flag"] == "1") {
                     $data['url'] = U('Company/EnterpriseInformation');
                     $data['logout'] = U('Login/logout');
                     $data['savepass'] = U('Login/savepass');
                 }
             }
             $this->assign("data", $data);
         }
     } else {
         $this->error("您长时间未操作,已登录超时,若想继续操作,请重新登录!", U('Index/index'));
     }
 }
Exemplo n.º 29
0
 if (empty($goods['type'])) {
     $log['eno'] = $this->model->createENO();
 }
 pdo_insert('ewei_shop_creditshop_log', $log);
 $logid = pdo_insertid();
 if ($needpay) {
     $useweixin = true;
     if (!empty($goods['usecredit2'])) {
         if ($money > $goods['money']) {
             $useweixin = false;
         }
     }
     pdo_update('ewei_shop_creditshop_log', array('paytype' => $useweixin ? 1 : 0), array('id' => $logid));
     if ($useweixin) {
         $set = m('common')->getSysset();
         if (!is_weixin()) {
             show_json(0, '非微信环境!');
         }
         if (empty($set['pay']['weixin'])) {
             show_json(0, '未开启微信支付!');
         }
         $wechat = array('success' => false);
         $params = array();
         $params['tid'] = $log['logno'];
         $params['user'] = $openid;
         $params['fee'] = $goods['money'];
         $params['title'] = $set['shop']['name'] . (empty($goods['type']) ? "积分兑换" : '积分抽奖') . ' 单号:' . $log['logno'];
         load()->model('payment');
         $setting = uni_setting($_W['uniacid'], array('payment'));
         if (is_array($setting['payment'])) {
             $options = $setting['payment']['wechat'];
function weixin_robot_wp()
{
    if (is_singular() && is_weixin()) {
        add_action('wp_enqueue_scripts', 'weixin_robot_enqueue_scripts');
    }
}