Пример #1
0
    showsubmit('settingsubmit');
    showtablefooter();
    showformfooter();
} else {
    if ($_GET['setting']['wechat_mtype'] == 2 && !$_GET['setting']['wechat_appId']) {
        cpmsg(lang('plugin/wechat', 'wechat_at_need'), '', 'error');
    }
    if ($_GET['setting']['wechat_appId'] && $_GET['setting']['wechat_appsecret']) {
        require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
        $wechat_client = new WeChatClient($_GET['setting']['wechat_appId'], $_GET['setting']['wechat_appsecret']);
        if (!$wechat_client->getAccessToken(1, 1)) {
            cpmsg(lang('plugin/wechat', 'wechat_at_geterror'), '', 'error');
        }
        $option = array('scene_id' => 100000, 'expire' => 30, 'ticketOnly' => 1);
        $ticket = $wechat_client->getQrcodeTicket($option);
        if (!$wechat_client->getQrcodeImgUrlByTicket($ticket)) {
            cpmsg(lang('plugin/wechat', 'wechat_at_qrgeterror'), '', 'error');
        }
    }
    $_GET['setting']['wechat_qrtype'] = !$_GET['setting']['wechat_mtype'] ? 3 : 0;
    $_GET['setting']['wechat_token'] = $_GET['setting']['wechat_token'] ? $_GET['setting']['wechat_token'] : random(16);
    if ($_FILES['wechat_qrcode']['tmp_name']) {
        $upload = new discuz_upload();
        if (!$upload->init($_FILES['wechat_qrcode'], 'common', random(3, 1), random(8)) || !$upload->save()) {
            cpmsg($upload->errormessage(), '', 'error');
        }
        $_GET['setting']['wechat_qrcode'] = $upload->attach['attachment'];
    }
    if ($setting['wsq_siteid']) {
        $siteinfo = wsq::edit($setting['wsq_sitename'], $setting['wsq_siteurl'], $setting['wsq_sitelogo'], $setting['wsq_sitesummary'], $_GET['setting']['wechat_mtype'], $_GET['setting']['wechat_qrtype']);
        if (!$siteinfo || $siteinfo->code) {
Пример #2
0
        @readfile($file);
    } else {
        $qrsize = !empty($_GET['qrsize']) ? $_GET['qrsize'] : 2;
        $file = $dir . 'qr_index.jpg';
        if (!file_exists($file) || !filesize($file)) {
            dmkdir($dir);
            require_once DISCUZ_ROOT . 'source/plugin/mobile/qrcode.class.php';
            QRcode::png($url . 'index&source=pcscan', $file, QR_ECLEVEL_Q, $qrsize);
        }
        dheader('Content-Disposition: inline; filename=qrcode_index.jpg');
        dheader('Content-Type: image/pjpeg');
        @readfile($file);
    }
    exit;
}
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
$wechat_client = new WeChatClient($_G['wechat']['setting']['wechat_appId'], $_G['wechat']['setting']['wechat_appsecret']);
list($ticket, $code) = explode("\t", authcode($_G['cookie']['wechat_ticket'], 'DECODE'));
if ($ticket) {
    $file = $dir . md5($ticket) . '_' . $code . '.jpg';
    if (!file_exists($file) || !filesize($file)) {
        dmkdir($dir);
        $qrcode = dfsockopen($wechat_client->getQrcodeImgUrlByTicket($ticket));
        $fp = @fopen($file, 'wb');
        @fwrite($fp, $qrcode);
        @fclose($fp);
    }
    dheader('Content-Disposition: inline; filename=qrcode.jpg');
    dheader('Content-Type: image/pjpeg');
    @readfile($file);
}