Exemplo n.º 1
1
 public static function scan($param)
 {
     list($data) = $param;
     self::_init();
     global $_G;
     if (!$_G['wechat']['setting']['wsq_allow']) {
         return;
     }
     $authcode = C::t('#wechat#mobile_wechat_authcode')->fetch_by_code($data['key']);
     if (!$authcode || $authcode['status']) {
         //			echo WeChatServer::getXml4Txt(lang('plugin/wechat', 'wechat_response_text_codeerror'));
     } else {
         if ($authcode['uid']) {
             $member = getuserbyuid($authcode['uid'], 1);
             if ($member['adminid'] == 0 && !$_G['wechat']['setting']['wechat_confirmtype']) {
                 C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $member['uid'], 'status' => 1));
                 $authcode['sid'] = '';
             }
         } else {
             $wechatuser = C::t('#wechat#common_member_wechat')->fetch_by_openid($data['from']);
             if ($wechatuser) {
                 $member = getuserbyuid($wechatuser['uid'], 1);
                 if ($member['adminid'] == 0 && !$_G['wechat']['setting']['wechat_confirmtype']) {
                     C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $member['uid'], 'status' => 1));
                     $authcode['sid'] = '';
                 }
             } elseif ($_G['wechat']['setting']['wechat_allowregister'] && $_G['wechat']['setting']['wechat_allowfastregister'] && $_G['wechat']['setting']['wechat_mtype'] == 2) {
                 require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.class.php';
                 require_once libfile('function/member');
                 $uid = WeChat::register(WeChat::getnewname($data['from']), 1);
                 if ($uid) {
                     WeChatHook::bindOpenId($uid, $data['from'], 1);
                     C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $uid, 'status' => 1));
                 }
                 wsq::report('register');
                 $authcode['sid'] = '';
             }
         }
         wsq::report('scanqr');
         self::_show('scan', $data['from'] . "\t" . $authcode['sid']);
     }
 }
Exemplo n.º 2
0
        showmessage('profile_passwd_notmatch');
    }
    if (!$_GET['newpassword1'] || $_GET['newpassword1'] != addslashes($_GET['newpassword1'])) {
        showmessage('profile_passwd_illegal');
    }
    loaducenter();
    uc_user_edit(addslashes($_G['member']['username']), null, $_GET['newpassword1'], null, 1);
    C::t('common_member')->update($_G['uid'], array('password' => md5(random(10))));
    if ($_G['wechat']['setting']['wechat_qrtype']) {
        C::t('#wechat#common_member_wechatmp')->update($_G['uid'], array('status' => 1));
    } else {
        C::t('#wechat#common_member_wechat')->update($_G['uid'], array('isregister' => 0));
    }
    showmessage('wechat:wsq_password_reset', dreferer());
} elseif (submitcheck('unbindsubmit')) {
    require_once libfile('function/member');
    if ($_G['wechat']['setting']['wechat_qrtype']) {
        require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
        $member = C::t('#wechat#common_member_wechatmp')->fetch($_G['uid']);
        if (!$member || !wsq::userunbind($_G['uid'], $member['openid'])) {
            showmessage('wechat:wechat_message_unbind_fail');
        }
        C::t('#wechat#common_member_wechatmp')->delete($_G['uid']);
    } else {
        C::t('#wechat#common_member_wechat')->delete($_G['uid']);
        require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
        wsq::report('unbind');
    }
    clearcookies();
    showmessage('wechat:wechat_message_unbinded', $_G['siteurl']);
}
Exemplo n.º 3
0
        $activity['class'] = $_GET['activityclass'];
        $activity['starttimefrom'] = @strtotime($_GET['starttimefrom']);
        $activity['starttimeto'] = $_GET['starttimeto'] ? @strtotime($_GET['starttimeto']) : 0;
        $activity['place'] = $_GET['activityplace'];
        $activity['expiration'] = @strtotime($_GET['activityexpiration']);
        $newthread = array('fid' => $_GET['fid'], 'posttableid' => 0, 'readperm' => 0, 'price' => 0, 'typeid' => 0, 'sortid' => 0, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $_GET['subject'], 'dateline' => TIMESTAMP, 'lastpost' => TIMESTAMP, 'lastposter' => $_G['username'], 'displayorder' => 1, 'digest' => 0, 'special' => 4, 'attachment' => 0, 'moderated' => 0, 'status' => 0, 'isgroup' => 0, 'replycredit' => 0, 'closed' => 0);
        $tid = C::t('forum_thread')->insert($newthread, true);
        $pid = insertpost(array('fid' => $_GET['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $_GET['subject'], 'dateline' => TIMESTAMP, 'message' => $_GET['message'], 'useip' => '', 'invisible' => 0, 'anonymous' => 0, 'usesig' => 0, 'htmlon' => 0, 'bbcodeoff' => 0, 'smileyoff' => 0, 'parseurloff' => 0, 'attachment' => '0', 'tags' => '', 'replycredit' => 0, 'status' => 0));
        $data = array('tid' => $tid, 'uid' => $_G['uid'], 'cost' => 0, 'starttimefrom' => $activity['starttimefrom'], 'starttimeto' => $activity['starttimeto'], 'place' => $activity['place'], 'class' => $activity['class'], 'expiration' => $activity['expiration']);
        C::t('forum_activity')->insert($data);
        $setting['showactivity']['tids'][$tid] = $tid;
        $settings = array('mobilewechat' => serialize($setting));
        C::t('common_setting')->update_batch($settings);
        updatecache(array('plugin', 'setting'));
        require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
        wsq::report('pubshowactivity');
        cpmsg(lang('plugin/wechat', 'show_addthread_succeed'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=showactivity_setting', 'succeed');
    }
} elseif ($ac == 'export') {
    if (!isset($setting['showactivity']['tids'][$_GET['tid']])) {
        cpmsg(lang('plugin/wechat', 'show_thread_not_found'));
    }
    $thread = get_thread_by_tid($_GET['tid']);
    if (!$thread) {
        cpmsg(lang('plugin/wechat', 'show_thread_not_found'));
    }
    $posttableid = $thread['posttableid'];
    $posts = DB::fetch_all("SELECT * FROM %t WHERE tid=%d", array('forum_debatepost', $_GET['tid']), 'pid');
    foreach (C::t('forum_post')->fetch_all($posttableid, array_keys($posts), false) as $post) {
        $array[$posts[$post['pid']]['voters'] . '.' . $post['position']] = $post['author'] . ',' . $posts[$post['pid']]['voters'] . ',' . $post['position'];
    }
Exemplo n.º 4
0
            setloginstatus($member, 1296000);
            dsetcookie('wechat_ticket', '', -1);
            $echostr = 'done';
        } else {
            $echostr = '1';
            //json_encode($authcode);
        }
    } else {
        $echostr = '-1';
    }
    if (!ob_start($_G['gzipcompress'] ? 'ob_gzhandler' : null)) {
        ob_start();
    }
    if ($echostr === 'done') {
        C::t('#wechat#mobile_wechat_authcode')->delete($authcode['sid']);
    }
    include template('common/header_ajax');
    echo $echostr;
    include template('common/footer_ajax');
    exit;
}
if ($_G['cookie']['qrauth']) {
    $qrauth = authcode(base64_decode($_G['cookie']['qrauth']), 'DECODE', $_G['config']['security']['authkey']);
}
if (!$_G['wechat']['setting']['wechat_qrtype']) {
    require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
    require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
    list($isqrapi, $qrcodeurl, $codeenc, $code) = WeChat::getqrcode();
    wsq::report('siteqrshow');
}
include_once template('wechat:wechat_qrcode');