本文整理汇总了PHP中XWB_plugin::getDB方法的典型用法代码示例。如果您正苦于以下问题:PHP XWB_plugin::getDB方法的具体用法?PHP XWB_plugin::getDB怎么用?PHP XWB_plugin::getDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XWB_plugin
的用法示例。
在下文中一共展示了XWB_plugin::getDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _DBHelper
function _DBHelper($Query, $action)
{
$DBHandler = XWB_plugin::getDB();
switch ($action) {
case 1:
//GET FIRST RECORD
return $DBHandler->fetch_first($Query);
break;
case 2:
//INSERT, UPDATE, DELETE
return $DBHandler->query($Query, 'UNBUFFERED') ? TRUE : $this->_ERHelper('4030003');
break;
case 3:
//SELECT
$RT = $DBHandler->query($Query);
$RS = array();
while ($row = $DBHandler->fetch_array($RT)) {
$RS[] = $row;
}
return $RS;
break;
default:
return $this->_ERHelper('4030002');
}
}
示例2: 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);
}
示例3: xwbSiteUserRegister
/**
* 资源初始化
* @access public
* @return xwbSiteUserRegister
*/
function xwbSiteUserRegister()
{
global $_G;
loaducenter();
$this->db = XWB_plugin::getDB();
$this->ip = (string) $_G['clientip'];
$this->timestamp = TIMESTAMP;
}
示例4: sync4DX
/**
* 同步头像到指定的DZX uid,成功则执行一些更新后的操作
*
* @param integer $uid DZ uid
* @return integer 同步结果
*/
function sync4DX($uid)
{
loaducenter();
$result = $this->syncToUC($uid);
if ($result >= 0) {
$db = XWB_plugin::getDB();
$sql = "UPDATE " . DB::table('common_member') . " SET avatarstatus = '1' WHERE uid='{$uid}'";
$db->query($sql, 'UNBUFFERED');
}
$this->_logFaceSyncResult($result);
}
示例5: 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;
}
示例6: sitePushback2thread
/**
* 构造函数
*/
function sitePushback2thread()
{
$this->_userConfig['ip'] = mysql_real_escape_string(XWB_plugin::getIP());
$this->_userConfig['uid'] = (int) XWB_plugin::pCfg('pushback_uid');
$this->_userConfig['username'] = mysql_real_escape_string(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';
}
$this->_db = XWB_plugin::getDB();
}
示例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: 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;
}
示例9: _importUserFromUC
/**
* 将用户帐号导入(主要应对用了UC的多论坛)
* 本函数主要供_setPushbackSiteAccount方法使用
* @param array $userInfo uc_get_user返回的数据
*/
function _importUserFromUC($userInfo)
{
$uid = (int) $userInfo[0];
$db = XWB_plugin::getDB();
$exist_uid = intval($db->result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$userInfo[0]}' LIMIT 0,1 "));
if ($exist_uid > 0) {
return true;
}
$username = mysql_real_escape_string($userInfo[1]);
$email = mysql_real_escape_string($userInfo[2]);
$password = md5(rand(1, 10000));
$db->query("INSERT IGNORE INTO " . DB::table('common_member') . " (uid, username, password, adminid, groupid, email)\n\t\t\tVALUES ('{$uid}', '{$username}', '{$password}', '0', '10', '{$email}')");
$db->query("INSERT IGNORE INTO " . DB::table('common_member_status') . " (uid)\n\t\t\tVALUES ('{$uid}')");
$db->query("INSERT IGNORE INTO " . DB::table('common_member_profile') . " (uid)\n\t\t\tVALUES ('{$uid}')");
$db->query("INSERT IGNORE INTO " . DB::table('common_member_field_forum') . " (uid)\n\t\t\tVALUES ('{$uid}')");
$db->query("INSERT IGNORE INTO " . DB::table('common_member_field_home') . " (uid)\n\t\t\tVALUES ('{$uid}')");
$db->query("INSERT IGNORE INTO " . DB::table('common_member_count') . " (uid)\n\t\t\tVALUES ('{$uid}')");
manyoulog('user', $this->uid, 'add');
return true;
}
示例10: xwbUserProfile
function xwbUserProfile()
{
$this->uid = XWB_S_UID;
$this->db = XWB_plugin::getDB();
}
示例11: xwbUserProfile
function xwbUserProfile()
{
$this->uid = XWB_S_UID;
$this->db = XWB_plugin::getDB();
$this->tablepre = XWB_S_TBPRE;
}
示例12: siteUserVerifier
function siteUserVerifier()
{
$this->db = XWB_plugin::getDB();
}
示例13: bind
function bind()
{
if (!XWB_plugin::pCfg('is_account_binding')) {
XWB_plugin::showError('新浪微博绑定功能已经关闭!');
}
if (XWB_S_UID > 0 && XWB_plugin::isUserBinded()) {
$xwb_user = XWB_plugin::getUser();
$sina_id = $xwb_user->getInfo('sina_uid');
$wb = XWB_plugin::getWB();
$wb->is_exit_error = false;
$sina_user_info = $wb->getUserShow($sina_id);
if (isset($sina_user_info['error_code']) || isset($sina_user_info['error'])) {
include XWB_P_ROOT . '/tpl/xwb_cenbind_error.tpl.php';
} else {
$db = XWB_plugin::getDB();
$share = XWB_plugin::V("R:share");
$share_msg = '';
if ($share) {
$bind_info = $db->fetch_first("select * from " . XWB_S_TBPRE . "xwb_bind_info where `uid`='" . XWB_S_UID . "'");
$share_time = $bind_info['share_time'];
if (!$share_time) {
$share_time = time();
$db->query("update " . XWB_S_TBPRE . "xwb_bind_info set `share_time`='" . $share_time . "' where `uid`='" . XWB_S_UID . "'");
jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
$share_msg = "<img src='" . (XWB_plugin::baseUrl() . XWB_plugin::URL('&code=enter&share_time=' . $share_time)) . "' width='0' height='0' />";
}
} else {
/**
* 分享给好友显示页面
*/
$skip_share = XWB_plugin::V("R:skip_share");
if (!$skip_share) {
$bind_info = $db->fetch_first("select * from " . XWB_S_TBPRE . "xwb_bind_info where `uid`='" . XWB_S_UID . "'");
if (!$bind_info['share_time']) {
include XWB_P_ROOT . '/tpl/xwb_cenbind_share.tpl.php';
exit;
}
}
}
$screen_name = $sina_user_info['screen_name'];
$profile = XWB_plugin::O('xwbUserProfile');
$setting = $profile->get('bind_setting', 1);
$tojishigou = $profile->get('synctopic_tojishigou', 0);
$reply_tojishigou = $profile->get('syncreply_tojishigou', 0);
include XWB_P_ROOT . '/tpl/xwb_cenbind_on.tpl.php';
}
} else {
include XWB_P_ROOT . '/tpl/xwb_cenbind_off.tpl.php';
}
}
示例14: exit
<?php
/*
* @version $Id: newcomment2blog.hack.php 836 2011-06-15 01:48:00Z yaoying $
*/
if (!defined('IS_IN_XWB_PLUGIN')) {
exit('Access Denied!');
}
global $_G;
$blogid = isset($_G['gp_id']) ? (int) $_G['gp_id'] : 0;
//dz在spacecp_comment.php处可能存在漏洞,用了$_POST
$idtype = isset($_G['gp_idtype']) ? (string) $_G['gp_idtype'] : '';
$message = !empty($GLOBALS['message']) ? (string) $GLOBALS['message'] : '';
//评论的上一id
$up_cid = isset($_G['gp_cid']) ? (int) $_G['gp_cid'] : 0;
if ($blogid > 0 && $up_cid == 0 && $idtype == 'blogid') {
$db = XWB_plugin::getDB();
$query = $db->query("SELECT * FROM " . DB::table('home_blog') . " WHERE blogid='{$blogid}'");
$blog = $db->fetch_array($query);
if (!empty($blog)) {
$xp_publish = XWB_plugin::N('xwb_plugins_publish');
register_shutdown_function(array(&$xp_publish, 'blogCommentSync'), $blogid, $blog['uid'], (string) $message);
}
}
示例15: addBindUser
/**
* 新增用户绑定关系
*
*/
function addBindUser($site_uid, $sina_uid, $access_toke, $token_secret, $nickname = false, $turn = true)
{
if ($site_uid < 1) {
return false;
}
$db = XWB_plugin::getDB();
$site_uid = mysql_escape_string($site_uid);
$sina_uid = mysql_escape_string($sina_uid);
$access_toke = mysql_escape_string($access_toke);
$token_secret = mysql_escape_string($token_secret);
$sql = "INSERT INTO " . DB::table('xwb_bind_info') . " (`uid`,`sina_uid`,`token`,`tsecret`,`profile`) VALUES('{$site_uid}','{$sina_uid}','{$access_toke}','{$token_secret}','[]')";
$rst = $db->query($sql, 'UNBUFFERED');
$switch = XWB_plugin::pCfg('switch_to_xweibo');
if ($turn && $switch && $rst) {
$api = XWB_plugin::N('apixwb');
$api->updateBindUser($site_uid, $sina_uid, $access_toke, $token_secret, $nickname);
}
return $rst;
}