showsetting(lang('plugin/wechat', 'wechat_confirmtype'), 'setting[wechat_confirmtype]', $setting['wechat_confirmtype'], 'radio', 0, 0, lang('plugin/wechat', 'wechat_confirmtype_comment')); showsetting(lang('plugin/wechat', 'wechat_user'), 'setting[wechat_user]', $setting['wechat_user'], 'text', 0, 0, lang('plugin/wechat', 'wechat_user_comment')); showsetting(lang('plugin/wechat', 'wechat_newusergroupid'), '', '', $usergroups, 0, 0, lang('plugin/wechat', 'wechat_newusergroupid_comment')); showtagfooter('tbody'); showtableheader(); 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'); }