/** * 在未登录论坛帐号,但已登录新浪微博帐号的绑定页面进行用户账户验证和绑定 */ function doBindAtNotLog() { if (!XWB_plugin::pCfg('is_account_binding') || !XWB_plugin::isRequestBy('POST')) { XWB_plugin::showError('网站管理员关闭了插件功能“新浪微博绑定”。请稍后再试。'); } $this->_chkIsWaitingForReg(); $ipCountInstance =& XWB_Plugin::O('xwbIpCount'); $ipInputCount = $ipCountInstance->get('regInput'); if ($ipInputCount >= 5) { $this->_oScript('xwbSetTips', array('-901', '密码错误输入次数超出限制,请15分钟后重试', 1)); exit; } $usernameS = trim((string) XWB_plugin::V('p:siteBindName')); $password = trim((string) XWB_plugin::V('p:bindPwd')); $questionid = (int) XWB_plugin::V('p:questionid'); $questionanswerS = trim((string) XWB_plugin::V('p:questionanswer')); $username = XWB_plugin::convertEncoding($usernameS, "UTF8", XWB_S_CHARSET); if (!empty($questionanswerS)) { $questionanswer = XWB_plugin::convertEncoding($questionanswerS, "UTF8", XWB_S_CHARSET); } else { $questionanswer = ''; } $uid = 0; //第1关:数据输入验证关 if (empty($username)) { $uid = -102; } if (empty($password)) { $uid = -103; } $msg = ''; //第2关:用户身份验证关 if ($uid == 0) { $verify = XWB_plugin::O('siteUserVerifier'); $verifyresult = $verify->verify($username, $password, $questionid, $questionanswer); $uid = $verifyresult[0]; if ($uid < 1) { $ipCountInstance->set('regInput', $ipInputCount + 1); } } if ($uid > 0) { $wbApi = XWB_plugin::getWB(); $uInfo = $wbApi->verifyCredentials(); $db = XWB_plugin::getDB(); //第3关:验证微博帐号是否已经在当前站点中绑定,防止用户通过多个浏览器恶意注册用户 $bInfo = XWB_plugin::getBUById($uid, $uInfo['id']); //远程API if (!empty($bInfo) && is_array($bInfo)) { $uid = -201; } else { $sess = XWB_plugin::getUser(); $sess->setInfo('sina_uid', $uInfo['id']); $last_key = $sess->getOAuthKey(true); $rst = XWB_plugin::addBindUser($uid, $uInfo['id'], (string) $last_key['oauth_token'], (string) $last_key['oauth_token_secret'], $uInfo['screen_name']); //远程API require_once XWB_P_ROOT . '/lib/xwbSite.inc.php'; xwb_setSiteUserLogin($uid); dsetcookie($this->_getBindCookiesName($uid), (string) $uInfo['id'], 604800); dsetcookie('xwb_tips_type', '', 0); $sess->setInfo('waiting_site_reg', '0'); $msg = "绑定论坛帐号成功。下次你可以继续使用新浪微博帐号登录使用" . XWB_S_TITLE . "论坛。"; $msg .= "<br>绑定帐号: <em>" . htmlspecialchars($usernameS) . "</em> "; //正向绑定(在未登录论坛帐号已登录新浪微博帐号的绑定页面)统计上报 $sess->appendStat('bind', array('uid' => $uInfo['id'], 'type' => 1)); //输出UCenter同步JS global $_G; loaducenter(); $ucsynlogin = $_G['setting']['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : ''; $this->_outputUJ($ucsynlogin); } } if ($uid <= 0) { $msg = $this->_getBindTip($uid); } $displayWindow = 0; $this->_oScript('xwbSetTips', array($uid, $msg, $displayWindow)); }
/** * 运行评论回推 */ function forcePushback() { exit('NOT ALLOW YET.'); //error_reporting(E_ALL); $pushInstance = XWB_Plugin::O('pushbackDispatcher'); if (true == $pushInstance->prepare(false)) { $pushInstance->processMain(); echo 'var xwb_pushback_success = 1;'; } else { echo 'var xwb_pushback_success = 0;'; } }
/** * 开始进行Comment插入到论坛 */ function _beginInsertComment() { foreach ($this->_comments as $type => $commentList) { $className = $this->_getInsertClassName($type); if (empty($className)) { unset($this->_comments[$type]); continue; } $postInstance = XWB_Plugin::O($className); $result = $postInstance->importMapper($this->_mapper); if (true == $result) { foreach ($commentList as $mid => $comments) { foreach ($comments as $comment) { $postInstance->prepareInsert($comment); } unset($this->_comments[$type][$mid]); } $postInstance->execInsert(); $this->_log('评论回推数据插入成功!'); } else { $this->_log('评论回推数据插入错误: ' . $className . ' 的importMapper返回失败值'); } $postInstance = null; unset($this->_comments[$type]); } }