/** * 构造函数 */ function pushbackCommunicator() { $this->http = XWB_plugin::getHttp(); $this->appkey = XWB_APP_KEY; $this->appsecret = XWB_APP_SECRET_KEY; $this->serverUrl = XWB_PUSHBACK_URL; $this->pushbackAuthKey = (string) XWB_Plugin::pCfg('pushback_authkey'); }
/** * 本函数用于代替{@link XWB_Plugin::URL()},生成完整的插件入口URL。形如: * http://xxxx.com/bbs/xwb.php?m=aaa.vvv * @param string $mRoute 路由完整名,比如xwbSiteInterface.reg * @param boolen|array|string $qData 查询字符串($_GET的其它内容) * @return string */ function getEntryURL($mRoute, $qData = false) { if ($qData) { if (is_array($qData)) { $qData = http_build_query($qData); } else { $qData = trim((string) $qData, "&"); } } else { $qData = ''; } //-------------------------------------------------------------- $rStr = XWB_R_GET_VAR_NAME . '=' . $mRoute; $qData = empty($qData) ? $rStr : $rStr . "&" . $qData; return XWB_Plugin::siteUrl() . 'xwb.php' . "?" . $qData; }
/** * 检查is_pushback_open设置的真实性 * @return integer */ function _checkPushbackOpenConfig() { $is_pushback_open = 1; $config = XWB_Plugin::pCfg(); if (!$config['pushback_to_thread'] && !$config['pushback_to_blog'] && !$config['pushback_to_doing'] && !$config['pushback_to_share']) { $is_pushback_open = 0; } return $is_pushback_open; }
/** * 检查下一次检查unread的时间是否到达 * @return bool */ function _checkNextUnreadTime() { if (XWB_S_UID < 1) { return false; } $sess = XWB_Plugin::getUser(); $nexttime = intval($sess->getInfo('xwb_nextunread_' . XWB_S_UID)); //return true; return $nexttime == 0 || time() >= $nexttime; }
function _cachekey($key) { return 'xipct_' . substr(md5(XWB_Plugin::getIP() . $key), 0, 16); }
/** * 开始进行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]); } }