本文整理汇总了PHP中XWB_plugin::pCfg方法的典型用法代码示例。如果您正苦于以下问题:PHP XWB_plugin::pCfg方法的具体用法?PHP XWB_plugin::pCfg怎么用?PHP XWB_plugin::pCfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XWB_plugin
的用法示例。
在下文中一共展示了XWB_plugin::pCfg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
function request($route, $params, $toArray = TRUE)
{
$AppKey = XWB_APP_KEY;
$EncryptKey = XWB_plugin::pCfg('encrypt_key');
$paramsJSON = json_encode($params);
$EncryptTime = time();
$secret = md5(sprintf("#%s#%s#%s#%s#%s#", $AppKey, $route, $paramsJSON, $EncryptTime, $EncryptKey));
$data = array('A=' . $route, 'P=' . $paramsJSON, 'T=' . $EncryptTime, 'F=' . $secret);
$url = $this->url;
$this->http->setUrl($url);
$this->http->setData(implode('&', $data));
$time_start = microtime();
$result = $this->http->request('post');
$time_end = microtime();
$time_process = array_sum(explode(' ', $time_end)) - array_sum(explode(' ', $time_start));
if ($toArray) {
$result = xwb_util_json::decode($result, true);
}
$code = $this->http->getState();
$this->logRespond(rtrim($this->url, '/') . '/' . $route, 'post', (int) $code, $result, array('param' => $params, 'time_process' => $time_process, 'triggered_error' => $this->http->get_triggered_error()));
if (200 != $code) {
$result = array("rst" => false, "errno" => "50001", "err" => "network error");
$this->setError($result);
}
return $result;
}
示例2: sitePushback2share
/**
* 构造函数
*/
function sitePushback2share()
{
$this->_userConfig['ip'] = DB::mysqli_escape(XWB_plugin::getIP());
$this->_userConfig['uid'] = (int) XWB_plugin::pCfg('pushback_uid');
$this->_userConfig['username'] = DB::mysqli_escape(XWB_plugin::convertEncoding((string) XWB_plugin::pCfg('pushback_username'), 'UTF-8', XWB_S_CHARSET));
$this->_userConfig['timestamp'] = (int) TIMESTAMP;
//DZ已有的变量,直接使用之
if ($this->_userConfig['uid'] < 1) {
$this->_userConfig['uid'] = 0;
$this->_userConfig['username'] = 'Guest';
}
}
示例3: _validate
function _validate($A, $P, $T, $F)
{
/// 超时检测
if (XWB_REMOTE_API_TIME_VALIDATY < time() - $T) {
$this->_ERHelper('4010004');
}
$secret = md5(sprintf("#%s#%s#%s#%s#%s#", XWB_APP_KEY, $A, $P, $T, XWB_plugin::pCfg('encrypt_key')));
if (0 !== strcasecmp($F, $secret)) {
$this->_ERHelper('4010003', TRUE, 'load');
}
return;
}
示例4: closeApi
/**
* 关闭远程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' => '配置文件无法写入')));
}
}
示例5: closeApi
/**
* 关闭远程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' => '配置文件无法写入')));
}
}
示例6: xwb_format_signature
/**
* 新浪微博签名替换函数
* @version $Id: xwb_format_signature.function.php 1004 2012-06-11 10:32:46Z yaoying $
* @param string $s
*/
function xwb_format_signature($s)
{
static $xweibourl = null;
if (null == $xweibourl) {
$xweibourl = rtrim(strval(XWB_plugin::pCfg('baseurl_to_xweibo')), '/');
}
if (XWB_plugin::pCfg('switch_to_xweibo') && !empty($xweibourl)) {
$xweibourl_ta = $xweibourl . '/index.php?m=ta&id=';
} else {
$xweibourl_ta = 'http://weibo.com/u/';
}
$p = "#<-sina_sign,(\\d+),([a-z0-9]+),(\\d+)->#sim";
$rp = '<a href="' . $xweibourl_ta . '\\1" target="_blank"><img border="0" src="http://service.t.sina.com.cn/widget/qmd/\\1/\\2/\\3.png"/></a>';
//$p = XWB_plugin::convertEncoding($p,'UTF8', XWB_S_CHARSET);
//$rp= XWB_plugin::convertEncoding($rp,'UTF8', XWB_S_CHARSET);
if (!empty($s) && preg_match($p, $s, $m)) {
return preg_replace($p, $rp, $s);
}
return $s;
}
示例7: setUnreadCookie
/**
* 获取未读取数目
* 只有开启了标准版对接功能之后,才有此功能
*/
function setUnreadCookie()
{
$result = array('errno' => 0, 'uid' => XWB_S_UID, 'followers' => 0, 'dm' => 0, 'mentions' => 0, 'comments' => 0, 'allsum' => 0);
if (!$this->_checkNextUnreadTime()) {
$result['errno'] = -1;
} elseif (!XWB_plugin::pCfg('switch_to_xweibo')) {
$this->_setNextUnreadCheckTime();
$result['errno'] = -3;
} elseif (!XWB_S_UID || !XWB_Plugin::isUserBinded()) {
$this->_setNextUnreadCheckTime();
$result['errno'] = -2;
} else {
$wb = XWB_plugin::getWB();
$wb->is_exit_error = false;
$respond = $wb->getUnread();
if (!is_array($respond) || isset($respond['error'])) {
$result['errno'] = isset($respond['error']) ? (int) $respond['error'] : -3;
} else {
$result = array_merge($result, $respond);
$this->_setUnreadCookie($result);
}
$this->_setNextUnreadCheckTime();
}
if ($result['errno'] != 0) {
header("HTTP/1.1 403 Forbidden");
}
echo 'var _xwb_unread_new = ' . json_encode($result) . ';';
exit;
}
示例8: jsg_sina_footer
/**
* 加载新浪微博的底部信息
*/
function jsg_sina_footer()
{
$tipsType = $GLOBALS['xwb_tips_type'];
$site_uid = XWB_S_UID;
$sina_uid = XWB_plugin::getBindInfo("sina_uid");
$siteVer = XWB_S_VERSION;
$siteName = str_replace("'", "\\'", $GLOBALS['_J']['config']['site_name']);
$pName = CURSCRIPT . '_' . CURMODULE;
$regUrl = XWB_plugin::URL("xwbSiteInterface.reg");
$setUrl = XWB_plugin::URL("xwbSiteInterface.bind");
$bindUrl = XWB_plugin::URL("xwbSiteInterface.bind");
$signerUrl = XWB_plugin::URL("xwbSiteInterface.signer");
$authUrl = XWB_plugin::URL("xwbAuth.login");
$getTipsUrl = XWB_plugin::URL("xwbSiteInterface.getTips");
$attentionUrl = XWB_plugin::URL("xwbSiteInterface.attention");
$wbxUrl = XWB_plugin::pCfg("wbx_url");
$xwb_loadScript1 = $GLOBALS['_J']['site_url'] . '/images/xwb/dlg.js';
$xwb_loadScript2 = $GLOBALS['_J']['site_url'] . '/images/xwb/xwb.js';
$xwb_css_base = $GLOBALS['_J']['site_url'] . '/images/xwb/xwb_base.css';
$xwb_css_append = $GLOBALS['_J']['site_url'] . ('/images/xwb/xwb_' . XWB_S_VERSION . '.css');
$return = <<<EOF
<script language="javascript">
var _xwb_cfg_data ={
\ttipsType:\t'{$tipsType}',site_uid:\t'{$site_uid}',sina_uid:\t'{$sina_uid}',
\tsiteVer:\t'{$siteVer}',siteName:\t'{$siteName}',pName:'{$pName}',
\tregUrl:\t\t'{$regUrl}',
\tsetUrl:\t\t'{$setUrl}',
\tbindUrl:\t'{$bindUrl}',
\tsignerUrl:\t'{$signerUrl}',
\tauthUrl:\t'{$authUrl}',
\tgetTipsUrl:\t'{$getTipsUrl}',
\tattentionUrl:\t'{$attentionUrl}',
\twbxUrl:\t\t'{$wbxUrl}'
};
function xwb_loadScript(file, charset){
\tvar script = document.createElement('SCRIPT');
\tscript.type = 'text/javascript'; script.charset = charset; script.src = file;
\tdocument.getElementsByTagName('HEAD')[0].appendChild(script);
}
xwb_loadScript("{$xwb_loadScript1}", "UTF-8");
xwb_loadScript("{$xwb_loadScript2}", "UTF-8");
</script>
<link href="{$xwb_css_base}" rel="stylesheet" type="text/css" />
<link href="{$xwb_css_append}" rel="stylesheet" type="text/css" />
EOF;
/*
$sess = XWB_plugin::getUser();
$xwb_statInfo = $sess->getStat();
foreach( $xwb_statInfo as $k => $stat ){
$xwb_statType = isset($stat['xt']) ? (string)$stat['xt'] : 'unknown';
$return .= XWB_plugin::statUrl( $xwb_statType, $stat, true );
}
if( !empty($xwb_statInfo) ){
$sess->clearStat();
}
*/
return $return;
}
示例9:
checked="checked" <?php
}
?>
/>是</label> <label for="tojishigou_0"><input name="tojishigou" id="tojishigou_0" type="radio" value="0" <?php
if ($tojishigou == 0) {
?>
checked="checked" <?php
}
?>
/>否</label></div>
</div>
<?php
}
?>
<?php
if (XWB_plugin::pCfg('is_syncreply_tojishigou') && jaccess('xwb', '__syncreply')) {
?>
<h3>读取新浪微博的评论内容到本站?</h3>
<div class="radio-box">
<div class="radio"><label for="reply_tojishigou_1"><input name="reply_tojishigou" id="reply_tojishigou_1" type="radio" value="1" <?php
if ($reply_tojishigou == 1) {
?>
checked="checked" <?php
}
?>
/>是</label> <label for="reply_tojishigou_0"><input name="reply_tojishigou" id="reply_tojishigou_0" type="radio" value="0" <?php
if ($reply_tojishigou == 0) {
?>
checked="checked" <?php
}
?>
示例10: authCallBack
function authCallBack()
{
if (!XWB_plugin::pCfg('is_account_binding')) {
XWB_plugin::showError('网站管理员关闭了插件功能“新浪微博绑定”。请稍后再试。');
}
//--------------------------------------------------------------------
global $_G;
$sess = XWB_plugin::getUser();
$waiting_site_bind = $sess->getInfo('waiting_site_bind');
if (empty($waiting_site_bind)) {
//XWB_plugin::deny();
$siteUrl = XWB_plugin::siteUrl(0);
XWB_plugin::redirect($siteUrl, 3);
}
$sess->setOAuthKey(array(), true);
//--------------------------------------------------------------------
$wbApi = XWB_plugin::getWB();
$db = XWB_plugin::getDB();
$last_key = $wbApi->getAccessToken(XWB_plugin::V('r:oauth_verifier'));
//print_r($last_key);
if (!isset($last_key['oauth_token']) || !isset($last_key['oauth_token_secret'])) {
$api_error_origin = isset($last_key['error']) ? $last_key['error'] : 'UNKNOWN ERROR. MAYBE SERVER CAN NOT CONNECT TO SINA API SERVER';
$api_error = isset($last_key['error_CN']) && !empty($last_key['error_CN']) && 'null' != $last_key['error_CN'] ? $last_key['error_CN'] : '';
XWB_plugin::LOG("[WEIBO CLASS]\t[ERROR]\t#{$wbApi->req_error_count}\t{$api_error}\t{$wbApi->last_req_url}\tERROR ARRAY:\r\n" . print_r($last_key, 1));
XWB_plugin::showError("服务器获取Access Token失败;请稍候再试。<br />错误原因:{$api_error}[{$api_error_origin}]");
}
$sess->setOAuthKey($last_key, true);
$wbApi->setConfig();
$uInfo = $wbApi->verifyCredentials();
$sess->setInfo('sina_uid', $uInfo['id']);
$sess->setInfo('sina_name', $uInfo['screen_name']);
//print_r($uInfo);
//--------------------------------------------------------------------
/// 此帐号是否已经在当前站点中绑定
$sinaHasBinded = false;
$stat_is_bind_type = 0;
if (defined('XWB_S_UID') && XWB_S_UID > 0) {
$bInfo = XWB_plugin::getBUById(XWB_S_UID, $uInfo['id']);
} else {
$bInfo = XWB_plugin::getBindUser($uInfo['id'], 'sina_uid');
//远程API
}
if (!is_array($bInfo) && (defined('XWB_S_UID') && XWB_S_UID > 0)) {
$bInfo = XWB_plugin::getBindUser(XWB_S_UID, 'site_uid');
//登录状态下再查一次API,确保没有绑定
}
if (!empty($bInfo) && is_array($bInfo)) {
$sinaHasBinded = true;
dsetcookie($this->_getBindCookiesName($bInfo['uid']), (string) $bInfo['sina_uid'], 604800);
//核查存储的access token是否有更新,有更新则进行自动更新
if ($bInfo['sina_uid'] == $uInfo['id'] && ($bInfo['token'] != $last_key['oauth_token'] || $bInfo['tsecret'] != $last_key['oauth_token_secret'])) {
XWB_plugin::updateBindUser($bInfo['uid'], $bInfo['sina_uid'], (string) $last_key['oauth_token'], (string) $last_key['oauth_token_secret'], $uInfo['screen_name']);
//远程API
}
}
//--------------------------------------------------------------------
/// 决定在首页中显示什么浮层
$tipsType = '';
//xwb_tips_type
//已在论坛登录
if (defined('XWB_S_UID') && XWB_S_UID) {
if ($sinaHasBinded) {
//$sinaHasBinded为true时,$bInfo必定存在
if (XWB_S_UID != $bInfo['uid'] || $bInfo['sina_uid'] != $uInfo['id']) {
$tipsType = 'hasBinded';
$sess->clearToken();
} else {
$tipsType = 'autoLogin';
}
} else {
//远程API
$rst = XWB_plugin::addBindUser(XWB_S_UID, $uInfo['id'], (string) $last_key['oauth_token'], (string) $last_key['oauth_token_secret'], $uInfo['screen_name']);
if (!$rst) {
echo "DB ERROR";
exit;
return false;
}
$tipsType = 'bind';
dsetcookie($this->_getBindCookiesName(XWB_S_UID), (string) $uInfo['id'], 604800);
//正向绑定统计上报
$sess->appendStat('bind', array('uid' => $uInfo['id'], 'type' => 1));
}
} else {
//从 wb 登录后 检查用户是否绑定,如果绑定了 则在附属站点自
if ($sinaHasBinded) {
require_once XWB_P_ROOT . '/lib/xwbSite.inc.php';
$result = xwb_setSiteUserLogin((int) $bInfo['uid']);
if (false == $result) {
dsetcookie($this->_getBindCookiesName($bInfo['uid']), -1, 604800);
XWB_plugin::delBindUser($bInfo['uid']);
//远程API
$tipsType = 'siteuserNotExist';
} else {
$stat_is_bind_type = 1;
$tipsType = 'autoLogin';
}
} else {
//已登录WB,没有附属站点的帐号 引导注册
$sess->setInfo('waiting_site_reg', '1');
$tipsType = 'reg';
//.........这里部分代码省略.........
示例11: shareSync
/**
* 分享同步
* @param integer $sid
* @param array $arr
*/
function shareSync($sid, $arr)
{
global $_G;
$type = $title = $pic = '';
if (isset($arr['image']) && !empty($arr['image']) && XWB_plugin::pCfg('is_upload_image')) {
$pic = str_replace('.thumb.jpg', '', $arr['image']);
}
switch (strtolower($arr['type'])) {
case 'space':
$type = 'username';
break;
case 'blog':
$type = 'subject';
break;
case 'album':
$type = 'albumname';
break;
case 'pic':
$type = 'albumname';
break;
case 'thread':
$type = 'subject';
break;
case 'article':
$type = 'title';
break;
case 'link':
case 'video':
case 'music':
case 'flash':
$type = 'link';
break;
default:
break;
}
$arr['body_data'] = unserialize($arr['body_data']);
if (empty($type)) {
return false;
} elseif ('link' != $type) {
$pattern = '/^<a[ ]+href[ ]*=[ ]*"([a-zA-Z0-9\\/\\\\@:%_+.~#*?&=\\-]+)"[ ]*>(.+)<\\/a>$/';
preg_match($pattern, $arr['body_data'][$type], $match);
if (3 !== count($match)) {
return false;
}
$link = $_G['siteurl'] . $match[1];
if (1 == XWB_plugin::pcfg('link_visit_promotion')) {
$link .= '&fromuid=' . $_G['uid'];
}
$title = 'pic' == $type ? $arr['body_data']['title'] : $match[2];
} else {
$link = $arr['body_data']['data'];
}
$message = !empty($arr['body_general']) ? (string) $arr['body_general'] : (string) $arr['title_template'];
if (!empty($title)) {
$message = $this->_convert($message . ' | ' . $title);
} else {
$message = $this->_convert($message);
}
$link = ' ' . $link;
$length = 140 - ceil(strlen(urlencode($link)) * 0.5);
$message = $this->_substr($message, $length);
$message .= $link;
$wb = XWB_plugin::getWB();
// 同步到微博
if (!empty($pic)) {
$ret = $wb->upload($message, $pic, null, null, false);
if (isset($ret['error_code']) && 400 == (int) $ret['error_code']) {
$ret = $wb->update($message, false);
}
} else {
$ret = $wb->update($message, false);
}
//同步微博后的ID
if (!empty($ret['id'])) {
//@todo json_decode可能存在解析超过int最大数的错误(#47644)问题
$mid = $ret['id'];
$this->insertSyncId($sid, $ret['id'], 'share');
//日志同步统计上报
$sess = XWB_plugin::getUser();
$sess->appendStat('ryz', array('uid' => XWB_plugin::getBindInfo("sina_uid"), 'mid' => $mid, 'type' => 4));
}
}
示例12: checkApi
function checkApi()
{
$this->rst = array('ver' => XWB_P_VERSION, 'chatset' => XWB_S_CHARSET, 'pro' => XWB_P_PROJECT, 'switch' => XWB_plugin::pCfg('switch_to_xweibo'));
$this->_LogHelper($this->apiRoute . '/checkApi');
return array('rst' => $this->rst, 'errno' => $this->errno, 'err' => $this->err);
}
示例13: getWeiboProfileLink
/**
* 获取新浪微博或者xweibo的个人主页link
* @param bigint $sina_uid
* @return string
*/
function getWeiboProfileLink($sina_uid = 0)
{
$xweibourl = rtrim(XWB_plugin::pCfg('baseurl_to_xweibo'), '/');
if (XWB_plugin::pCfg('switch_to_xweibo') && !empty($xweibourl)) {
$xweibourl_ta = $xweibourl . '/index.php?m=ta&id=' . $sina_uid;
} else {
$xweibourl_ta = 'http://weibo.com/' . $sina_uid;
}
return $xweibourl_ta;
}
示例14: forShare
/**
* 获取转发主题信息 For DiscuzX1.5
* @param $tid int 论坛thread id
* @return array
*/
function forShare($tid)
{
/* 主题URL */
$baseurl = XWB_plugin::siteUrl();
$topic_url = $baseurl . 'index.php?mod=topic&code=' . $tid;
if (function_exists('get_full_url')) {
$topic_url = get_full_url($baseurl, 'index.php?mod=topic&code=' . $tid);
}
$url = ' ' . $topic_url;
/* 获取微博信息 */
$db = XWB_plugin::getDB();
$topic = $db->fetch_first("SELECT `tid`,`content`,`imageid` FROM " . XWB_S_TBPRE . "topic WHERE tid='{$tid}'");
if (empty($topic)) {
return FALSE;
}
/* 转码 */
$message = $this->_convert(trim($topic['content']));
/* 过滤UBB与表情 */
$message = $this->_filter($message);
$message = strip_tags($message);
/* 将最后附带的url给删除 */
$message = preg_replace("|\\s*http:/" . "/[a-z0-9-\\.\\?\\=&_@/%#]*\$|sim", "", $message);
/* 合并标题和链接 */
$message = $message . $url;
// 取出所有图片
$img_urls = array();
if ($topic['imageid'] && XWB_plugin::pCfg('is_upload_image')) {
$image_file = "/images/topic/" . jsg_face_path($topic['imageid']) . $topic['imageid'] . "_o.jpg";
if (is_file(XWB_S_ROOT . $image_file)) {
$img_urls[] = $baseurl . $image_file;
}
}
return array('url' => $topic_url, 'message' => $message, 'pics' => array_map('trim', $img_urls));
}
示例15: error_reporting
*/
error_reporting(0);
require_once 'plugin.env.php';
require_once XWB_P_ROOT . '/xplugin_apis/apiLoader.php';
XWB_plugin::init();
$apiLoader = new apiLoader();
if (0 === strcasecmp('post', $_SERVER['REQUEST_METHOD'])) {
$A = dstripslashes($_POST['A']);
$P = dstripslashes($_POST['P']);
$T = dstripslashes($_POST['T']);
$F = dstripslashes($_POST['F']);
$RT = $apiLoader->load($A, $P, $T, $F);
} else {
$A = 'apiSystem.checkApi';
$P = json_encode(dstripslashes(isset($_POST['params']) ? (array) $_POST['params'] : array()));
$T = time();
$F = md5(sprintf("#%s#%s#%s#%s#%s#", XWB_APP_KEY, $A, $P, $T, XWB_plugin::pCfg('encrypt_key')));
$RT = $apiLoader->load($A, $P, $T, $F);
}
exit(json_encode($RT));
function dump($var, $desc = false)
{
echo '<pre>';
if ($desc) {
var_dump($var);
} else {
print_r($var);
}
echo '</pre>';
exit;
}