Ejemplo 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']);
     }
 }
Ejemplo n.º 2
0
 function forumdisplay_topBar()
 {
     global $_G;
     $config = $_G['cache']['plugin']['aljwsq'];
     require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
     $return = array();
     $url = WeChatHook::getPluginUrl('aljwsq:mes', array('mobile' => '2'));
     $index_url = WeChatHook::getPluginUrl('aljwsq:index', array('mobile' => '2'));
     $return[] = array('name' => $config['wsq_1'], 'html' => '<a href="' . $index_url . '">' . $config['wsq_2'] . '</a><br/><br/><a href="' . $url . '">' . $config['wsq_3'] . '</a>', 'more' => '');
     return $return;
 }
Ejemplo n.º 3
0
    updatecache('setting');
    if ($_GET['setting']['wsq_allow']) {
        WeChatHook::updateResponse(array('receiveMsg::text' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'text'), 'receiveEvent::click' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'click'), 'receiveEvent::subscribe' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'subscribe'), 'receiveEvent::scan' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'scan')));
        WeChatHook::updateRedirect(array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'redirect'));
        WeChatHook::updateAPIHook(array(array('wsqindex_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'forumdisplay_variables')), array('forumdisplay_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'forumdisplay_variables')), array('viewthread_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'viewthread_variables'))));
        WeChatHook::updateViewPluginId('wechat');
        if (!in_array('mobile', $_G['setting']['plugins']['available'])) {
            $plugin = C::t('common_plugin')->fetch_by_identifier('mobile');
            if (!$plugin) {
                cpmsg(lang('plugin/wechat', 'wsq_mobile_plugin_error'), '', 'error');
            }
            C::t('common_plugin')->update($plugin['pluginid'], array('available' => 1));
            updatecache(array('plugin', 'setting'));
        }
    } else {
        $wechatredirect = WeChatHook::getRedirect();
        if ($wechatredirect['plugin'] == 'wechat') {
            $wechatredirect = array();
        }
        WeChatHook::updateRedirect($wechatredirect);
        WeChatHook::updateViewPluginId('');
    }
    if (function_exists('domain_create') && $_G['setting']['domain']['root']['forum']) {
        if ($_GET['setting']['wsq_domain']) {
            domain_create('wechat', $_GET['setting']['wsq_domain'], $_G['setting']['domain']['root']['forum']);
        } else {
            domain_delete('wechat');
        }
    }
    cpmsg('setting_update_succeed', 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=wsq_setting', 'succeed');
}
Ejemplo n.º 4
0
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: wechat.php 34480 2014-05-07 01:18:15Z nemohou $
 */
if (!defined('IN_MOBILE_API')) {
    exit('Access Denied');
}
define('DISABLEXSSCHECK', true);
require './source/class/class_core.php';
$discuz = C::app();
$cachelist = array('plugin');
$discuz->cachelist = $cachelist;
$discuz->init();
$_G['siteurl'] = str_replace('api/mobile/', '', $_G['siteurl']);
$_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
$svr = new WeChatServer($_G['wechat']['setting']['wechat_token'], WeChatHook::getResponse($_GET['id']));
Ejemplo n.º 5
0
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: wechat_setting.inc.php 34555 2014-05-28 06:59:57Z nemohou $
 */
if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
$setting = C::t('common_setting')->fetch_all(array('mobilewechat'));
$setting = (array) unserialize($setting['mobilewechat']);
$apiurl = $_G['siteurl'] . 'api/mobile/?module=wechat';
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
if (isset($_GET['viewapi'])) {
    $redirect = WeChatHook::getRedirect();
    $response = WeChatHook::getResponse();
    showtips(lang('plugin/wechat', 'wechatapi_tips', array('url' => $apiurl)));
    showtableheader();
    echo '<tr class="header"><th>' . lang('plugin/wechat', 'api_hook') . '</th><th>' . lang('plugin/wechat', 'api_method') . '</th></tr>';
    if ($redirect) {
        echo '<tr><th>' . lang('plugin/wechat', 'wechatapi_redirect') . '</th><th>' . formathook($redirect) . '</th></tr>';
    }
    foreach ($response as $k => $row) {
        echo '<tr><th>' . lang('plugin/wechat', 'api_' . $k) . '(' . $k . ')</th><th>' . formathook($row) . '</th></tr>';
    }
    showtablefooter();
    $wechatresponseExts = unserialize($_G['setting']['wechatresponseExts']);
    if ($wechatresponseExts) {
        showtableheader();
        foreach ($wechatresponseExts as $k => $response) {
            echo '<tr class="header"><th>' . lang('plugin/wechat', 'wechat_responseexts') . ' ' . $k . '</th><th>' . lang('plugin/wechat', 'api_method') . '</th></tr>';
Ejemplo n.º 6
0
Archivo: install.php Proyecto: cwcw/cms
  `uid` mediumint(8) unsigned NOT NULL,
  `openid` char(32) NOT NULL default '',
  `status` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`uid`)
) ENGINE=MYISAM;

CREATE TABLE IF NOT EXISTS pre_mobile_wsq_threadlist (
  `skey` int(10) unsigned NOT NULL,
  `svalue` text NOT NULL,
  PRIMARY KEY (`skey`)
) ENGINE=MyISAM;

EOF;
if (!defined('DISCUZ_VERSION')) {
    require './source/discuz_version.php';
}
$settingdefault = array('wechat_mtype' => '0', 'wechat_qrtype' => '3', 'wechat_token' => random(16), 'wechat_allowregister' => '1', 'wechat_allowfastregister' => '1', 'wechat_disableregrule' => '1', 'wechat_float_qrcode' => '1', 'wechat_confirmtype' => '0', 'wechat_newusergroupid' => $_G['setting']['newusergroupid'], 'wsq_wapdefault' => DISCUZ_VERSION == 'X2.5' ? 1 : 0);
runquery($sql);
$setting = $_G['setting']['mobilewechat'] ? (array) unserialize($_G['setting']['mobilewechat']) : array();
foreach ($settingdefault as $_key => $_default) {
    if (!isset($setting[$_key])) {
        $setting[$_key] = $_default;
    }
}
$settings = array('mobilewechat' => serialize($setting));
C::t('common_setting')->update_batch($settings);
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
if (!WeChatHook::getAPIHook('wechat')) {
    WeChatHook::updateAPIHook(array(array('wsqindex_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'forumdisplay_variables')), array('forumdisplay_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'forumdisplay_variables')), array('viewthread_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'viewthread_variables'))));
}
$finish = TRUE;
Ejemplo n.º 7
0
    `res_finish_at` int(10),
    PRIMARY KEY (`id`)
) ENGINE=InnoDB;

EOF;
    if (!defined('DISCUZ_VERSION')) {
        require './source/discuz_version.php';
    }
    $settingdefault = array('wechat_mtype' => '0', 'wechat_qrtype' => '3', 'wechat_token' => random(16), 'wechat_allowregister' => '1', 'wechat_allowfastregister' => '1', 'wechat_disableregrule' => '1', 'wechat_float_qrcode' => '1', 'wechat_confirmtype' => '0', 'wechat_newusergroupid' => $_G['setting']['newusergroupid'], 'wsq_wapdefault' => 1, 'wsq_global_banner' => 1);
    require_once DISCUZ_ROOT . './source/plugin/wechat/install/update.func.php';
    runquery($sql);
    updatetable($sql);
    foreach ($settingdefault as $_key => $_default) {
        if (!isset($setting[$_key])) {
            $setting[$_key] = $_default;
        }
    }
    $setting['RELEASE'] = PLUGIN_RELEASE;
    $settings = array('mobilewechat' => serialize($setting));
    C::t('common_setting')->update_batch($settings);
    C::t('common_plugin')->delete_by_identifier('mobileoem');
    require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
    $hook = WeChatHook::getAPIHook('wechat');
    if (!$hook) {
        WeChatHook::updateAPIHook(array(array('forumdisplay_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'forumdisplay_variables')), array('viewthread_variables' => array('plugin' => 'wechat', 'include' => 'wsqapi.class.php', 'class' => 'WSQAPI', 'method' => 'viewthread_variables'))));
    } elseif ($hook['wsqindex']) {
        WeChatHook::updateAPIHook(array(array('wsqindex_variables' => array('plugin' => 'wechat'))));
    }
    DB::query("ALTER TABLE " . DB::table('forum_debatepost') . " ADD INDEX `voters` (`tid`,`voters`)", 'SILENT');
    $pluginupdated = true;
}
Ejemplo n.º 8
0
        echo '<tr class="header"><th>' . lang('plugin/wechat', 'wechat_responseexts') . ' ' . $extk . '</th><th>' . cplang('plugins_name') . '</th><th>' . lang('plugin/wechat', 'api_method') . '</th></tr>';
        foreach ($response as $k => $row) {
            if (!$plugins[$row['plugin']]) {
                $deleteresponseExts[$extk][$k] = array();
            }
            echo '<tr class="hover"><td>' . lang('plugin/wechat', 'api_' . $k) . '(' . $k . ')</td><td>' . $plugins[$row['plugin']]['name'] . '</td><td>' . formathook($row) . '</td></tr>';
        }
    }
    showtablefooter();
}
if ($deleteresponses) {
    WeChatHook::updateResponse($deleteresponses);
}
if ($deleteresponseExts) {
    foreach ($deleteresponseExts as $extk => $deleteresponses) {
        WeChatHook::updateResponse($deleteresponses, $extk);
    }
}
$wechatappInfos = unserialize($_G['setting']['wechatappInfos']);
if ($wechatappInfos) {
    showtableheader();
    echo '<tr class="header"><th width="200">' . lang('plugin/wechat', 'wechat_devids') . '</th><th>' . lang('plugin/wechat', 'wechat_appId') . '</th><th>' . lang('plugin/wechat', 'wechat_appsecret') . '</th></tr>';
    foreach (unserialize($_G['setting']['wechatappInfos']) as $k => $info) {
        echo '<tr class="hover"><td>' . $k . '</td><td>' . $info['appId'] . '</td><td>' . $info['appSecret'] . '</td></tr>';
    }
    showtablefooter();
}
function formathook($hook)
{
    return '<b>File:</b> ' . $hook['plugin'] . '/' . $hook['include'] . ' <b>Method:</b> ' . $hook['class'] . '->' . $hook['method'];
}
Ejemplo n.º 9
0
<?php

/*
 * ×÷ÕߣºÁÁ½£
 * ÁªÏµQQ:578933760
 *
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if (file_exists(DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php')) {
    require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
} else {
    echo lang('plugin/aljwsq', 'a1');
}
if ($_GET['formhash'] == FORMHASH) {
    WeChatHook::updateResponse(array('receiveMsg::text' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg'), 'receiveMsg::voice' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg'), 'receiveEvent::subscribe' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg'), 'receiveEvent::location' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg'), 'receiveEvent::click' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg'), 'receiveEvent::scan' => array('plugin' => 'aljwsq', 'include' => 'aljwsq.inc.php', 'class' => 'wechatCallbackapi', 'method' => 'responsemsg')));
    WeChatHook::updateRedirect(array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'redirect'));
    WeChatHook::updateViewPluginId('aljwsq');
    cpmsg(lang('plugin/aljwsq', 'register1'), 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=aljwsq&pmod=register', 'succeed');
} else {
    $p = WeChatHook::getViewPluginId();
    include template('aljwsq:register');
}
Ejemplo n.º 10
0
        showmessage('wechat:wechat_member_bind_succeed', $url);
    }
} elseif (($ac == 'register' && submitcheck('submit') || $ac == 'wxregister') && $_G['wechat']['setting']['wechat_allowregister']) {
    if ($wechatuser) {
        showmessage('wechat:wechat_openid_exists');
    } else {
        if ($ac == 'wxregister') {
            loaducenter();
            $user = uc_get_user($_GET['username']);
            if (!empty($user)) {
                $_GET['username'] = substr($_GET['username'], 0, 9) . '_' . random(5);
            }
        }
        $uid = WeChat::register($_GET['username']);
        if (!$_G['wechat']['setting']['wechat_qrtype']) {
            WeChatHook::bindOpenId($uid, $openid, 1);
            wsq::report('register');
            showmessage('wechat:wechat_member_register_succeed', $selfurl . 'bind&confirm=yes');
        } else {
            C::t('#wechat#common_member_wechatmp')->insert(array('uid' => $uid, 'openid' => $wxopenid ? $wxopenid : $_GET['wxopenid'], 'status' => 0), false, true);
            wsq::report('register');
            $url = wsq::wxuserregisterUrl($uid);
            if ($ac == 'wxregister') {
                dheader('location: ' . $url);
            } else {
                showmessage('wechat:wechat_member_register_succeed', $url);
            }
        }
    }
} elseif ($ac == 'logout' && $_GET['hash'] == formhash()) {
    wechat_setloginstatus($_G['uid'], false);
Ejemplo n.º 11
0
 *
 */
if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
$sql = "ALTER TABLE `" . DB::table('aljwsq_user') . "` ADD `lasttime` int(10) NOT NULL ;";
DB::query($sql, 'SILENT');
if (file_exists(DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php')) {
    $pluginid = 'aljwsq';
    $Hooks = array('forumdisplay_topBar');
    $data = array();
    foreach ($Hooks as $Hook) {
        $data[] = array($Hook => array('plugin' => $pluginid, 'include' => 'api.class.php', 'class' => $pluginid . '_api', 'method' => $Hook));
    }
    require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
    WeChatHook::updateAPIHook($data);
}
function is_utf8($word)
{
    if (preg_match("/^([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){1}/", $word) == true || preg_match("/([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){1}\$/", $word) == true || preg_match("/([" . chr(228) . "-" . chr(233) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}[" . chr(128) . "-" . chr(191) . "]{1}){2,}/", $word) == true) {
        return true;
    } else {
        return false;
    }
}
// function is_utf8
$str = file_get_contents('http://addon.discuz.com/?@liangjian');
if ($_G['charset'] == 'utf-8') {
    if (!is_utf8($str)) {
        $str = iconv('gbk', 'utf-8', $str);
    }
Ejemplo n.º 12
0
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 */

if(!defined('IN_DISCUZ')) {
    exit('Access Denied');
}

$pluginid = 'lshl_tzydh';

require_once DISCUZ_ROOT.'./source/plugin/wechat/wechat.lib.class.php';
WeChatHook::delAPIHook($pluginid);


$finish = TRUE;
Ejemplo n.º 13
0
elseif($model=='jieguan'){
	if($_GET['formhash']==FORMHASH){
		if(file_exists(DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php')){
			require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
			
			$receiveMsg = array(
    			'receiveMsg::text' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
				'receiveMsg::voice' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
    			'receiveMsg::image' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
    			'receiveEvent::subscribe' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
    			'receiveEvent::unsubscribe' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
				'receiveEvent::location' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
    			'receiveEvent::click' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
    			'receiveEvent::scan' => array('plugin' => 'hejin_box', 'include' => 'hejin_box.inc.php', 'class' => 'wxboxApi', 'method' => 'respond'),
			
			);
			
			WeChatHook::updateResponse($receiveMsg);
			WeChatHook::updateRedirect(array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'redirect'));
//			WeChatHook::updateViewPluginId('hejin_box');
			cpmsg(lang('plugin/hejin_box', 'jieguanok'), 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=hejin_box&pmod=jieguan', 'succeed');


		}else{
			echo lang('plugin/hejin_box', 'jieguanno');
		}
	}
}


?>
Ejemplo n.º 14
0
     $response['subscribeback'] = $response['subscribeback'] ? $response['subscribeback'] : array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'subscribe');
     $updatedata = array('receiveEvent::subscribe' => $response['subscribeback']);
     $responsehook = WeChatHook::updateResponse($updatedata);
     savecache('wechat_response', $response);
     cpmsg(lang('plugin/wechat', 'response_subscribe_plugin'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=response_setting', 'succeed');
 }
 if ($_GET['text'] == 'custom') {
     $response['textback'] = $responsehook['receiveMsg::text'];
     $updatedata = array('receiveMsg::text' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'text'));
     $responsehook = WeChatHook::updateResponse($updatedata);
     savecache('wechat_response', $response);
     cpmsg(lang('plugin/wechat', 'response_message_custom'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=response_setting', 'succeed');
 } elseif ($_GET['text'] == 'restore') {
     $response['textback'] = $response['textback'] ? $response['textback'] : array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'text');
     $updatedata = array('receiveMsg::text' => $response['textback']);
     $responsehook = WeChatHook::updateResponse($updatedata);
     savecache('wechat_response', $response);
     cpmsg(lang('plugin/wechat', 'response_message_plugin'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=response_setting', 'succeed');
 }
 WeChatSetting::showResource();
 showformheader('plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=response_setting');
 showtableheader();
 echo '<tr><th class="td25"></th><th style="width:350px"><strong>' . lang('plugin/wechat', 'response_keyword') . '</strong></th><th><strong>' . lang('plugin/wechat', 'response_content') . '</strong></th></tr>';
 if ($responsehook['receiveEvent::subscribe']['plugin'] == 'wechat' && $responsehook['receiveEvent::subscribe']['class'] == 'WSQResponse' && $responsehook['receiveEvent::subscribe']['method'] == 'custom') {
     showtablerow('class="header"', array('', 'class="td23 td28"', '', 'class="td29"'), array("", lang('plugin/wechat', 'response_subscribe'), "<p class=\"mbn\">" . lang('plugin/wechat', 'response_custom') . " " . ($response['subscribeback'] ? "<a class=\"normal\" href=\"" . ADMINSCRIPT . "?action=plugins&operation=config&do={$pluginid}&identifier=wechat&pmod=response_setting&subscribe=restore\">[" . lang('plugin/wechat', 'response_switch_plugin_mode', array('plugin' => $response['subscribeback']['plugin'])) . "]</a></p>" : '')));
     showtablerow('', array('', 'class="td23 td28"', '', 'class="td29"'), array("", "<i>" . lang('plugin/wechat', 'subscribe') . "</i>", "<textarea class=\"tarea\" name=\"response[subscribe]\" id=\"res_subscribe\" rows=\"5\" cols=\"40\">" . dhtmlspecialchars($response['subscribe']) . "</textarea>" . "<br /><a href=\"javascript:;\" id=\"rsel\" onclick=\"showResource('res_subscribe')\">" . lang('plugin/wechat', 'resource_select') . "</a>"));
 } else {
     showtablerow('class="header"', array('', 'class="td23 td28"', '', 'class="td29"'), array("", lang('plugin/wechat', 'response_subscribe'), "<p>" . lang('plugin/wechat', 'response_plugin_mode', array('plugin' => $responsehook['receiveEvent::subscribe']['plugin'])) . " <a class=\"normal\" href=\"" . ADMINSCRIPT . "?action=plugins&operation=config&do={$pluginid}&identifier=wechat&pmod=response_setting&subscribe=custom\">[" . lang('plugin/wechat', 'response_switch_custom_mode') . "]</a></p>"));
 }
 showtablerow('class="header"', array('', 'class="td23 td28"', '', 'class="td29"'), array("", lang('plugin/wechat', 'response_access'), "<p class=\"mbn normal\">" . lang('plugin/wechat', 'response_access_comment')));
 showtablerow('', array('', 'class="td23 td28"', '', 'class="td29"'), array("", "<i>" . lang('plugin/wechat', 'access') . "</i>", "<textarea class=\"tarea\" name=\"response[access]\" id=\"res_access\" rows=\"5\" cols=\"40\">" . dhtmlspecialchars($response['access']) . "</textarea>" . "<br /><a href=\"javascript:;\" id=\"rsel\" onclick=\"showResource('res_access')\">" . lang('plugin/wechat', 'resource_select') . "</a>"));
Ejemplo n.º 15
0
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$config = $_G['cache']['plugin']['aljwsq'];
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
require_once libfile('function/member');
$wechatuser = C::t('#wechat#common_member_wechat')->fetch_by_openid($postObj->FromUserName);
$user = C::t('#aljwsq#aljwsq_user')->fetch($postObj->FromUserName);
echo $this->responsetext(123);
exit;
if (empty($wechatuser) && empty($user)) {
    loaducenter();
    $username = '******' . random(5);
    $return = register($username);
    WeChatHook::bindOpenId($return['uid'], $postObj->FromUserName, 1);
    require_once 'source/plugin/aljwsq/function_core.php';
    $wuser = getwuserinfo($postObj, $config['appid'], $config['appsecret']);
    $user = C::t('#aljwsq#aljwsq_user')->fetch($postObj->FromUserName);
    if (!$user) {
        C::t('#aljwsq#aljwsq_user')->insert(array('nickname' => u2g($wuser['nickname']), 'username' => $username, 'openid' => $postObj->FromUserName, 'bindtime' => TIMESTAMP, 'sex' => $wuser['sex'], 'city' => u2g($wuser['city']), 'country' => u2g($wuser['country']), 'province' => u2g($wuser['province']), 'language' => $wuser['language'], 'headimgurl' => $wuser['headimgurl'], 'subscribe_time' => $wuser['subscribe_time']));
    } else {
        C::t('#aljwsq#aljwsq_user')->update($postObj->FromUserName, array('nickname' => u2g($wuser['nickname']), 'username' => $username, 'bindtime' => TIMESTAMP, 'sex' => $wuser['sex'], 'city' => u2g($wuser['city']), 'country' => u2g($wuser['country']), 'province' => u2g($wuser['province']), 'language' => $wuser['language'], 'headimgurl' => $wuser['headimgurl'], 'subscribe_time' => $wuser['subscribe_time']));
    }
    echo $this->responsetext($postObj, '您已成功注册本站帐号,用户名' . $return['username'] . ',密码' . $return['password'] . '.此帐户已与微信帐户成功绑定,并支持微信扫码登录.');
} else {
    if (empty($user)) {
        $user = getuserbyuid($wechatuser['uid']);
    }
    echo $this->responsetext($postObj, '您已成功注册过帐号,用户名' . $user['username']);
}
Ejemplo n.º 16
0
 public function __construct($appid, $appsecret = '')
 {
     if ($appsecret) {
         $this->_appid = $appid;
         $this->_appsecret = $appsecret;
     } else {
         $info = WeChatHook::getAppInfo($appid);
         $this->_appid = $info['appId'];
         $this->_appsecret = $info['appSecret'];
     }
 }
Ejemplo n.º 17
0
*/
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
//start to put your own code
$sql = <<<EOF
DROP TABLE IF  EXISTS `pre_aljwsq_autoreply`;
DROP TABLE IF  EXISTS `pre_aljwsq_autoreply_advanced`;
DROP TABLE IF  EXISTS `pre_aljwsq_advanced_column`;
DROP TABLE IF  EXISTS `pre_aljwsq_advanced_columndata`;
DROP TABLE IF  EXISTS `pre_aljwsq_menu`;
DROP TABLE IF  EXISTS `pre_aljwsq_user`;
DROP TABLE IF  EXISTS `pre_aljwsq_ggk_log`;
DROP TABLE IF  EXISTS `pre_aljwsq_ggk_user`;
DROP TABLE IF  EXISTS `pre_aljwsq_citylist`;
DROP TABLE IF  EXISTS `pre_aljwsq_index`;
DROP TABLE IF  EXISTS `pre_aljwsq_c`;
DROP TABLE IF  EXISTS `pre_aljwsq_mes`;
DROP TABLE IF  EXISTS `pre_aljwsq_voice`;
DROP TABLE IF  EXISTS `pre_aljwsq_qrcode`;
DROP TABLE IF  EXISTS `pre_aljwsq_wxqrcode`;
DROP TABLE IF  EXISTS `pre_aljwsq_wxqrcode_record`;
DROP TABLE IF  EXISTS `pre_aljwsq_keywordlog`;
EOF;
runquery($sql);
if (file_exists(DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php')) {
    require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
    WeChatHook::delAPIHook('aljwsq');
}
//finish to put your own code
$finish = TRUE;