Example #1
0
 public function __construct($token, $wechat_id, $data, $siteUrl, $key)
 {
     $this->wechat_id = $wechat_id;
     $this->siteUrl = $siteUrl;
     $this->token = $token;
     $this->thisWxUser = M('Wxuser')->field('appid,appsecret,winxintype')->where(array('token' => $token))->find();
     $this->keyword = $keyword = $key;
     $this->db = M($data['module']);
     $like['keyword'] = $keyword;
     $like['precisions'] = 1;
     $like['token'] = $this->token;
     $data2 = M('keyword')->where($like)->order('id desc')->find();
     if (!$data2) {
         $like['keyword'] = array('like', '%' . $keyword . '%');
         $like['precisions'] = 0;
         $data2 = M('keyword')->where($like)->order('id desc')->find();
     }
     if ('img' == strtolower($data2['module']) && 2 < $this->thisWxUser['winxintype']) {
         $groupid = $this->getGroupId();
         $like2 = '( concat(\',\',wechat_group,\',\') LIKE \'%,' . $groupid . ',%\' OR wechat_group = \'\' ) ';
         if ($like['precisions']) {
             $like2 .= 'AND keyword = \'' . $like['keyword'] . '\' ';
         } else {
             $like2 .= 'AND keyword LIKE \'' . $like['keyword'][1] . '\' ';
         }
         $like2 .= 'AND precisions = \'' . $like['precisions'] . '\' ';
         $like2 .= 'AND token = \'' . $like['token'] . '\' ';
         $like = $like2;
     }
     $this->item = M($data2['module'])->field('id,text,pic,url,title')->limit(9)->order('usort desc')->where($like)->select();
     $this->action = A('Home/Weixin');
 }
Example #2
0
 public function callback($type = null, $code = null)
 {
     header('content-type:text/html;charset=UTF-8;');
     (empty($type) || empty($code)) && $this->error('参数错误');
     //加载ThinkOauth类并实例化一个对象
     import("ThinkSDK");
     $sns = ThinkOauth::getInstance($type);
     //腾讯微博需传递的额外参数
     $extend = null;
     if ($type == 'tencent') {
         $extend = array('openid' => I("get.openid"), 'openkey' => I("get.openkey"));
     }
     //请妥善保管这里获取到的Token信息,方便以后API调用
     //调用方法,实例化SDK对象的时候直接作为构造函数的第二个参数传入
     //如: $qq = ThinkOauth::getInstance('qq', $token);
     $token = $sns->getAccessToken($code, $extend);
     //获取当前登录用户信息
     if (is_array($token)) {
         $user_info = A('Type', 'Event')->{$type}($token);
         if ($_SESSION["MEMBER_type"] == 'local') {
             self::_bang_handle($user_info, $type, $token);
         } else {
             self::_login_handle($user_info, $type, $token);
         }
     } else {
         $this->success('登录失败!', U("Portal/index/index"));
     }
 }
 public function download()
 {
     $r_mac = I('param.mac', '');
     $Public = A('Public');
     $webid = I('get.id', '');
     $Web = M('website');
     $web = $Web->join('rou_ap_main on rou_ap_main.id=rou_website.rid')->where('rou_ap_main.mac=' . $r_mac)->find();
     foreach ($web as $k => $v) {
         if ($v === '') {
             $Public->error('请先配置站点');
         }
     }
     $WebNav = M('webnav');
     $nav = $WebNav->where(array('wid' => $webid, 'is_show' => 1))->select();
     $navStr = '';
     foreach ($nav as $item) {
         $navStr .= '<option>' . $item['navname'] . '</option>';
     }
     $path = '/Down/' . $web['filename'] . '/';
     //生成配置文件
     $config = '<title>' . $web['web_name'] . '</title>
     <address>' . $web['address'] . '</address>
     <phone>' . $web['phone'] . '</phone>
     <email>' . $web['email'] . '</email>
     <nav>' . $navStr . '</nav>';
     $suffix = date('YmdHis', time()) . '_' . rand(0, 999);
     $hd = fopen(WEB_ROOT . $path . 'config_' . $suffix . '.txt', 'w') or die('无法打开文件');
     fwrite($hd, $config);
     fclose($hd);
     $zip = new \Org\Util\PHPZip();
     $zip->ZipAndDownload(WEB_ROOT . $path);
 }
 public function readMessage()
 {
     $mailInbox = A("MisMessageInbox");
     // 实例化UserAction控制器对象
     $mailInbox->readMessage($_REQUEST['id'], false);
     // 调用User模块的importUser操作方法
 }
 public function module1()
 {
     if (I('module', '', 'text') != '') {
         $_SESSION['module'] = I('module', '', 'text');
     }
     $this->refreshSession();
     $menus = $this->getSubMenus(0);
     $all_menus = M('Menu')->where(array('status' => 1, 'module' => $this->module['name']))->select();
     $this->assign('menus', $menus);
     $controller_name = $this->module['name'];
     $path = APP_PATH . $controller_name . '/' . 'Controller' . '/' . $controller_name . 'Controller.class.php';
     if (file_exists($path)) {
         require_once $path;
         $controller = A('Admin/' . $controller_name);
         $methods = $this->get_class_all_methods($controller);
         foreach ($all_menus as &$v) {
             $v['url'] = strtolower($v['url']);
         }
         unset($v);
         $all_menus_url = getSubByKey($all_menus, 'url');
         foreach ($methods as $m) {
             if (!in_array(strtolower($this->module['name'] . '/' . $m['name']), $all_menus_url)) {
                 $havent_created[] = $m;
             }
         }
         $this->assign('havent_created', $havent_created);
         $this->assign('created', 1);
     }
     $this->display(T('Devtool@Admin/module1'));
 }
Example #6
0
 public function edit()
 {
     if (IS_POST) {
         $arr = I('post.');
         if (!$arr['msg']) {
             $this->error('内容不能为空');
         }
         $arr['status'] = 1;
         $arr['uid'] = 0;
         $arr['type'] = 1;
         $arr['create_time'] = time();
         $message = array('title' => $arr['msg'], 'description' => $arr['msg']);
         $push = A('Addons://Baidupush/push');
         $push->__construct('', '', 1);
         $push->pushMessage_all($message);
         $push->__construct('', '', 2);
         $push->pushMessage_all($message);
         $res = M('baidu_msg')->add($arr);
         if ($res) {
             $this->success('推送成功', addons_url("Baidupush://Baidu/lists"));
         } else {
             $this->error('推送失败');
         }
     } else {
         $this->display(T('Addons://Baidupush@Baidu/edit'));
     }
 }
    public function index()
    {
        $admin_config = new AdminConfigBuilder();
        $data = $admin_config->handleConfig();
        $mStep = A('Ucenter/RegStep', 'Widget')->mStep;
        $step = array();
        foreach ($mStep as $key => $v) {
            $step[] = array('data-id' => $key, 'title' => $v);
        }
        $default = array(array('data-id' => 'disable', 'title' => '禁用', 'items' => $step), array('data-id' => 'enable', 'title' => '启用', 'items' => array()));
        //$default=array('禁用'=>$step,'启用并可跳过'=>array(),'启用但不可跳过'=>array());
        $data['REG_STEP'] = $admin_config->parseKanbanArray($data['REG_STEP'], $step, $default);
        empty($data['LEVEL']) && ($data['LEVEL'] = <<<str
0:Lv1 实习
50:Lv2 试用
100:Lv3 转正
200:Lv4 助理
400:Lv 5 经理
800:Lv6 董事
1600:Lv7 董事长
str
);
        empty($data['OPEN_QUICK_LOGIN']) && ($data['OPEN_QUICK_LOGIN'] = 0);
        $admin_config->title('用户配置')->keyCheckBox('REG_SWITCH', '注册开关', '允许使用的注册选项,全不选即为关闭注册', array('username' => '用户名', 'email' => '邮箱', 'mobile' => '手机'))->keyRadio('EMAIL_VERIFY_TYPE', '邮箱验证类型', '邮箱验证的类型', array(0 => '不验证', 1 => '注册后发送激活邮件', 2 => '注册前发送验证邮件'))->keyRadio('MOBILE_VERIFY_TYPE', '手机验证类型', '手机验证的类型', array(0 => '不验证', 1 => '注册前发送验证短信'))->keyKanban('REG_STEP', '注册步骤', '注册后需要进行的步骤')->keyCheckBox('REG_CAN_SKIP', '注册步骤是否可跳过', '勾选为可跳过,默认不可跳过', $mStep)->keyEditor('REG_EMAIL_VERIFY', '邮箱验证模版', '用于进行邮箱的验证', 'all')->keyEditor('REG_EMAIL_ACTIVATE', '邮箱激活模版', '用于进行用户的激活')->keyCheckBox('SMS_SP', '短信提供商', '可选的短信通道提供商,全不选即为关闭短信通道', array('ucpaas' => '云之讯', 'UCToo' => 'UCToo'))->keyText('SMS_HTTP', '短信平台HTTP', '短信平台HTTP')->keyText('SMS_HTTPS', '短信平台HTTPS', '短信平台HTTPS')->keyText('SMS_UID', '短信平台帐号', '短信平台帐号')->keyText('SMS_PWD', '短信平台密码', '短信平台密码')->keyText('SMS_ACCOUNTSID', '短信平台开发者ID', '短信平台开发者ID')->keyText('SMS_TOKEN', '短信平台TOKEN', '短信平台TOKEN')->keyText('SMS_APPID', '短信平台应用ID', '短信平台应用ID')->keyText('SMS_TEMPLATEID', '短信平台模板ID', '短信平台模板ID')->keyTextArea('SMS_CONTENT', '短信内容', '短信内容')->keyTextArea('LEVEL', '等级配置', '每行一条,名称和积分之间用冒号分隔')->keyRadio('OPEN_QUICK_LOGIN', '快捷登录', '默认关闭,开启后用户登录方式更换成快捷登录!', array(0 => '关闭', 1 => '开启'))->group('注册配置', 'REG_SWITCH,EMAIL_VERIFY_TYPE,MOBILE_VERIFY_TYPE,REG_STEP,REG_CAN_SKIP')->group('登录配置', 'OPEN_QUICK_LOGIN')->group('邮箱验证模版', 'REG_EMAIL_VERIFY')->group('邮箱激活模版', 'REG_EMAIL_ACTIVATE')->group('短信配置', 'SMS_SP,SMS_HTTP,SMS_HTTPS,SMS_UID,SMS_PWD,SMS_ACCOUNTSID,SMS_TOKEN,SMS_APPID,SMS_TEMPLATEID,SMS_CONTENT')->group('基础设置', 'LEVEL')->buttonSubmit('', '保存')->data($data);
        $admin_config->display();
    }
 public function getJsApiTicket()
 {
     // jsapi_ticket 应该全局存储与更新,以下代码以写入到文件中做示例
     //$data = json_decode(file_get_contents("jsapi_ticket.json"));
     //if ($data->expire_time < time()) {
     $manage = A('Manage');
     $accessToken = $manage::get_token(8);
     //八点阳光的token
     //$accessToken = $this->getAccessToken();
     // 如果是企业号用以下 URL 获取 ticket
     // $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
     $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$accessToken}";
     $res = json_decode($this->httpGet($url));
     $ticket = $res->ticket;
     if ($ticket) {
         $data->expire_time = time() + 7000;
         $data->jsapi_ticket = $ticket;
         $fp = fopen("jsapi_ticket.json", "w");
         fwrite($fp, json_encode($data));
         fclose($fp);
     } else {
         $ticket = $data->jsapi_ticket;
     }
     //echo $ticket;die;
     return $ticket;
 }
Example #9
0
 function showlist()
 {
     //获得User控制器的number方法返回的信息
     //当前UserController会通过自动加载机制引入
     //ThinkPHP/Library/Think/Think.class.php
     // function autoload();
     $user = new UserController();
     //通过快捷函数实例化控制器对象
     //new一个控制器对象给我们返回
     //A([项目://][模块/]控制器标志);
     $user = A("User");
     echo $user->number();
     $goods = A("Admin/Goods");
     echo $goods->getMoney();
     //跨项目、跨模块调用指定控制器
     //$index = A("book://Home/Index");
     //echo $index -> getName();
     //简便操作
     //R("[项目://][模块/]控制器/操作方法")
     //实例化对象之后再调用其对应的方法
     echo R("User/number");
     echo R("Admin/Goods/getMoney");
     //echo R("book://Home/Index/getName");
     $this->display();
 }
Example #10
0
 public function userinfo()
 {
     $common = A("Common/Common");
     $common->getHomeMenu();
     $common->getHomeSlide();
     $this->display();
 }
Example #11
0
 public function index()
 {
     $options = A(['order_by' => empty($this->sortable) ? 'id' : $this->sortable, 'order' => 'desc', 'per_page' => $this->per_page, 'page' => 0])->mergeF($this->params);
     $this->paginate($options->per_page);
     $where = [];
     if (!empty($this->readable_fields)) {
         foreach ($this->readable_fields as $field) {
             if (!empty($this->params[$field])) {
                 $where[$field] = $this->params[$field];
             }
         }
     }
     if (!empty($this->belongs_to)) {
         $where[$this->belongs_to['key']] = $this->parent_model->id;
     }
     if (!empty($this->viewmodel)) {
         $model_class = $this->viewmodel;
     } else {
         $model_class = $this->model;
     }
     $model_object = $model_class::where($where);
     if (!empty($this->join)) {
         $model_object = $model_object->join($join);
     }
     if (!empty($this->readable_fields)) {
         $model_object = $model_object->columns($this->readable_fields);
     }
     return $this->json($model_object->order($options->order_by, $options->order)->page($options->page, $options->per_page)->all());
 }
Example #12
0
 public function indexCase()
 {
     $result = A('Api')->getZhouchouAll();
     //print_r('<pre>');
     //print_r($result['data']);exit;
     $this->assign('now', time());
     $this->assign('zhongchou', $result['data']);
     $this->model = D('Case');
     $where = array('decoration_type' => 1);
     if ($this->para['style'] > 0) {
         $where = array('style' => $this->para['style']);
     }
     if ($this->para['housetype'] > 0) {
         $where = array('housetype' => $this->para['housetype']);
     }
     $data = $this->model->getList($where, 'recommend desc, createtime desc', 6);
     $this->assign('caseType1', $data);
     $where = array('decoration_type' => 2);
     if ($this->para['style']) {
         $where = array_merge($where, array('style' => $this->para['style']));
     }
     if ($this->para['housetype']) {
         $where = array_merge($where, array('housetype' => $this->para['housetype']));
     }
     $data = $this->model->getList($where, 'recommend desc, createtime desc', 6);
     //var_dump($data);
     $this->assign('caseType2', $data);
     $this->assign('housetype', $this->_aBaseOptions['houseType']);
     $this->assign('style', $this->_aBaseOptions['style']);
     $this->assign('decorationType', $this->_aBaseOptions['decorationType']);
     $this->assign('search', $this->para);
     $this->display();
 }
function A($k, $x1, $x2, $x3, $x4, $x5)
{
    $b = function () use(&$b, &$k, $x1, $x2, $x3, $x4) {
        return A(--$k, $b, $x1, $x2, $x3, $x4);
    };
    return $k <= 0 ? $x4() + $x5() : $b();
}
Example #14
0
 public function index()
 {
     if (session('current_item') != 'Diary' && session('?current_item')) {
         $this->redirect(session('current_item') . "/index");
     }
     if ($_SESSION['LOGIN_STATUS']) {
         C('LAYOUT_ON', TRUE);
         //开启模板布局
         $cdt['userName'] = $_SESSION['USER_NAME'];
         $diarys = $this->diary_model->where($cdt)->order('date desc')->limit(10)->select();
         $totalCount = $this->diary_model->where($cdt)->count();
         $totalPage = $totalCount / $this->page_size;
         $this->assign('totalCount', $totalCount)->assign('pageSize', $this->page_size)->assign('totalPage', $totalPage);
         for ($i = 0; $i < count($diarys); $i++) {
             $diarys[$i]['tag'] = explode(" ", $diarys[$i]['tag']);
         }
         $user_info = A('User')->get_user_info(session('USER_NAME'));
         $essay_nums = A('Essay')->get_essay_nums(session('USER_NAME'));
         $diary_nums = A('Diary')->get_diary_nums(session('USER_NAME'));
         $piece_nums = A('Piece')->get_piece_nums(session('USER_NAME'));
         $this->assign('diarys', $diarys)->assign('user', $user_info)->assign(array('essay_nums' => $essay_nums, 'diary_nums' => $diary_nums, 'piece_nums' => $piece_nums));
         $this->display();
     } else {
         $this->error('尚未登录,无法操作!', U("Action/login"));
     }
 }
 public function callback($type = null, $code = null)
 {
     empty($type) && $this->error('参数错误');
     if (empty($code)) {
         redirect(__ROOT__ . "/");
     }
     //加载ThinkOauth类并实例化一个对象
     import("ThinkOauth");
     $sns = \ThinkOauth::getInstance($type);
     //腾讯微博需传递的额外参数
     $extend = null;
     if ($type == 'tencent') {
         $extend = array('openid' => I("get.openid"), 'openkey' => I("get.openkey"));
     }
     //请妥善保管这里获取到的Token信息,方便以后API调用
     //调用方法,实例化SDK对象的时候直接作为构造函数的第二个参数传入
     //如: $qq = ThinkOauth::getInstance('qq', $token);
     $token = $sns->getAccessToken($code, $extend);
     //获取当前登录用户信息
     if (is_array($token)) {
         $user_info = A('Type', 'Event')->{$type}($token);
         if (!empty($_SESSION['oauth_bang'])) {
             $this->_bang_handle($user_info, $type, $token);
         } else {
             $this->_login_handle($user_info, $type, $token);
         }
     } else {
         $this->success('登录失败!', $this->_get_login_redirect());
     }
 }
 /**
  * 所有AP30天内认证用户走势图
  */
 public function allApVisitor_30()
 {
     if (IS_AJAX) {
         $Public = A('Public');
         $aps = $Public->treeAp(session('userId'));
         $ap_id = array();
         foreach ($aps as $item) {
             $ap_id[] = $item['id'];
         }
         $Mac = D('Mac');
         $data['rid'] = array('in', implode(',', $ap_id));
         //   $data['stime'] = array('between',array(strtotime(date('Y-m-d',time()))-30*24*3600,strtotime(date('Y-m-d',time()))));
         //    $mac = $Mac->where($data)->select();
         //    var_dump($mac);
         $arr = array();
         $len = 30;
         for ($i = $len; $i > 0; $i--) {
             $data['stime'] = array('between', array(strtotime(date('Y-m-d', time())) - $i * 24 * 3600, strtotime(date('Y-m-d', time())) - ($i - 1) * 24 * 3600));
             $arr['mac'][] = (int) $Mac->where($data)->count();
             $arr['time'][] = $i;
         }
         //var_dump($arr);die;
         echo json_encode($arr);
     }
 }
Example #17
0
 /**
  * 采集页
  */
 public function parse()
 {
     // 类别
     $categorytop = M("category")->where(array("pid" => 0))->select();
     $this->assign("categorytop", $categorytop);
     // 采集
     if (Q("post.websiteText")) {
         $url = Q("post.websiteText");
         $update = Q("update");
         $collect = A("Data/Proxy/index", array($url, $update));
         $this->assign("collect", $collect);
         $update == "auto" ? $ufs = 1 : ($ufs = 0);
         $collect["auto_disabled"] ? $auto_disabled = 1 : ($auto_disabled = 0);
         Q("post.ctype") == "plural" ? $ctype = 1 : ($ctype = 0);
         Q("post.collection") ? $collection = 1 : ($collection = 0);
         $fs = array("update" => $ufs, "auto_disabled" => $auto_disabled, "ctype" => $ctype, "collection" => $collection);
         $website = $url;
     } else {
         $website = "请填入需采集的视频地址";
         $fs = array("update" => 0, "auto_disabled" => 0, "ctype" => 0, "collection" => 0);
     }
     if (Q("get.url")) {
         $yy_url = A("Data/Proxy/collect", array(Q("get.url")));
         $this->assign("yyurl", $yy_url);
     }
     if (!Q("session.username") && !Q("session.uid") && Q("session.group") != 1) {
         $readonly = true;
     } else {
         $readonly = false;
     }
     $this->assign("updatefs", $fs);
     $this->assign("readonly", $readonly);
     $this->assign("website", $website);
     $this->display();
 }
Example #18
0
 public function callback($type = null, $code = null)
 {
     (empty($type) || empty($code)) && $this->error('参数错误');
     //加载ThinkOauth类并实例化一个对象
     import("ORG.ThinkSDK.ThinkOauth");
     $sns = ThinkOauth::getInstance($type);
     //腾讯微博需传递的额外参数
     $extend = null;
     if ($type == 'tencent') {
         $extend = array('openid' => $this->_get('openid'), 'openkey' => $this->_get('openkey'));
     }
     //请妥善保管这里获取到的Token信息,方便以后API调用
     //调用方法,实例化SDK对象的时候直接作为构造函数的第二个参数传入
     //如: $qq = ThinkOauth::getInstance('qq', $token);
     $token = $sns->getAccessToken($code, $extend);
     //获取当前登录用户信息
     if (is_array($token)) {
         $user_info = A('Type', 'Event')->{$type}($token);
         echo "<h1>恭喜!使用 {$type} 用户登录成功</h1><br>";
         echo "授权信息为:<br>";
         dump($token);
         echo "当前登录用户信息为:<br>";
         dump($user_info);
     }
 }
Example #19
0
 public function main()
 {
     if (!A()->isAdmin()) {
         return R('/');
     }
     return T()->newevent(['formAction' => U('/create/')]);
 }
 public function replyCode()
 {
     $openId = (string) $this->postObj->FromUserName;
     $customerInfo = get_customer_info($openId);
     $customerId = $customerInfo['id'];
     $url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s';
     $accessToken = get_access_token();
     $url = sprintf($url, $accessToken);
     $data['expire_seconds'] = 1800;
     $data['action_name'] = $this->actionName;
     $data['action_info'] = array('scene' => array('scene_id' => (int) $customerId));
     $data = json_encode($data);
     //                $replyMessage = A('ReplyMessage');
     //            $replyMessage->setText('传入的JSON数据为' . $data);
     //            $replyMessage->replyTextMessage();
     //            return;
     $res = http_post_json($url, $data);
     $res = json_decode($res);
     $ticket = $res->ticket;
     $ticket = urlencode($ticket);
     $replyMessage = A('ReplyMessage');
     $picUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . $ticket;
     $url = $picUrl;
     $title = '您的专属二维码';
     $description = '其它用户通过扫描该二维码关注我们,将自动成为您的朋友。';
     $news[] = array('title' => $title, 'description' => $description, 'picurl' => $picUrl, 'url' => $url);
     $replyMessage->setNews($news);
     $replyMessage->replyNewsMessage();
 }
Example #21
0
 function testCiba()
 {
     //该方法将自动被测试
     $Columns = A("Ciba");
     $Columns->index();
     $this->assertNotEmpty($Columns);
 }
Example #22
0
 public function view_printArea()
 {
     //$locationPrintAct = new LocationPrintAct();
     $info = A('LocationPrint')->act_printArea();
     $this->smarty->assign('info', $info);
     $this->smarty->display('printLocation.htm');
 }
 public function indexAction()
 {
     //        $valid = new ValidController();
     //        $valid->valid();
     //获取微信传输信息
     $postObj = $this->postObj;
     $responseMsg = A('ResponseMsg');
     if ($postObj->MsgType == 'text') {
         //调用回复消息实例化方法
         // $responseMsg->responseTextMsg();
     } elseif ($postObj->MsgType == 'event') {
         $responseMsg = A('ResponseEvent');
         //菜单事件
         if ($postObj->Event == 'CLICK') {
             $responseMsg->responseClickMsg();
         } elseif ($postObj->Event == 'subscribe') {
             $responseEvent = A('ResponseEvent');
             $responseEvent->responseSubscribeMsg();
         } elseif ($postObj->Event == 'unsubscribe') {
             $responseEvent = A('ResponseEvent');
             $responseEvent->responseUnsubscribeMsg();
         } elseif ($postObj->Event == 'SCAN') {
             $responseEvent = A('ResponseEvent');
             $responseEvent->responseScanMsg();
         }
     }
 }
 public function login()
 {
     $ac = A('Account');
     $id = I('post.id');
     $password = md5(I('post.password'));
     $account = $ac->getAccount($id);
     /*
     	$verify = I('param.verify','');
     if(!check_verify($verify)){
     	$this->error("验证码错误!");
     }
     */
     if ($account == null) {
         $this->error("没有这个账号!");
     }
     if ($password == $account['apassword']) {
         //密码正确
         /*设置session信息*/
         session('name', $account['aname']);
         session('id', $account['aid']);
         session('privilege', $account['aprivilege']);
         session('role', $account['arole']);
         session('expire', '3600');
         $this->redirect('Index/index');
     } else {
         $this->error("密码错误!");
     }
 }
 public function execute($_addons = null, $_controller = null, $_action = null)
 {
     if (!empty($_action) && !empty($_addons) && empty($_controller)) {
         $_controller = $_GET['_controller'] = $_addons;
         $_REQUEST['_controller'] = $_REQUEST['_addons'];
     }
     if (C('URL_CASE_INSENSITIVE')) {
         $_addons = ucfirst(parse_name($_addons, 1));
         $_controller = parse_name($_controller, 1);
     }
     define('ADDON_PUBLIC_PATH', __ROOT__ . '/Addons/' . $_addons . '/View/default/Public');
     defined('_ADDONS') or define('_ADDONS', $_addons);
     defined('_CONTROLLER') or define('_CONTROLLER', $_controller);
     defined('_ACTION') or define('_ACTION', $_action);
     $token = get_token();
     if (in_array($_action, array('lists', 'config', 'nulldeal')) && (empty($token) || $token == '-1')) {
         $this->error('请先增加公众号!', U('Home/MemberPublic/lists'));
     }
     $this->_nav();
     if (!empty($_addons) && !empty($_controller) && !empty($_action)) {
         tongji($_addons);
         A("Addons://{$_addons}/{$_controller}")->{$_action}();
     } else {
         $this->error('没有指定插件名称,控制器或操作!');
     }
 }
 /**
  * @Title: edit
  * @Description: todo(重写父类编辑函数)
  * @author 管理员
  * @date 2015-01-27 10:48:48
  * @throws 
  */
 function edit($isdisplay = 1)
 {
     $mainTab = 'mis_system_templete_manage';
     //获取当前控制器名称
     $name = $this->getActionName();
     $model = D("MisSystemTempleteManageView");
     //获取当前主键
     $map[$mainTab . '.id'] = $_REQUEST['id'];
     $vo = $model->where($map)->find();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     //读取动态配制
     $this->getSystemConfigDetail($name);
     //扩展工具栏操作
     $scdmodel = D('SystemConfigDetail');
     // 上一条数据ID
     $map['id'] = array("lt", $id);
     $updataid = $model->where($map)->order('id desc')->getField('id');
     $this->assign("updataid", $updataid);
     // 下一条数据ID
     $map['id'] = array("gt", $id);
     $downdataid = $model->where($map)->getField('id');
     $this->assign("downdataid", $downdataid);
     //lookup带参数查询
     $module = A($name);
     if (method_exists($module, "_after_edit")) {
         call_user_func(array(&$module, "_after_edit"), &$vo);
     }
     $this->assign('vo', $vo);
     if ($isdisplay) {
         $this->display();
     }
 }
 protected function _initialize()
 {
     $this->where = 'Ask';
     $this->title = '提问';
     A('AutoLogin')->autoLogin();
     A('Hot')->getHotList();
 }
Example #28
0
 public function parseRequestHeader($data)
 {
     $data = A('Api')->merge($data);
     $lines = explode("\n", $data['requestContent']);
     if (array_search("\r", $lines) === false) {
         return false;
     }
     //http请求头信息也需要解析存储
     $ret['header'] = $this->httpParseHeaders($data['requestContent']);
     $arr = explode(" ", trim($lines[0]));
     $ret['method'] = $arr[0];
     //EG:GET http://ptcms.csdn.net/comment/comment/hot?pagesize=50&test=123
     $url = parse_url(trim($arr[1]));
     $ret['protocol'] = $url['scheme'];
     $ret['host'] = $url['host'];
     $ret['port'] = is_null($url['port']) ? 80 : $url['port'];
     $ret['path'] = $url['path'];
     //参数列表暂时先返回字符串吧。。。
     if ($ret['method'] == 'GET') {
         $data['params'] = $url['query'];
     } else {
         $data['params'] = $lines[array_search("\r", $lines) + 1];
     }
     if (in_array(null, $ret)) {
         return false;
     }
     return array_merge($data, $ret);
 }
Example #29
0
 protected function push2user1($uid, $msg, $style = 0, $content_id = 0, $id = 0, $pc = 1, $token = "")
 {
     if (!$msg || !$token) {
         return false;
     }
     $arr['title'] = $msg;
     $arr['description'] = $msg;
     $arr['aps']['alert'] = $msg;
     $arr['custom_content']['style'] = $style != 3 && $content_id ? 1 : 0;
     $arr['custom_content']['date_id'] = $content_id;
     $arr['custom_content']['uid'] = $uid;
     $arr['custom_content']['success'] = true;
     $arr['style'] = $style != 3 && $content_id ? 1 : 0;
     $arr['date_id'] = $content_id;
     $arr['uid'] = $uid;
     $arr['success'] = true;
     if ($style != 3 && $content_id) {
         $date_type = $this->getDateType($content_id);
         $arr['custom_content']['date_type'] = $date_type;
         $arr['date_type'] = $date_type;
     }
     $arr['custom_content']['id'] = $id;
     $arr['id'] = $id;
     $msg = json_encode($arr);
     $push = A('Addons://Baidupush/push');
     $push->__construct('', '', $pc);
     if ($pc == 1) {
         $push->pushMessage_android($msg, 0, $token);
     } elseif ($pc == 2) {
         $push->pushMessage_ios($msg, 0, $token);
     }
 }
Example #30
0
 public function index()
 {
     $uid = getvar('uid', 1);
     $member = M();
     $m = $member->table('qh_member AS A')->field('A.*, B.receive_score_num, B.fav_out_num, B.fav_in_num, B.question_num, B.answer_num, B.diary_num, B.wenwen_num')->join("qh_member_field AS B ON A.uid=B.uid")->where("A.uid={$uid}")->find();
     if (!$m) {
         $this->error('找不到此人');
     }
     $this->assign('m', $m);
     $f = $v = NULL;
     if ($GLOBALS['islogin']) {
         $visit = A('Visit');
         $visit->add();
         $fav = M('fav');
         $f = $fav->where("uid={$GLOBALS['i']['uid']} AND fav_uid={$uid}")->find();
         $visit = M('visit');
         $v = $visit->where("uid={$GLOBALS['i']['uid']} AND visit_uid={$uid}")->find();
     }
     $this->assign('f', $f);
     $this->assign('v', $v);
     $photo = M('photo');
     $personal = $photo->where("uid={$uid} AND gid=0")->select();
     $this->assign('personal', $personal);
     $photo_group = M('photo_group');
     $pglist = $photo_group->where("uid={$uid} AND photonum>0")->limit(4)->select();
     $this->assign('pglist', $pglist);
     $wenwen = M("wenwen_question");
     $wenwenlist = $wenwen->field('qh_wenwen_question.*, qh_wenwen_answer.id,username, content')->join("RIGHT JOIN qh_wenwen_answer ON qh_wenwen_answer.qid = qh_wenwen_question.qid ")->where("uid={$uid}")->limit(10)->select();
     //echo $wenwen->getLastSql();
     $this->assign('wenwenlist', $wenwenlist);
     $question = M("question");
     $qlist = $question->where("uid={$uid} AND is_anonymity=0")->order('add_time desc')->limit(5)->select();
     $qt = M('question_type');
     $qtlist = $qt->select();
     foreach ($qtlist as $t) {
         $qtlist[$t['id']] = $t['name'];
     }
     $this->assign('qtlist', $qtlist);
     $this->assign('qlist', $qlist);
     $answer = M("answer");
     $map['qh_answer.uid'] = $uid;
     $map['qh_question.is_anonymity'] = 0;
     $alist = $answer->join("LEFT JOIN qh_question ON qh_answer.q_id=qh_question.id")->where($map)->order('answer_time DESC')->limit(5)->select();
     //echo $answer->getLastSql();
     $this->assign('alist', $alist);
     $diary = M('diary');
     $diarylist = $diary->where("uid={$uid}")->order("did DESC")->select();
     $this->assign('diarylist', $diarylist);
     //动态
     $feed = M('feed');
     $feedData = $feed->where("uid={$m['uid']}")->order('add_time DESC')->limit(10)->select();
     $this->assign('feedData', $feedData);
     //动态结束
     //随缘推荐
     $member = M('member');
     $recommendlist = $member->field('uid, username, default_pic, height, birth_y')->where("uid<{$m['uid']} AND sex={$m['sex']} AND default_photonum>0 AND group_type>0")->order('uid DESC')->limit(6)->select();
     $this->assign('recommendlist', $recommendlist);
     //随缘推荐结束
     $this->display();
 }