function switchMode($LTXCfg = 1, $UTXCfg = '', $BTXCfg = '') { $FTParams = 1 == $LTXCfg ? array('nbool_LTXCfg' => $LTXCfg, 'http_UTXCfg' => $UTXCfg, 'http_BTXCfg' => $BTXCfg) : array('nbool_LTXCfg' => $LTXCfg); if ($this->_FTHelper($FTParams)) { $config = 1 == $LTXCfg ? array('switch_to_xweibo' => (int) $LTXCfg, 'url_to_xweibo' => $UTXCfg, 'baseurl_to_xweibo' => $BTXCfg) : array('switch_to_xweibo' => (int) $LTXCfg); XWB_plugin::setPCfg($config) || $this->_ERHelper('4021001'); $this->rst = TRUE; } $this->_LogHelper($this->apiRoute . '/switchMode'); return array('rst' => $this->rst, 'errno' => $this->errno, 'err' => $this->err); }
/** * 关闭远程API */ function closeApi() { $stx = XWB_plugin::pCfg('switch_to_xweibo'); if (XWB_plugin::setPCfg(array('switch_to_xweibo' => 0))) { $api = XWB_plugin::N('apixwb'); $response = $api->setNotice(0, '', FALSE); // if( !is_array($response) || 0 != $response['errno']) { // XWB_plugin::setPCfg(array('switch_to_xweibo' => $stx)); // } exit(json_encode($response)); } else { exit(json_encode(array('errno' => 1, 'err' => '配置文件无法写入'))); } }
/** * 关闭远程API */ function closeApi() { if (!xwb_token::checkInput('p', $this->tokehash, true)) { exit(json_encode(array('errno' => 1, 'err' => '令牌验证失败,请返回重试'))); } $stx = XWB_plugin::pCfg('switch_to_xweibo'); if (XWB_plugin::setPCfg(array('switch_to_xweibo' => 0))) { $api = XWB_plugin::N('apixwb'); $response = $api->setNotice(0, '', FALSE); // if( !is_array($response) || 0 != $response['errno']) { // XWB_plugin::setPCfg(array('switch_to_xweibo' => $stx)); // } exit(json_encode($response)); } else { exit(json_encode(array('errno' => 1, 'err' => '配置文件无法写入'))); } }
function doPluginCfg4ocSet() { if (!defined('XWB_S_IS_ADMIN') || !XWB_S_IS_ADMIN || !XWB_plugin::isRequestBy('POST')) { XWB_plugin::deny(''); } $set = (array) XWB_plugin::V('p:pluginCfg'); $newset = array(); $inputCheck = array('is_rebutton_relateUid_assoc' => array(0, 1), 'display_ow_in_forum_index' => array(0, 1)); $newset = $this->_filterInput($set, $inputCheck); if (!XWB_plugin::setPCfg($newset)) { $ret = array(0, '设置保存失败,请检查插件目录是否可写。'); } else { $ret = array(1, '设置成功'); } $this->_oScript('xwbSetTips', $ret); }
/** * 更新下一进程信息(同时解锁) * @param int|null $nextUpdateSec 下次更新时间应该在这次更新时间的多少秒之后?传入空值表示由程序决定 */ function _updateNextProcess($nextUpdateSec = null) { if (true == $this->_maxidDetect) { XWB_plugin::setPCfg('pushback_fromid', $this->_maxid); } $this->_determineNextUpdateTime($nextUpdateSec); $this->_db->query('REPLACE INTO ' . DB::table('common_cache') . " (`cachekey`, `cachevalue`, `dateline`) VALUES \n\t\t ('xwb_pushback_nexttime', '{$this->_nexttime}', '{$this->_thistime}'),\n\t\t ('xwb_pushback_lasttime', '{$this->_thistime}', '{$this->_thistime}'),\n\t\t ('xwb_pushback_updatesec', '{$this->_updatesec}', '{$this->_thistime}'),\n\t\t ('xwb_pushback_processlock', '0', '{$this->_thistime}')\n\t\t"); if (true == $this->_maxidDetect) { $this->_log('评论回推更新下一进程信息:下次更新时间:' . date("Y-m-d H:i:s", $this->_nexttime) . ';下次评论回推的最大id:' . $this->_maxid); } else { $this->_log('评论回推更新下一进程信息:不更新评论回推的最大id;下次更新时间:' . date("Y-m-d H:i:s", $this->_nexttime)); } }