コード例 #1
0
 /**
  * 评论回推设置:设置和开启评论回推选项
  */
 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();
     }
 }
コード例 #2
0
 function step1()
 {
     $tokenhash = '';
     if (!xwb_token::checkInput('g', 'xwbuninstall', false)) {
         echo 'XWB_TOKEN_HASH_CHECK_FAILURE!';
         exit;
     }
     $cfg = $this->getCfg();
     $tips = array();
     $st = true;
     if (!empty($_GET['delete_data'])) {
         //delete db data
         $db = XWB_plugin::getDB();
         foreach ($cfg['db_data'] as $name => $format) {
             $tbSql = sprintf($format, DB::table($name));
             $db->query($tbSql);
             $tips[] = array(1, "删除数据表 [PRE_]{$name} 成功");
         }
         $_GET['delete_data'] = 1;
     } else {
         $tips[] = array(1, "已保留微博插件数据");
         $_GET['delete_data'] = 0;
     }
     $lock_file_output = '论坛目录' . str_replace(dirname(dirname(XWB_P_DATA)), '', $this->v['lock_file']);
     if (false == @unlink($this->v['lock_file'])) {
         $tips[] = array(1, "无法删除或找不到安装锁定文件(位于:{$lock_file_output})。如果文件存在,请自行删除。");
     }
     $showTab = 'uninstall';
     $btn_enable = 'class="btn"';
     $btn_name = $st ? '完成' : '重试';
     if ($st) {
         //根据安装来源给出完成跳转链接
         if ($this->_sess->getInfo('boot_referer') == 'admincp') {
             $installtype = 'SC_' . XWB_S_CHARSET;
             if (version_compare(XWB_S_VERSION, '2', '<')) {
                 //X1.5
                 $link = '../../admin.php?action=plugins&operation=pluginuninstall&dir=sina_xweibo&installtype=' . $installtype . '&finish=1';
             } else {
                 //X2
                 $link = '../../admin.php?action=plugins&operation=pluginuninstall&dir=sina_xweibo_x2&installtype=' . $installtype . '&finish=1';
             }
         } else {
             $link = '../../index.php';
         }
     } else {
         $link = 'uninstall.php?step=1&delete_data=' . $_GET['delete_data'];
     }
     $image_file = $st ? 'sucess.png' : "icon.gif";
     include $this->tpl_dir . '/uninstall.php';
     exit;
 }
コード例 #3
0
 /**
  * 关闭远程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' => '配置文件无法写入')));
     }
 }
コード例 #4
0
 /**
  * 显示绑定时的错误信息
  * @param string $errorType 错误类型
  */
 function _showBindError($errorType = 'api')
 {
     $isBind = XWB_plugin::isUserBinded();
     //获取绑定关系
     $unbind_tokenhash = xwb_token::make('unbind', true);
     include XWB_P_ROOT . '/tpl/xwb_bind_error.tpl.php';
     exit;
 }
コード例 #5
0
 /**
  * 验算二次tokenhash是否正确
  * @param string $type 类型,可选值:g/p/c/r
  * @return bool
  */
 function checkSecFormhash($type = 'p')
 {
     if (XWB_plugin::V($type . ':' . XWB_TOKEN_NAME) != xwb_token::makeSecFormhash()) {
         return false;
     } else {
         return true;
     }
 }