/** * 评论回推设置:设置和开启评论回推选项 */ function doCfg4pushback() { if (!defined('XWB_S_IS_ADMIN') || !XWB_S_IS_ADMIN || !XWB_plugin::isRequestBy('POST')) { XWB_plugin::deny(''); } elseif (!xwb_token::checkInput('p', 'pushback', true)) { XWB_plugin::showError('令牌验证失败,请返回重试'); } $is_pushback_open = 1; $pushback_to_thread = intval(XWB_plugin::V('p:pushback_to_thread')); $pushback_to_blog = intval(XWB_plugin::V('p:pushback_to_blog')); $pushback_to_doing = intval(XWB_plugin::V('p:pushback_to_doing')); $pushback_to_share = intval(XWB_plugin::V('p:pushback_to_share')); if (!$pushback_to_thread && !$pushback_to_blog && !$pushback_to_doing && !$pushback_to_share) { $is_pushback_open = 0; } $res = XWB_Plugin::setPCfg(array('is_pushback_open' => $is_pushback_open, 'pushback_to_thread' => $pushback_to_thread, 'pushback_to_blog' => $pushback_to_blog, 'pushback_to_doing' => $pushback_to_doing, 'pushback_to_share' => $pushback_to_share)); if (true == $res) { $ret = array(1, '设置保存成功。'); } else { $ret = array(0, '设置保存失败,请检查配置文件app.cfg.php是否具有可写权限?'); } $this->_oScript('xwbSetTips', $ret); $pushInstance = XWB_Plugin::O('pushbackCommunicator'); if (1 == $is_pushback_open) { $pushInstance->setPushback('comment'); } else { $pushInstance->cancelPushback(); } }
/** * api通信设置 */ function apiCfg() { if (!defined('XWB_S_IS_ADMIN') || !XWB_S_IS_ADMIN) { XWB_plugin::deny(''); } include XWB_P_ROOT . '/tpl/api_cfg_app_set.tpl.php'; }
/** * 出现错误的时候,显示错误模板 * @param string $info 错误信息 * @param bool $deny 是否发送403 http错误?是则表示调用本类静态方法deny * @param array $extra 其他详细信息,用于debug显示(现在暂时无用) */ function showError($info = '', $deny = false, $extra = array()) { if (true == $deny) { XWB_plugin::deny($info); } else { include XWB_P_ROOT . '/tpl/xwb_show_error.tpl.php'; } exit; }
function attention() { if (!XWB_plugin::pCfg('is_tips_display')) { XWB_plugin::deny('新浪微博资料页功能已经关闭!'); } $att_id = XWB_plugin::V('g:att_id'); $wbApi = XWB_plugin::getWB(); $wbApi->is_exit_error = false; $mySinaUid = XWB_plugin::getBindInfo('sina_uid', ''); if (empty($mySinaUid)) { XWB_plugin::deny('你不是绑定用户,不能关注其它用户'); } $rst = $wbApi->createFriendship($att_id); $url = 'http:/' . '/t.sina.com.cn/' . $att_id; XWB_plugin::redirect($url, 3); }
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); }
function xwbApiInterface() { if (!defined('XWB_S_IS_ADMIN') || !XWB_S_IS_ADMIN) { XWB_plugin::deny(''); } }