本文整理汇总了PHP中XWB_plugin类的典型用法代码示例。如果您正苦于以下问题:PHP XWB_plugin类的具体用法?PHP XWB_plugin怎么用?PHP XWB_plugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XWB_plugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gc
function gc()
{
$db = XWB_plugin::getDB();
$table = XWB_S_TBPRE . 'common_cache';
$timestamp = time() - 15 * 60;
$sql = "DELETE FROM `{$table}` WHERE `cachekey` LIKE 'xipct_%' AND `dateline` < '{$timestamp}' ";
$db->query($sql);
}
示例2: xwbSiteUserRegister
/**
* 资源初始化
* @access public
* @return xwbSiteUserRegister
*/
function xwbSiteUserRegister()
{
global $_G;
loaducenter();
$this->db = XWB_plugin::getDB();
$this->ip = (string) $_G['clientip'];
$this->timestamp = TIMESTAMP;
}
示例3: switchMode
function switchMode($LTXCfg = 1, $UTXCfg = '', $BTXCfg = '')
{
$FTParams = 1 == $LTXCfg ? array('nbool_LTXCfg' => $LTXCfg, 'http_UTXCfg' => $UTXCfg, 'http_BTXCfg' => $BTXCfg) : array('nbool_LTXCfg' => $LTXCfg);
if ($this->_FTHelper($FTParams)) {
$config = 1 == $LTXCfg ? array('switch_to_xweibo' => (int) $LTXCfg, 'url_to_xweibo' => $UTXCfg, 'baseurl_to_xweibo' => $BTXCfg) : array('switch_to_xweibo' => (int) $LTXCfg);
XWB_plugin::setPCfg($config) || $this->_ERHelper('4021001');
$this->rst = TRUE;
}
$this->_LogHelper($this->apiRoute . '/switchMode');
return array('rst' => $this->rst, 'errno' => $this->errno, 'err' => $this->err);
}
示例4: xwb_setSiteRegister
function xwb_setSiteRegister($nickname, $email, $pwd = false)
{
$db = XWB_plugin::getDB();
$uid = 0;
$password = $pwd ? $pwd : rand(100000, 999999);
$regstatus = jsg_member_register_check_status();
if ($regstatus['normal_enable'] || true === JISHIGOU_FORCED_REGISTER) {
$uid = jsg_member_register($nickname, $password, $email);
}
$rst = array('uid' => $uid, 'password' => $password);
return $rst;
}
示例5: _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;
}
示例6: sinaUidFilter
/**
* 过滤已经绑定到新浪微博的discuz!帐号
* @version $Id: sinaUidFilter.function.php 817 2011-06-02 07:38:51Z yaoying $
* @param array $uid 要过滤的uid号码数组。传参前,请自行保证里面的全是int。此处不作检查
* @param bool $remote 是否也进行远程api查询?默认为否
* @return array
*/
function sinaUidFilter($uid, $remote = false)
{
$sina_uid = array();
if (empty($uid)) {
return $sina_uid;
}
$rs = XWB_plugin::getBatchBindUser($uid, $remote);
//远程API
foreach ($rs as $row) {
$sina_uid[$row['uid']] = $row['sina_uid'];
}
return $sina_uid;
}
示例7: step1
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;
}
示例8: 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' => '配置文件无法写入')));
}
}
示例9: verify
/**
* 进行身份验证
* 请保证传参所用字符集和论坛字符集一致,否则请先自行转换再传参
* @param string $username
* @param string $password
* @param int $questionid
* @param string $answer
* @param boolen $isuid 使用UID验证么?
* @return array
* 第一个数组下标($return[0])若大于0,则表示验证成功的登录uid。否则为错误信息:
* -1:UC用户不存在,或者被删除
* -2:密码错
* -3:安全提问错
* -4:用户没有在dz注册
* 第二个数组下标($return[1])若大于等于0,则表示验证成功的adminid;
* 否则为-1,表示验证失败
*/
function verify($username, $password, $questionid = '', $answer = '', $isuid = 0)
{
$return = array(0 => -1, 1 => -1);
$ip = XWB_plugin::getIP();
/**
* 校验用户输入错误密码的次数
*/
$failedlogins = $this->db->fetch_first("select * from " . XWB_S_TBPRE . "failedlogins where `ip`='{$ip}'");
if ($failedlogins && $failedlogins['count'] >= 5) {
$return[0] = -5;
return $return;
}
/**
* 校验用户输入的用户名和密码是否正确
*/
if (true === UCENTER) {
//加载Ucenter客户端文件
include_once ROOT_PATH . './api/uc_client/client.php';
$uc_result = uc_user_login($username, $password, $isuid, 0, $questionid, $answer);
$ucuid = $uc_result[0];
if ($ucuid < 1) {
$return[0] = $ucuid;
return $return;
}
}
$member = $this->db->fetch_first("SELECT `uid`, `password`, `nickname`, `username`, `role_type`, `salt` FROM " . XWB_S_TBPRE . "members WHERE `nickname`='{$username}'");
if ($member) {
/**
* 在记事狗系统中比对用户输入的密码
*/
if ($member['password'] == jsg_member_password($password, $member['salt'])) {
$return[0] = (int) $member['uid'];
$return[1] = 'admin' == $member['role_type'] ? 1 : 0;
} else {
$return[0] = -2;
/**
* 更新密码输入错误的次数
*/
if ($failedlogins) {
$this->db->query("update " . XWB_S_TBPRE . "failedlogins set `count`='" . (max(1, (int) $failedlogins['count']) + 1) . "', `lastupdate`='" . time() . "' where `ip`='{$ip}'");
} else {
$this->db->query("insert into " . XWB_S_TBPRE . "failedlogins (`ip`,`count`,`lastupdate`) values ('{$ip}','1','" . time() . "')");
}
}
}
return $return;
}
示例10: 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' => '配置文件无法写入')));
}
}
示例11: _session_start
/**
* 启动session
*/
function _session_start()
{
$operatorType = defined('XWB_P_SESSION_OPERATOR') ? strtolower(XWB_P_SESSION_OPERATOR) : 'native';
$storageType = defined('XWB_P_SESSION_STORAGE_TYPE') ? strtolower(XWB_P_SESSION_STORAGE_TYPE) : '';
//session操作器初始化
$this->_operator = XWB_plugin::O('session/session_operator_' . $operatorType);
//session存储器注册到session操作器中
if (!empty($storageType)) {
$sessStorage = XWB_plugin::O('session/session_storage_' . $storageType);
$this->_operator->setStorageHandler($sessStorage);
//模拟操作器必须要有一个session存储器
} elseif ('simulator' == $operatorType) {
//XWB_plugin::showError('管理员设置错误,导致程序被终止。请联系管理员解决。<br />错误原因:You have defined SIMULATOR session operator but does not define a session STORAGE type! SYSTEM HALTED!');
trigger_error('You have defined SIMULATOR session operator but does not define a session STORAGE type! SYSTEM HALTED!', 256);
}
$this->_operator->session_start();
}
示例12: xwb_setSiteUserLogin
function xwb_setSiteUserLogin($uid)
{
global $_G;
if (empty($uid)) {
return false;
}
$db = XWB_plugin::getDB();
//登录
$member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $uid . "'");
if (!$member) {
return false;
}
setloginstatus($member, time() + 60 * 60 * 24 ? 2592000 : 0);
DB::query("UPDATE " . DB::table('common_member_status') . " SET lastip='" . $_G['clientip'] . "', lastvisit='" . time() . "' WHERE uid='{$uid}'");
include_once libfile('function/stat');
updatestat('login');
updatecreditbyaction('daylogin', $uid);
checkusergroup($uid);
return true;
}
示例13: 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;
}
示例14:
?>
<div class="users">
<a href="<?php
echo XWB_plugin::getWeiboProfileLink($value['sina_uid']);
?>
" target="_blank"><?php
echo $value['avatar'];
?>
</a>
<div class="user-info">
<p><?php
echo XWB_plugin::convertEncoding($value['username'], XWB_S_CHARSET, 'UTF-8');
?>
</p>
<a class="addfollow-btn" href="<?php
echo XWB_plugin::getWeiboProfileLink($value['sina_uid']);
?>
" target="_blank"></a>
<a class="already-addfollow-btn hidden" href="javascript:void(0)#"></a>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
<?php
}
?>
示例15: exit
<?php
/*
* @version $Id: viewthread.hack.php 673 2011-05-03 02:06:05Z yaoying $
*/
if (!defined('IS_IN_XWB_PLUGIN')) {
exit('Access Denied!');
}
global $_G;
$uids = array();
$sina_uid = array();
foreach ($GLOBALS['postlist'] as $key => $row) {
$uids[] = (int) $row['authorid'];
//签名替换
$GLOBALS['postlist'][$key]['signature'] = isset($row['signature']) ? XWB_plugin::F('xwb_format_signature', $row['signature']) : '';
if ($row['first'] && XWB_plugin::pCfg('is_rebutton_display')) {
$this->viewthread_subject = $row['subject'];
}
}
$sina_uid = XWB_plugin::F('sinaUidFilter', $uids, false);