function getGamesLuckyLists($gamesId, $uid = 0, $state = '-1', $aim_table = 'lottery_games')
 {
     $map['token'] = get_token();
     $map['aim_table'] = $aim_table;
     $map['draw_id'] = $gamesId;
     if ($uid != 0) {
         $map['follow_id'] = $uid;
     }
     if ($state != '-1') {
         $map['state'] = $state;
     }
     $lists = $this->where($map)->order('id desc')->select();
     $awardLists = D('Addons://Draw/LotteryGamesAwardLink')->getGamesAwardlists($gamesId);
     foreach ($awardLists as $a) {
         $awardData[$a['award_id']] = $a;
     }
     foreach ($lists as &$v) {
         if ($awardData[$v['award_id']]) {
             $v['grade'] = $awardData[$v['award_id']]['grade'];
             $v['award_name'] = $awardData[$v['award_id']]['name'];
             $v['img'] = $awardData[$v['award_id']]['img'];
         }
         $address_id = intval($v['address']);
         if ($address_id) {
             $address = D('Addons://Shop/Address')->getInfo($address_id);
             $v['address'] = $address['address'];
             $v['truename'] = $address['truename'];
             $v['mobile'] = $address['mobile'];
         }
         $user = get_userinfo($v['follow_id']);
         $v['nickname'] = $user['nickname'];
         $v['headimgurl'] = $user['headimgurl'];
     }
     return $lists;
 }
Esempio n. 2
0
 public function chat()
 {
     $data = array();
     if (is_login()) {
         $uesr_info = get_userinfo();
         $data['user_name'] = $uesr_info['user_name'];
         $data['user_id'] = $uesr_info['user_id'];
     }
     $data['title'] = '聊天';
     $this->assign($data);
     $this->display('default/chat');
 }
Esempio n. 3
0
 public function order()
 {
     if (IS_POST) {
         if (!check_verify(I('verify'))) {
             $this->error('验证码输入错误');
         }
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         $site_id = I('site_id', 0, 'intval');
         if ($uid) {
             $result = $Order->inputVisa($order_id, $uid, $site_id);
             $mobile = get_userinfo($uid, 3);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, array('mobile' => $mobile, 'password' => $password), 'password');
                     $result = $Order->inputVisa($order_id, $uid, $site_id);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->inputVisa($order_id, $user_info[0], $site_id);
             }
         }
         if ($result) {
             send_sms($mobile, array('orderid' => $order_id), 'onOrder');
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $visa_id = I('visa_id', 0, 'intval');
         if (empty($visa_id)) {
             $this->error('无效参数');
         }
         // 线路信息
         $map = array('visa_id' => $visa_id);
         $visa_info = M('Visa')->where($map)->find();
         if (empty($visa_info)) {
             $this->error('不存在');
         }
         $this->assign('visa_info', $visa_info);
         $this->display();
     }
 }
 function games_lucky_lists()
 {
     $this->assign('search_button', false);
     $this->assign('add_button', false);
     $this->assign('del_button', false);
     $this->assign('check_all', false);
     $gamesId = I('games_id', 0, 'intval');
     $map['token'] = get_token();
     $map['aim_table'] = 'lottery_games';
     if ($gamesId) {
         $map['draw_id'] = $gamesId;
     }
     $state = I('state');
     if ($state != null) {
         $map['state'] = $state;
     }
     session('common_condition', $map);
     $model = $this->getModel('lucky_follow');
     $list_data = $this->_get_model_list($model);
     $gamesDao = D('Addons://Draw/Games');
     $awardDao = D('Addons://Draw/LotteryGamesAwardLink');
     $addressDao = D('Addons://Shop/Address');
     foreach ($list_data['list_data'] as &$v) {
         $awardLists = $awardDao->getGamesAwardlists($v['draw_id']);
         foreach ($awardLists as $a) {
             $awardData[$a['award_id']] = $a;
         }
         if ($awardData[$v['award_id']]) {
             $awardId = $v['award_id'];
             $v['award_id'] = $awardData[$awardId]['grade'];
             $v['award_name'] = $awardData[$awardId]['name'];
         }
         $user = get_userinfo($v['follow_id']);
         $v['follow_id'] = $user['nickname'];
         $address_id = intval($v['address']);
         if ($address_id) {
             $address = $addressDao->getInfo($address_id);
             $v['address'] = $address['address'];
             $v['truename'] = $address['truename'];
             $v['mobile'] = $address['mobile'];
         }
         $v['state'] = $v['state'] == 1 ? '已发奖' : '未发奖';
         $gamesInfo = $gamesDao->getInfo($v['draw_id']);
         $v['draw_id'] = $gamesInfo['title'];
     }
     $this->assign($list_data);
     $this->display();
 }
 function lists()
 {
     $isUser = get_userinfo($this->mid, 'manager_id');
     if ($isUser) {
         redirect(addons_url('BusinessCard://BusinessCard/edit'));
     }
     $this->assign('add_button', false);
     $model = $this->getModel('BusinessCard');
     $list_data = $this->_get_model_list($model);
     foreach ($list_data['list_data'] as &$vo) {
         // $url = U ( 'detail?uid=' . $vo ['uid'] );
         $url = addons_url('BusinessCard://Wap/detail', array('uid' => $vo['uid']));
         $vo['qrcode'] = "<img class='list_img' src='http://qr.liantu.com/api.php?text={$url}' />";
     }
     $this->assign($list_data);
     $this->display();
 }
 public function lists()
 {
     $this->assign('add_button', false);
     $this->assign('search_button', false);
     $this->assign('del_button', false);
     $this->assign('check_all', false);
     // 解析列表规则
     $data = $this->_list_grid($this->model);
     //dump ( $data );
     $this->assign($data);
     // 搜索条件
     $map = $this->_search_map($this->model, $data['fields']);
     $data['fields'][] = 'sum(score) as total';
     $name = parse_name(get_table_name($this->model['id']), true);
     $list = M($name)->where($map)->field($data['fields'])->order('id DESC')->group('uid')->selectPage();
     foreach ($list['list_data'] as &$vo) {
         $member = get_userinfo($vo['uid']);
         $vo['truename'] = $member['truename'];
         $vo['mobile'] = $member['mobile'];
         $vo['score'] = $vo['total'];
     }
     $this->assign($list);
     $this->display();
 }
 function getMembershipData()
 {
     $map['uid'] = $this->mid;
     $map['token'] = get_token();
     $uid = I('uid');
     $userExperience = get_userinfo($uid, 'experience');
     $list = M('shop_membership')->where($map)->select();
     foreach ($list as $v) {
         if ($v['condition'] >= $userExperience) {
             $extra .= $v['id'] . ':' . $v['membership'] . "\r\n";
         }
     }
     return $extra;
 }
Esempio n. 8
0
 public function getSession($params)
 {
     return $this->encodeOutput(get_userinfo());
 }
Esempio n. 9
0
function get_html_userinfo($error_json_exit = false)
{
    global $userinfo;
    global $html_userinfo;
    $html_userinfo = "No users found";
    if (!get_userinfo($error_json_exit)) {
        return false;
    }
    if (!count($userinfo)) {
        return true;
    }
    $html_userinfo = "<table class='padcell'><tr><th>" . implode("</th><th>", array_keys($userinfo[0])) . "</th></tr>";
    foreach ($userinfo as $k => $v) {
        $html_userinfo .= "<tr><td>" . implode("</td><td> ", $v) . "</td></tr>";
    }
    $html_userinfo .= "</table>";
}
Esempio n. 10
0
 public function order()
 {
     if (IS_POST) {
         if (!check_verify(I('verify'))) {
             $this->error('验证码输入错误');
         }
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         $site_id = I('site_id', 0, 'intval');
         if ($uid) {
             $result = $Order->inputLine($order_id, $uid, $site_id);
             $mobile = get_userinfo($uid, 3);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, array('mobile' => $mobile, 'password' => $password), 'password');
                     $result = $Order->inputLine($order_id, $uid, $site_id);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->inputLine($order_id, $user_info[0], $site_id);
             }
         }
         if ($result) {
             send_sms($mobile, array('orderid' => $order_id), 'onOrder');
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $line_id = I('line_id', 0, 'intval');
         $tc_id = I('type_id', 0, 'intval');
         $date = I('date', 0, 'strtotime');
         if (empty($line_id) || empty($tc_id) || empty($date)) {
             $this->error('无效参数');
         }
         // 线路信息
         $line_info = M('Line')->find($line_id);
         // 套餐信息
         $map = array('line_id' => $line_id, 'end_time' => array('egt', strtotime('+' . $line_info['earlier_date'] . 'day')));
         $line_tc = M('LineTc')->where($map)->select();
         if (empty($line_tc)) {
             $this->error('没有报价方案');
         }
         $tc_info = array();
         foreach ($line_tc as $key => $value) {
             if ($value['tc_id'] == $tc_id) {
                 $tc_info = $value;
                 break;
             }
         }
         $ext_time = strtotime('+' . $line_info['earlier_date'] . 'day');
         $tc_str = explode(',', $tc_info['date_price_data']);
         foreach ($tc_str as $value) {
             list($k, $val) = explode('|', $value);
             $k = strtotime($k);
             if ($k <= $ext_time) {
                 continue;
             }
             if ($k == $date) {
                 $tc_info['price_info'] = explode('-', $val);
                 $tc_info['price_info'][] = date('Y-m-d', $k);
                 break;
             }
         }
         if (empty($tc_info['price_info'])) {
             $this->error('没有价格');
         }
         $line_info['xingcheng'] = unserialize($line_info['xingcheng']);
         $line_info['remark'] = unserialize($line_info['remark']);
         $this->assign('line_info', $line_info);
         $this->assign('line_tc', $line_tc);
         $this->assign('tc_info', $tc_info);
         $this->display();
     }
 }
Esempio n. 11
0
 private function _get_manager_menu($uid, $addonList)
 {
     $menu_map['uid'] = $uid;
     $menu_map['is_hide'] = 0;
     $menus = $this->where($menu_map)->order('sort asc, id asc')->select();
     // 没配置菜单时取默认的菜单
     if (empty($menus)) {
         $managerId = get_userinfo($uid, 'manager_id');
         if ($managerId) {
             $menu_map1['uid'] = $managerId;
             $menus = $this->where($menu_map1)->order('sort asc, id asc')->select();
             // 获取微商城id
             $menu_map1['addon_name'] = 'Shop';
             $shopAddonId = $this->where($menu_map1)->getField('id');
             foreach ($menus as $k => $vo) {
                 if ($vo['title'] == '首页' || $vo['title'] == '微信管家') {
                     unset($menus[$k]);
                 }
                 // 屏蔽普通用户的栏目
                 if ($vo['pid'] == $shopAddonId && $vo['title'] == '支付配置') {
                     unset($menus[$k]);
                 }
                 if ($vo['pid'] == $shopAddonId && $vo['title'] == '功能配置') {
                     unset($menus[$k]);
                 }
             }
         } else {
             $menu_map['uid'] = C('USER_ADMINISTRATOR');
             $menus = $this->where($menu_map)->order('sort asc, id asc')->select();
         }
     }
     // 侧边栏数据
     foreach ($menus as $m) {
         if ($m['menu_type'] == 0) {
             continue;
         }
         $param['side'] = $cate['id'] = $m['id'];
         $cate['title'] = $m['title'];
         $param['top'] = $cate['pid'] = intval($m['pid']);
         if ($m['url_type'] == 0) {
             $cate['url'] = $addonList[$m['addon_name']]['addons_url'];
         } elseif (strpos($m['url'], 'http://') !== false || strpos($m['url'], 'https://') !== false) {
             $cate['url'] = $m['url'];
         } elseif (strpos($m['url'], '://') !== false) {
             $cate['url'] = addons_url($m['url']);
         } else {
             $cate['url'] = U($m['url']);
         }
         $cate['url'] .= '&mdm=' . $cate['pid'] . '|' . $cate['id'];
         $cate['addon_name'] = $m['addon_name'];
         $res['core_side_menu'][$cate['pid']][] = $cate;
         $res['default_data'][$cate['url']] = $param;
         empty($m['addon_name']) || ($res['default_data'][$cate['addon_name']] = $param);
     }
     // 顶部栏数据
     foreach ($menus as $m) {
         if ($m['menu_type'] != 0) {
             continue;
         }
         $param['top'] = $cate['id'] = $m['id'];
         $cate['title'] = $m['title'];
         $cate['pid'] = 0;
         if ($m['url_type'] == 0) {
             $cate['url'] = $addonList[$m['addon_name']]['addons_url'];
             if (empty($cate['url']) && !empty($res['core_side_menu'][$m['id']])) {
                 $cate['url'] = $res['core_side_menu'][$m['id']][0]['url'];
             }
             $cate['url'] .= '&mdm=' . $cate['id'];
         } else {
             if ($m['url_type'] == 0) {
                 $cate['url'] = $addonList[$m['addon_name']]['addons_url'];
             } elseif (strpos($m['url'], 'http://') !== false || strpos($m['url'], 'https://') !== false) {
                 $cate['url'] = $m['url'];
             } elseif (strpos($m['url'], '://') !== false) {
                 $cate['url'] = addons_url($m['url']);
             } else {
                 $cate['url'] = U($m['url']);
             }
             if ($res['core_side_menu'][$m['id']][0]['id']) {
                 $cate['url'] .= '&mdm=' . $m['id'] . '|' . $res['core_side_menu'][$m['id']][0]['id'];
             } else {
                 $cate['url'] .= '&mdm=' . $m['id'];
             }
         }
         $cate['addon_name'] = $m['addon_name'];
         $res['core_top_menu'][] = $cate;
         $param['side'] = $res['core_side_menu'][$m['id']][0]['id'];
         $res['default_data'][$cate['url']] = $param;
         empty($m['addon_name']) || ($res['default_data'][$cate['addon_name']] = $param);
     }
     return $res;
 }
 function show_log()
 {
     $model = $this->getModel('shop_vote_log');
     $param1['mdm'] = $param['mdm'] = $_GET['mdm'];
     $vote_id = I('vote_id');
     $vote_id && ($param['vote_id'] = $map['vote_id'] = $vote_id);
     $opt_id = I('option_id');
     $opt_id && ($param['option_id'] = $map['option_id'] = $opt_id);
     $map['token'] = get_token();
     $search_url = addons_url('Vote://ShopVote/show_log', $param);
     $this->assign('search_url', $search_url);
     $res['title'] = '投票活动';
     $res['url'] = addons_url('Vote://ShopVote/lists', $param1);
     $res['class'] = _ACTION == 'lists' ? 'current' : '';
     $nav[] = $res;
     $res['title'] = '投票记录';
     $res['url'] = addons_url('Vote://ShopVote/show_log', $param);
     $res['class'] = _ACTION == 'show_log' ? 'current' : '';
     $nav[] = $res;
     $this->assign('nav', $nav);
     $this->assign('add_button', false);
     $this->assign('del_button', false);
     $this->assign('check_all', false);
     $btn['url'] = U('option_lists', $param);
     $btn['title'] = '返回';
     $returnbtn[] = $btn;
     $this->assign('top_more_button', $returnbtn);
     $nickname = I('truename');
     if ($nickname) {
         $uidstr = D('Common/User')->searchUser($nickname);
         if ($uidstr) {
             $map['uid'] = array('in', $uidstr);
         } else {
             $map['uid'] = 0;
         }
     }
     session('common_condition', $map);
     // 	    $shopVote=D('Addons://Vote/ShopVote')->getInfo($vote_id);
     $list_data = $this->_get_model_list($model);
     foreach ($list_data['list_data'] as &$vo) {
         // 	        $vo['vote_id']=$shopVote['title'];
         $user = get_userinfo($vo['uid']);
         $vo['vote_id'] = url_img_html($user['headimgurl']);
         $vo['uid'] = $user['nickname'];
         $shopOption = D('Addons://Vote/ShopVoteOption')->getInfo($vo['option_id']);
         $vo['option_id'] = $shopOption['truename'];
     }
     $this->assign($list_data);
     $this->display('lists');
 }
Esempio n. 13
0
 private function initUser()
 {
     if (isset($_GET['is_stree'])) {
         $suid = $user['uid'] = rand(1, 10000);
     } else {
         $uid = session('mid');
     }
     if (!$uid && $GLOBALS['is_wap']) {
         $uid = get_uid_by_openid();
         $uid > 0 && session('mid', $uid);
     }
     if (!$uid) {
         $youke_uid = M('config')->where('name="FOLLOW_YOUKE_UID"')->getField('value') - 1;
         $user['uid'] = $youke_uid;
         M('config')->where('name="FOLLOW_YOUKE_UID"')->setField('value', $youke_uid);
         session('mid', $youke_uid);
     }
     // 当前登录者
     $GLOBALS['mid'] = $this->mid = intval($uid);
     $myinfo = get_userinfo($this->mid);
     $GLOBALS['myinfo'] = $myinfo;
     // 当前访问对象的uid
     $GLOBALS['uid'] = $this->uid = intval($_REQUEST['uid'] == 0 ? $this->mid : $_REQUEST['uid']);
     $this->assign('mid', $this->mid);
     // 登录者
     $this->assign('uid', $this->uid);
     // 访问对象
     $this->assign('myinfo', $GLOBALS['myinfo']);
     // 访问对象
 }
Esempio n. 14
0
 /**
  * 修改密码提交
  *
  * @author huajie <*****@*****.**>
  */
 public function profile()
 {
     if (!is_login()) {
         $this->error('您还没有登陆', U('User/login'));
     }
     if (IS_POST) {
         // 获取参数
         $uid = is_login();
         $password = I('post.old');
         $repassword = I('post.repassword');
         $data['password'] = I('post.password');
         empty($password) && $this->error('请输入原密码');
         empty($data['password']) && $this->error('请输入新密码');
         empty($repassword) && $this->error('请输入确认密码');
         if ($data['password'] !== $repassword) {
             $this->error('您输入的新密码与确认密码不一致');
         }
         $isUser = get_userinfo($uid, 'manager_id');
         if ($isUser) {
             $data['login_password'] = $data['password'];
         }
         $res = D('Common/User')->updateUserFields($uid, $password, $data);
         if ($res !== false) {
             $this->success('修改密码成功!');
         } else {
             $this->error('修改密码失败!');
         }
     } else {
         $this->display();
     }
 }
 function output()
 {
     $model = $this->model;
     $map['token'] = get_token();
     $orders = D('Addons://Shop/Order')->where($map)->getFields('order_number,id');
     $follows = M('public_follow')->where($map)->getFields('openid,uid');
     $payStatus = I('get.pay_status');
     if ($payStatus) {
         if ($payStatus == 3) {
             $map['status'] = 0;
         } else {
             $map['status'] = $payStatus;
         }
     }
     $payType = I('get.pay_type');
     if ($payType) {
         $map['paytype'] = $payType;
     }
     $isPrice = I('get.is_price');
     if ($isPrice) {
         $minVal = I('get.min_value', 0, 'intval');
         $maxVal = I('get.max_value', 0, 'intval');
         if ($minVal && $maxVal) {
             $minVal < $maxVal && ($map['price'] = array('between', array($minVal, $maxVal)));
             $minVal > $maxVal && ($map['price'] = array('between', array($maxVal, $minVal)));
             $minVal == $maxVal && ($map['price'] = $minVal);
         } else {
             if (!empty($minVal)) {
                 $map['price'] = array('egt', $minVal);
             } else {
                 if (!empty($maxVal)) {
                     $map['price'] = array('elt', $maxVal);
                 }
             }
         }
     }
     $search = $_REQUEST['single_orderid'];
     if ($search) {
         $this->assign('search', $search);
         $map['single_orderid'] = array('like', '%' . htmlspecialchars($search) . '%');
         unset($_REQUEST['single_orderid']);
     }
     session('common_condition', $map);
     $list_data = $this->_get_model_list($this->model);
     foreach ($list_data['list_grids'] as $v) {
         $titleArr[] = $v['title'];
     }
     $dataArr[] = $titleArr;
     $paytypearr = array('Weixin' => '微信支付', 'Alipaytype' => '支付宝支付', 'Tenpay' => '财付通WAP支付', 'TenpayComputer' => '财付通支付', 'Quickpay' => '银联支付');
     foreach ($list_data['list_data'] as &$vo) {
         $vo['wecha_id'] = get_userinfo($follows[$vo['wecha_id']], 'nickname');
         $vo['orderName'] = urldecode($vo['orderName']);
         $vo['price'] = '¥' . wp_money_format($vo['price']);
         $vo['status'] = $vo['status'] == 0 ? '未支付' : '已支付';
         $vo['paytype'] = $paytypearr[$vo['paytype']];
         $param['id'] = $orders[$vo['single_orderid']];
         $vo['single_orderid'] = $vo['single_orderid'];
         unset($vo['id']);
         $dataArr[] = $vo;
     }
     outExcel($dataArr, $map['module']);
 }
 function pigcms_init()
 {
     // dump ( 'pigcms_init' );
     C('TMPL_L_DELIM', '{pigcms:');
     // C ( 'TMPL_FILE_DEPR', '_' );
     define('RES', ONETHINK_ADDON_PATH . 'WeiSite/View/default/pigcms/common');
     $public_info = get_token_appinfo();
     $manager = get_userinfo($public_info['uid']);
     // 站点配置
     $data['f_logo'] = get_cover_url(C('SYSTEM_LOGO'));
     $data['f_siteName'] = C('WEB_SITE_TITLE');
     $data['f_siteTitle'] = C('WEB_SITE_TITLE');
     $data['f_metaKeyword'] = C('WEB_SITE_KEYWORD');
     $data['f_metaDes'] = C('WEB_SITE_DESCRIPTION');
     $data['f_siteUrl'] = SITE_URL;
     $data['f_qq'] = '';
     $data['f_qrcode'] = '';
     $data['f_ipc'] = C('WEB_SITE_ICP');
     $data['reg_validDays'] = 30;
     // 用户信息
     $data['user'] = array('id' => $GLOBALS['myinfo']['uid'], 'openid' => get_openid(), 'username' => $GLOBALS['myinfo']['nickname'], 'mp' => $public_info['token'], 'password' => $GLOBALS['myinfo']['password'], 'email' => $GLOBALS['myinfo']['email'], 'createtime' => $GLOBALS['myinfo']['reg_time'], 'lasttime' => $GLOBALS['myinfo']['last_login_time'], 'status' => 1, 'createip' => $GLOBALS['myinfo']['reg_ip'], 'lastip' => $GLOBALS['myinfo']['last_login_ip'], 'smscount' => 0, 'inviter' => 1, 'gid' => 5, 'diynum' => 0, 'activitynum' => 0, 'card_num' => 0, 'card_create_status' => 0, 'money' => 0, 'moneybalance' => 0, 'spend' => 0, 'viptime' => $GLOBALS['myinfo']['last_login_time'] + 86400, 'connectnum' => 0, 'lastloginmonth' => 0, 'attachmentsize' => 0, 'wechat_card_num' => 0, 'serviceUserNum' => 0, 'invitecode' => '', 'remark' => '');
     // 微网站配置信息
     $data['homeInfo'] = array('id' => $manager['uid'], 'token' => $public_info['token'], 'title' => $this->config['title'], 'picurl' => get_cover_url($this->config['cover']), 'info' => $this->config['info'], 'copyright' => $manager['copy_right'], 'logo' => get_cover_url($this->config['cover']));
     // 背景图
     $data['flashbgcount'] = 1;
     $data['flashbg'][0] = array('id' => $this->config['background_id'], 'token' => $public_info['token'], 'img' => $this->config['background'], 'url' => "javascript:void(0)", 'info' => "背景图片", 'tip' => '2');
     $data['flashbgcount'] = count($data['flashbg']);
     // 幻灯片
     $slideshow = M('weisite_slideshow')->where($map)->order('sort asc, id desc')->select();
     foreach ($slideshow as $vo) {
         $data['flash'][] = array('id' => $vo['id'], 'token' => $vo['token'], 'img' => get_cover_url($vo['img']), 'url' => $vo['url'], 'info' => $vo['title'], 'tip' => '1');
     }
     $data['num'] = count($data['flash']);
     // 底部栏
     $this->_footer('pigcms');
     // 设置版权信息
     $data["iscopyright"] = 0;
     $data["copyright"] = $data["siteCopyright"] = empty($manager['copy_right']) ? C('COPYRIGHT') : $manager['copy_right'];
     // 分享
     $data['shareScript'] = '';
     $data['token'] = $public_info['token'];
     $data['wecha_id'] = $public_info['wechat'];
     $this->assign($data);
     // 模板信息
     if (file_exists(ONETHINK_ADDON_PATH . _ADDONS . '/View/default/pigcms/index.Tpl.php')) {
         $pigcms_temps = (require_once ONETHINK_ADDON_PATH . _ADDONS . '/View/default/pigcms/index.Tpl.php');
         foreach ($pigcms_temps as $k => $vo) {
             $temps[$vo['tpltypename']] = $vo;
         }
     }
     if (file_exists(ONETHINK_ADDON_PATH . _ADDONS . '/View/default/pigcms/cont.Tpl.php')) {
         $pigcms_temps = (require_once ONETHINK_ADDON_PATH . _ADDONS . '/View/default/pigcms/cont.Tpl.php');
         foreach ($pigcms_temps as $k => $vo) {
             $temps[$vo['tpltypename']] = $vo;
         }
     }
     $tpl = array('id' => $public_info['id'], 'routerid' => "", 'uid' => $public_info['uid'], 'wxname' => $public_info['public_name'], 'winxintype' => $public_info['type'], 'appid' => $public_info['appid'], 'appsecret' => $public_info['secret'], 'wxid' => $public_info['id'], 'weixin' => $public_info['wechat'], 'headerpic' => get_cover_url($GLOBALS['myinfo']['headface_url']), 'token' => $public_info['token'], 'pigsecret' => $public_info['token'], 'province' => $GLOBALS['myinfo']['province'], 'city' => $GLOBALS['myinfo']['city'], 'qq' => $GLOBALS['myinfo']['qq'], 'color_id' => 0, 'tpltypeid' => $temps[$this->config['template_index']]['tpltypeid'], 'tpltypename' => $this->config['template_index'], 'tpllistid' => $temps[$this->config['template_lists']]['tpltypeid'], 'tpllistname' => $this->config['template_lists'], 'tplcontentid' => $temps[$this->config['template_detail']]['tpltypeid'], 'tplcontentname' => $this->config['template_detail']);
     $this->assign('tpl', $tpl);
     $this->assign('wxuser', $tpl);
 }
Esempio n. 17
0
function logout()
{
    process_logout();
    return get_userinfo();
}
function handle_callback()
{
    global $g_error, $g_info;
    try {
        if ($_REQUEST['error']) {
            return;
        }
        $code = $_REQUEST['code'];
        $token = $_REQUEST['access_token'];
        $state = $_REQUEST['state'];
        $id_token = $_REQUEST['id_token'];
        if (isset($_REQUEST['session_state'])) {
            $_SESSION['session_state'] = $_REQUEST['session_state'];
        } else {
            unset($_SESSION['session_state']);
        }
        if (!$code) {
            if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                handle_implicit_callback();
            } else {
                handle_implicit();
            }
            return;
        }
        $client_id = $_SESSION['provider']['client_id'];
        $client_secret = $_SESSION['provider']['client_secret'];
        $token_ep = $_SESSION['provider']['token_endpoint'];
        $userinfo_ep = $_SESSION['provider']['userinfo_endpoint'];
        $client_redirect_uri = RP_REDIRECT_URI;
        $url = $token_ep;
        $data = array('client_id' => $client_id, 'code' => $code, 'redirect_uri' => $client_redirect_uri, 'grant_type' => 'authorization_code', 'code_verifier' => $_SESSION['code_verifier']);
        $curl_options = array();
        $token_endpoint_auth_method = $_SESSION['provider']['token_endpoint_auth_method'];
        $token_endpoint_auth_signing_alg = $_SESSION['provider']['token_endpoint_auth_signing_alg'];
        log_debug("Token Endpoint Auth Method : %s alg : %s", $token_endpoint_auth_method, $token_endpoint_auth_signing_alg);
        switch ($token_endpoint_auth_method) {
            case 'client_secret_post':
                $data['client_id'] = $client_id;
                $data['client_secret'] = $client_secret;
                break;
            case 'client_secret_jwt':
                $client_assertion = array('iss' => $client_id, 'sub' => $client_id, 'aud' => $token_ep, 'jti' => bin2hex(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), 'exp' => time() + 5 * 60, 'iat' => time());
                if (!$token_endpoint_auth_signing_alg) {
                    $token_endpoint_auth_signing_alg = 'HS256';
                }
                $token_endpoint_auth_signing_algs_supported = is_array($_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported']) ? $_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported'] : explode('|', $_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported']);
                if (!in_array($token_endpoint_auth_signing_alg, $token_endpoint_auth_signing_algs_supported)) {
                    $g_error = "Token Endpoint Auth Sig Alg {$token_endpoint_auth_signing_alg} is not supported.";
                    return NULL;
                }
                $jwt = rp2op_jwt_sign_encrypt($_SESSION['provider'], $client_assertion, $token_endpoint_auth_signing_alg);
                if (!$jwt) {
                    $g_error .= 'Unable to sign client_secret_jwt';
                    log_error($g_error);
                }
                $data['client_assertion_type'] = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
                $data['client_assertion'] = $jwt;
                break;
            case 'private_key_jwt':
                $client_assertion = array('iss' => $client_id, 'sub' => $client_id, 'aud' => $token_ep, 'jti' => bin2hex(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), 'exp' => time() + 5 * 60, 'iat' => time());
                if (!$token_endpoint_auth_signing_alg) {
                    $token_endpoint_auth_signing_alg = 'RS256';
                }
                $token_endpoint_auth_signing_algs_supported = is_array($_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported']) ? $_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported'] : explode('|', $_SESSION['provider']['token_endpoint_auth_signing_alg_values_supported']);
                if (!in_array($token_endpoint_auth_signing_alg, $token_endpoint_auth_signing_algs_supported)) {
                    $g_error = "Token Endpoint Auth Sig Alg {$token_endpoint_auth_signing_alg} is not supported.";
                    return NULL;
                }
                $jwt = rp2op_jwt_sign_encrypt($_SESSION['provider'], $client_assertion, $token_endpoint_auth_signing_alg);
                if (!$jwt) {
                    $g_error .= 'Unable to sign private_key_jwt';
                    log_error($g_error);
                }
                $data['client_assertion_type'] = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
                $data['client_assertion'] = $jwt;
                break;
            case '':
            case 'client_secret_basic':
            default:
                $curl_options[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
                $curl_options[CURLOPT_USERPWD] = "{$client_id}:{$client_secret}";
                break;
        }
        list($status_code, $data_content_type, $req_out, $response_headers, $data_responseText) = curl_fetch_url($url, NULL, $curl_options, true, $data);
        if ($status_code != 200) {
            $g_error .= "Unable to get Access Token.\n{$req_out}\n{$response_headers}\n{$data_responseText}";
            log_error($g_error);
            return;
        } elseif (strpos($data_content_type, 'application/json') !== false) {
            $obj = json_decode($data_responseText, true);
            if (!$obj) {
                $g_error .= "Unable to get access token.\n{$req_out}\n{$response_headers}\n{$data_responseText}";
                log_error($g_error);
                return;
            }
            if (isset($obj['access_token'])) {
                get_userinfo($userinfo_ep, $obj['access_token']);
            } else {
                log_debug("Token Endpoint - %s\n%s\n%s", $req_out, $response_headers, $data_responseText);
            }
            if (!$id_token) {
                $id_token = $obj['id_token'];
                $g_info .= "Using ID Token from Token Endpoint Response\n";
            } else {
                $g_info .= "Using ID Token from User-Agent\n";
            }
            if (isset($id_token)) {
                $g_info .= "{$id_token}\n";
                $unpacked_id_token = rp_decrypt_verify_id_token($id_token);
                $bit_length = substr($unpacked_id_token['jws'][0]['alg'], 2);
                switch ($bit_length) {
                    case '384':
                        $hash_alg = 'sha384';
                        break;
                    case '512':
                        $hash_alg = 'sha512';
                        break;
                    case '256':
                    default:
                        $hash_alg = 'sha256';
                        break;
                }
                $hash_length = (int) ((int) $bit_length / 2) / 8;
                if ($unpacked_id_token['jws'][1]['at_hash']) {
                    $g_info .= "ID Token contains at_hash\n";
                    if (!$token) {
                        $g_error .= "Access Token not found with ID Token response\n";
                    } else {
                        if (base64url_encode(substr(hash($hash_alg, $token, true), 0, $hash_length)) == $unpacked_id_token['jws'][1]['at_hash']) {
                            $g_info .= "Access Token Hash Verified\n";
                        } else {
                            $g_error .= "Access Token Hash Verification Failed for access token : {$token}.\n";
                        }
                    }
                }
                if ($unpacked_id_token['jws'][1]['c_hash']) {
                    $g_info .= "ID Token contains c_hash\n";
                    if (!$code) {
                        $g_error .= "Code not found with ID Token response\n";
                    } else {
                        if (base64url_encode(substr(hash($hash_alg, $code, true), 0, $hash_length)) == $unpacked_id_token['jws'][1]['c_hash']) {
                            $g_info .= "Code Hash Verified\n";
                        } else {
                            $g_error .= "Code Hash Verification Failed for code {$code}\n";
                        }
                    }
                }
            }
        } else {
            $g_error .= "Unable to get Access Token.\n{$req_out}\n{$response_headers}\n{$data_responseText}";
            log_error($g_error);
            return;
        }
    } catch (Exception $e) {
        log_error("handle_callback exception : %s", $e->getMessage());
    }
}
Esempio n. 19
0
			<div class="form" id="dlg_form">

				<div class="panel panel-default form-group">
					<div class="panel-heading"><strong>Configs</strong></div>
					<div class="panel-body collapse in" id="modules">
						<div class="content">
							<div style="margin-top:5px">
								<p><div id="dists">
									No dispatchers created yet !<a target="_blank" href="http://www.python.org/">Depends on Python 2.7.*</a><br>
								</div></p>
								<p>Just paste following command at terminal prompt. <i>-m</i> options specifies maximum number of concurrent tasks.<br></p>
								<code>python hammer.py -s <?php 
echo $_SERVER['HTTP_HOST'] . str_replace('/task_create.php', '', $_SERVER['PHP_SELF']);
?>
 -t <?php 
$a = get_userinfo();
echo $a['Token'];
?>
 -l</code>
							</div>
						</div>
					</div>
				</div>
				<div class="panel panel-default form-group">
					<div class="panel-heading" data-toggle="collapse" data-target="#options" aria-expanded="true" aria-controls="options"><strong>Global Options</strong></div>
					<div class="panel-body collapse in" id="options">
						<div class="content" style="overflow: hidden; display: block;">
							<div class="row">
								<div class="col-md-2">
									<blockquote>Global</blockquote>
								</div>
Esempio n. 20
0
require_once 'workflows.php';
$wf = new Workflows();
date_default_timezone_set('Asia/Tokyo');
function trimAll($str)
{
    return str_replace(array("\r\n", "\n", "\r"), " ", $str);
}
function get_userinfo()
{
    $filename = "~/.hatebulist";
    $str = exec('cat ' . $filename, $output);
    $userinfo_array = explode(" ", $output[0]);
    return array('user_name' => $userinfo_array[0], 'api_key' => $userinfo_array[1]);
}
$user = get_userinfo();
$user_name = $user['user_name'];
$api_key = $user['api_key'];
#http://d.hatena.ne.jp/i_ogi/20100214/wsse
$url = "http://b.hatena.ne.jp/" . $user_name . "/search/json?q=" . $query . "&sort=date&limit=20";
$nonce = md5(mt_rand());
$created = date(DATE_ISO8601);
$x_wsse = sprintf('UsernameToken Username="******", PasswordDigest="%s", Nonce="%s", Created="%s"', $user_name, base64_encode(sha1($nonce . $created . $api_key, true)), base64_encode($nonce), $created);
$context = stream_context_create(array('http' => array('header' => "X-WSSE: {$x_wsse}\r\n" . "User-Agent: HatebuList.alfredworkflow")));
$file = file_get_contents($url, 0, $context);
$json = json_decode($file);
$dataList = $json;
foreach ($dataList->bookmarks as $data) {
    $entry = $data->entry;
    $title = $entry->title;
    $count = $entry->count;
Esempio n. 21
0
        $display = $header . $smarty->fetch(get_template_path('help.tpl'));
        echo $display;
        session::global_un_set('current_class_for_help');
        exit;
    }
    /* Save filename */
    $helpobject['file'] = $str[session::global_get('current_class_for_help')]['FILE'];
    /* Save path to the file */
    $helpobject['currentplug'] = $helpdir;
    /* Avoid displaying the same help every time */
    if (isset($_GET['pg'])) {
        session::global_un_set('current_class_for_help');
    }
} elseif (isset($_GET['plug'])) {
    /* This displays helpfiles depending on the current $_GET[plug] */
    $ui = get_userinfo();
    $tmp = new pluglist($config, $ui);
    $path = $tmp->get_path($_GET['plug']);
    $helpobject['currentplug'] = $path;
    $helpobject['file'] = "index.html";
    $helpdir = "../doc/core/" . $helpobject['lang'] . "/html/" . preg_replace("/^.*\\//i", "", $helpobject['currentplug']);
    if (empty($helpobject['currentplug'])) {
        $helpdir = "";
    }
}
/* this Post var is set if another page is requested */
if (isset($_GET['pg'])) {
    if (preg_match("/\\//", $_GET['pg'])) {
        $arr = explode("/", $_GET['pg']);
        $helpobject['currentplug'] = "../doc/core/" . $helpobject['lang'] . "/html/" . $arr[0];
        $helpdir = $helpobject['currentplug'];
Esempio n. 22
0
 function storeCenter()
 {
     if (!is_login()) {
         Cookie('__forward__', $_SERVER['REQUEST_URI']);
         redirect(U('home/user/login', array('from' => 2)));
     }
     $this->mid = 382;
     $info = get_userinfo($this->mid);
     $this->assign('info', $info);
     // dump ( $info );
     // 取优惠券
     $map['shop_uid'] = $this->mid;
     $list = M('coupon')->where($map)->select();
     $this->assign('coupons', $list);
     // dump($list);
     // 商家中心
     $this->display();
 }
 /**
  * 将用户添加到用户组的编辑页面
  * @author kevin <*****@*****.**>
  */
 public function group()
 {
     $uid = I('uid');
     $auth_groups = D('AuthGroup')->getGroups();
     $user_groups = AuthGroupModel::getUserGroup($uid);
     $ids = array();
     foreach ($user_groups as $value) {
         $ids[] = $value['group_id'];
     }
     $userInfo = get_userinfo($uid);
     $this->assign('userinfo', $userInfo);
     $this->assign('auth_groups', $auth_groups);
     $this->assign('user_groups', implode(',', $ids));
     $this->meta_title = '用户组授权';
     $this->display();
 }
Esempio n. 24
0
 function showLog()
 {
     $nav[0]['title'] = "投票列表";
     $nav[0]['class'] = "";
     $nav[0]['url'] = U("lists");
     $nav[1]['title'] = "投票记录";
     $nav[1]['class'] = "current";
     $this->assign('nav', $nav);
     $btn['url'] = U('lists', array('mdm' => $_GET['mdm']));
     $btn['title'] = '返回';
     $returnbtn[] = $btn;
     $this->assign('top_more_button', $returnbtn);
     $this->assign('add_button', false);
     $this->assign('search_button', false);
     $this->assign('del_button', false);
     $this->assign('check_all', false);
     $model = $this->vlog;
     $page = I('p', 1, 'intval');
     // 默认显示第一页数据
     // 解析列表规则
     $list_data = $this->_list_grid($model);
     unset($list_data['list_grids'][4]);
     $grids = $list_data['list_grids'];
     $fields = $list_data['fields'];
     // 搜索条件
     // $map ['addon'] = $this->addon;
     $map['vote_id'] = I('id');
     // $map ['token'] = get_token ();
     session('common_condition', $map);
     // $map = $this->_search_map ( $model, $fields );
     $row = empty($model['list_row']) ? 20 : $model['list_row'];
     empty($fields) || in_array('id', $fields) || array_push($fields, 'id');
     $name = parse_name(get_table_name($model['id']), true);
     $data = M($name)->field(empty($fields) ? true : $fields)->where($map)->order('id DESC')->page($page, $row)->select();
     //var_dump($data);
     // 获取投票标题
     // 		$map2 ['id'] = I ( 'id' );
     // 		$vname = M ( 'vote' )->where ( $map2 )->getField ( 'title' );
     foreach ($data as $v) {
         $option_ids[$v['options']] = $v['options'];
     }
     // 代码须优化
     // 获取投票选项名称
     if (!empty($option_ids)) {
         $map3['id'] = array('in', $option_ids);
         $list = M('vote_option')->where($map3)->field('id,name')->select();
         foreach ($list as $vo) {
             $option_names[$vo['id']] = $vo['name'];
         }
     }
     foreach ($data as &$v) {
         // 			$v ['vote_id'] = $vname;
         $v['options'] = $option_names[$v['options']];
         $user = get_userinfo($v['user_id']);
         $v['vote_id'] = url_img_html($user['headimgurl']);
         $v['user_id'] = get_nickname($v['user_id']);
     }
     $count = M($name)->where($map)->count();
     $list_data['list_data'] = $data;
     // 分页
     if ($count > $row) {
         $page = new \Think\Page($count, $row);
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
         $list_data['_page'] = $page->show();
     }
     unset($list_data["list_grids"][""]);
     $this->assign($list_data);
     //dump($list_data);
     $this->display('./Application/Home/View/default/Addons/lists.html');
 }
Esempio n. 25
0
 function profile()
 {
     $map['id'] = $this->mid;
     $info = get_userinfo($map['id']);
     $this->assign('info', $info);
     if (IS_POST) {
         if (!empty($_POST['truename']) && $_POST['truename'] != $info['truename']) {
             $data['truename'] = I('post.truename');
         }
         if (!empty($_POST['mobile']) && $_POST['mobile'] != $info['mobile']) {
             $data['mobile'] = I('post.mobile');
         }
         if (!empty($data)) {
             $res = D('Common/User')->updateInfo($map['id'], $data);
         }
         redirect(U('test', 'test_id=' . $_REQUEST['test_id']));
         exit;
     }
     $this->display();
 }
Esempio n. 26
0
<?php

$cfg = (include 'config.php');
$code = $_GET['code'];
$userinfo = get_userinfo($code, $cfg);
function https_request($url, $data)
{
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    if (curl_errno($curl)) {
        return 'Errno' . curl_error($curl);
    }
    curl_close($curl);
    return $result;
}
function get_userinfo($code, $cfg)
{
    //====获取access_token
    $access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $cfg['appid'] . "&secret=" . $cfg['appsecret'] . "&code=" . $code . "&grant_type=authorization_code";
    $access_token_result = https_request($access_token_url);
    $access_token_arr = json_decode($access_token_result, true);
    //====获取用户信息
    $userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token_arr['access_token'] . "&openid=" . $access_token_arr['openid'];
    $userinfo_result = https_request($userinfo_url);
    $userinfo_arr = json_decode($userinfo_result, true);