Exemplo n.º 1
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']));
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: response_setting.inc.php 35024 2014-10-14 07:43:43Z nemohou $
 */
if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
loadcache('wechat_response');
$response =& $_G['cache']['wechat_response'];
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
require_once DISCUZ_ROOT . './source/plugin/wechat/setting.class.php';
WeChatSetting::menu();
if (!submitcheck('menusubmit')) {
    showtips(lang('plugin/wechat', 'response_tips', array('url' => $url)));
    $responsehook = WeChatHook::getResponse();
    if ($_GET['subscribe'] == 'custom') {
        $response['subscribeback'] = $responsehook['receiveEvent::subscribe'];
        $updatedata = array('receiveEvent::subscribe' => array('plugin' => 'wechat', 'include' => 'response.class.php', 'class' => 'WSQResponse', 'method' => 'custom'));
        $responsehook = WeChatHook::updateResponse($updatedata);
        savecache('wechat_response', $response);
        cpmsg(lang('plugin/wechat', 'response_subscribe_custom'), 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=response_setting', 'succeed');
    } elseif ($_GET['subscribe'] == 'restore') {
        $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'];
Exemplo n.º 3
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>';