function _clearCacheForThreadPost($tableName, $pids)
 {
     $tids = $this->_getTidsByPid($tableName, $pids);
     if (perf::checkMemcache() && $tids) {
         foreach ($tids as $tid) {
             $this->_service->clearCacheForThreadPost($tid);
         }
     }
 }
 function delete($tableName, $fields, $expand = array())
 {
     $this->_service->logMembers('delete', $fields);
     $this->_service->syncData('delete', $fields);
     if (perf::checkMemcache()) {
         $this->_service->cleanMemberCacheWithUserIds($tableName, $fields);
     } else {
         $this->_service->cleanMemberDbCacheWithUserIds($tableName, $fields);
     }
 }
Beispiel #3
0
 function delete($tableName, $fields, $expand = array())
 {
     $this->_service->logThreads('delete', $fields);
     $this->_service->syncData('delete', $fields);
     if (perf::checkMemcache()) {
         $this->_service->cleanThreadCacheWithThreadIds($tableName, $fields);
         $this->_service->cleanThreadCacheWithForumIds($fields);
     }
     $this->_service->updateThreadImage('delete', $fields, $expand);
     //$this->_service->updateThreadsIndexer('delete',$fields,$expand);
 }
 function getBbsInfoById($id)
 {
     $id = S::int($id);
     if ($id < 1) {
         return false;
     }
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_bbsinfo');
         return $_cacheService->getBbsInfoById($id);
     }
     $bbsInfoDb = $this->_getBbsInfoDB();
     return $bbsInfoDb->get($id);
 }
Beispiel #5
0
 function PwSpace($uid)
 {
     global $db, $winduid, $db_phopen, $db_dopen, $db_groups_open;
     $this->_db =& $db;
     $this->uid = $uid;
     $userService = L::loadClass('UserService', 'user');
     if ($winduid && $winduid == $uid) {
         $this->info = $GLOBALS['winddb'];
         $this->info['isMe'] = 1;
     } elseif ($userdb = $userService->get($this->uid, true, true, true)) {
         //$userdb['rvrc'] /= 10;
         $this->info = $userdb;
     }
     if ($this->info) {
         if (perf::checkMemcache()) {
             $_cacheService = Perf::gatherCache('pw_space');
             $space = $_cacheService->getSpaceByUid($this->uid);
         } else {
             $space = $this->_db->get_one("SELECT * FROM pw_space WHERE uid=" . S::sqlEscape($this->uid));
         }
         if ($space) {
             $this->info = array_merge($this->info, $space);
             if ($this->info['banner']) {
                 list($this->info['banner_s']) = geturl($this->info['banner'], 'lf');
             }
         } else {
             $this->default = true;
         }
         $spaceGroupid = $this->info['groupid'] == -1 ? $this->info['memberid'] : $this->info['groupid'];
         include pwCache::getPath(D_P . "data/groupdb/group_{$spaceGroupid}.php");
         $this->info['generalRight'] = $_G;
         !$this->info['name'] && ($this->info['name'] = $this->info['username'] . '的个人主页');
         !$this->info['skin'] && ($this->info['skin'] = 'default85');
         $GLOBALS['uskin'] =& $this->info['skin'];
     }
     if ($db_dopen) {
         $this->models[] = 'diary';
     }
     if ($db_phopen) {
         $this->models[] = 'photos';
     }
     if ($db_groups_open) {
         $this->models[] = 'colony';
     }
 }
<?php

require_once "perf.php";
$p = new perf();
if (isset($_COOKIE['userno'])) {
    require 'init_smarty.php';
    require 'tmUtils.php';
    class gFormVar
    {
        public $name;
        public $queryId = "";
        public $userid;
        public $colList;
        public $debug;
        public $pfilter = false;
        public $ufilter = false;
        public $stylesheet = 'normal.css';
        public $pageTitle = 'Project Tracking Database';
    }
    $g = new gFormVar();
    DBConnect();
    GetPrefs();
    if ($_SERVER['QUERY_STRING']) {
        parse_str($_SERVER['QUERY_STRING']);
        #
        if (isset($user)) {
            $_SESSION['devID'] = $user;
            $devID = $user;
            $g->queryId = $user;
        }
        if (isset($proj)) {
Beispiel #7
0
<?php

!defined('P_W') && exit('Forbidden');
S::gp(array('uid', 'sign'));
$uid = intval($uid);
if (!$sign) {
    Showmsg('error');
}
if ($uid < 1) {
    $bubble = GetCookie('bubble') ? GetCookie('bubble') : array();
    $bubble = unserialize(stripslashes($bubble));
    $bubble[$sign] = 1;
    Cookie("bubble", serialize($bubble));
    Showmsg('error');
}
if ($uid != $winduid) {
    Showmsg('undefined_action');
}
$cache = perf::gatherCache('pw_members');
$userData = $cache->getMemberDataByUserId($uid);
if (!$userData) {
    Showmsg('error');
}
$bubbleInfo = $userData['bubble'] ? unserialize($userData['bubble']) : array();
$bubbleInfo[$sign] = 1;
$userService = L::loadClass('userservice', 'user');
$userService->update($uid, array(), array('bubble' => serialize($bubbleInfo)));
echo 'success';
ajax_footer();
 function delete($tableName, $fields, $expand = array())
 {
     perf::checkMemcache() && $this->_service->clearCacheByName($tableName, $fields);
 }
 /**
  * 根据uid获取标签信息
  * 
  * @param int $uid 
  * @return array
  */
 function getMemberTagsByUid($uid)
 {
     $uid = intval($uid);
     if ($uid <= 0) {
         return array();
     }
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_members');
         return $_cacheService->getMemberTagsByUserid($uid);
     }
     return $this->getMemberTagsByUidFromDB($uid);
 }
Beispiel #10
0
<?php

!function_exists('readover') && exit('Forbidden');
/**
 * @name:清零卡
 * @type:会员类
 * @effect:可将自已所有负分清零
 */
if ($tooldb['type'] != 2) {
    Showmsg('tooluse_type_error');
    // 判断道具类型是否设置错误
}
$updateMemberData[$winduid] = array();
foreach ($usercreditdb as $key => $value) {
    if (is_numeric($value) && $value < 0) {
        $updateMemberData[$winduid][$key] = 0;
    }
}
unset($usercreditdb, $key, $value);
if (!empty($updateMemberData[$winduid])) {
    $credit->runsql($updateMemberData, false);
    $db->update("UPDATE pw_usertool SET nums=nums-1 WHERE uid=" . S::sqlEscape($winduid) . "AND toolid=" . S::sqlEscape($toolid));
    $logdata = array('type' => 'use', 'nums' => '', 'money' => '', 'descrip' => 'tool_2_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $tooldb['name']);
    writetoollog($logdata);
    //* $_cache = getDatastore();
    //* $_cache->delete('UID_'.$winduid);
    perf::gatherInfo('changeMembersWithUserIds', array('uid' => $winduid));
    Showmsg('toolmsg_2_success');
} else {
    Showmsg('toolmsg_2_failed');
}
 function getUserAppByUidAndAppid($uid, $appid)
 {
     $uid = intval($uid);
     $appid = intval($appid);
     if (perf::checkMemcache()) {
         $apps = $_cacheService->getUserappsCacheByUids($uid);
         foreach ($apps as $v) {
             if ($v['appid'] == $appid) {
                 return $v;
             }
         }
     } else {
         return $this->_db->get_one("SELECT * FROM pw_userapp WHERE uid=" . S::sqlEscape($uid) . " AND appid=" . S::sqlEscape($appid));
     }
     return array();
 }
 function delete($tableName, $fields, $expand = array())
 {
     if (perf::checkMemcache()) {
         $this->_service->cleanBbsInfoCacheById($tableName, $fields);
     }
 }
Beispiel #13
0
/**
 * 获取用户信息
 *
 * @global DB $db
 * @param int $uid
 * @return array
 */
function getUserByUid($uid)
{
    $uid = S::int($uid);
    if ($uid < 1) {
        return false;
    }
    if (perf::checkMemcache()) {
        $_cacheService = Perf::getCacheService();
        $detail = $_cacheService->get('member_all_uid_' . $uid);
        if ($detail && in_array(SCR, array('index', 'read', 'thread', 'post'))) {
            $_singleRight = $_cacheService->get('member_singleright_uid_' . $uid);
            $detail = $_singleRight === false ? false : (array) $detail + (array) $_singleRight;
        }
        if ($detail) {
            return $detail && $detail['groupid'] != 0 && isset($detail['md.uid']) ? $detail : false;
        }
        $cache = perf::gatherCache('pw_members');
        if (in_array(SCR, array('index', 'read', 'thread', 'post'))) {
            $detail = $cache->getMembersAndMemberDataAndSingleRightByUserId($uid);
        } else {
            $detail = $cache->getAllByUserId($uid, true, true);
        }
        return $detail && $detail['groupid'] != 0 && isset($detail['md.uid']) ? $detail : false;
    } else {
        global $db;
        $sqladd = $sqltab = '';
        if (in_array(SCR, array('index', 'read', 'thread', 'post'))) {
            $sqladd = SCR == 'post' ? ',md.postcheck,sr.visit,sr.post,sr.reply' : (SCR == 'read' ? ',sr.visit,sr.reply' : ',sr.visit');
            $sqltab = "LEFT JOIN pw_singleright sr ON m.uid=sr.uid";
        }
        $detail = $db->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.email,m.bday,m.oicq,m.groupid,m.memberid,m.groups,m.icon,m.regdate,m.honor,m.timedf,m.style,m.datefm,m.t_num,m.p_num,m.yz,m.newpm,m.userstatus,m.shortcut,m.medals,m.gender,md.lastmsg,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastvisit,md.thisvisit,md.onlinetime,md.lastpost,md.todaypost,md.monthpost,md.onlineip,md.uploadtime,md.uploadnum,md.starttime,md.pwdctime,md.monoltime,md.digests,md.f_num,md.creditpop,md.jobnum,md.lastgrab,md.follows,md.fans,md.newfans,md.newreferto,md.newcomment,md.punch,md.bubble,md.newnotice,md.newrequest,md.shafa {$sqladd} FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid {$sqltab} WHERE m.uid=" . S::sqlEscape($uid) . " AND m.groupid<>'0' AND md.uid IS NOT NULL");
        return $detail;
    }
}
Beispiel #14
0
 function getFromDB($start, $allowtop)
 {
     list($offset, $limit2, $tpcdb, $R) = $this->getThreadSortWithToppedThread($allowtop, $start);
     if ($limit2) {
         global $db_datastore;
         if ($this->threadSearch->order == 'lastpost' && empty($this->threadSearch->urladd) && perf::checkMemcache() && !$R && $offset < 980) {
             //* $threadlist = L::loadClass('threadlist', 'forum');
             //* $tmpTpcdb = $threadlist->getThreads($this->fid, $offset, $limit2);
             $_cacheService = Perf::gatherCache('pw_threads');
             $tmpTpcdb = $_cacheService->getThreadListByForumId($this->fid, $offset, $limit2);
             $tpcdb = array_merge((array) $tpcdb, (array) $tmpTpcdb);
         } else {
             $sqladd = $this->threadSearch->getSqlAdd($allowtop);
             $query = $this->db->query("SELECT * FROM pw_threads t WHERE t.fid=" . S::sqlEscape($this->fid) . " {$sqladd} ORDER BY t.{$this->threadSearch->order} {$this->threadSearch->asc} " . S::sqlLimit($offset, $limit2));
             while ($thread = $this->db->fetch_array($query)) {
                 $tpcdb[] = $thread;
             }
             $this->db->free_result($query);
             $R && ($tpcdb = array_reverse($tpcdb));
         }
     }
     //$tpcdb = $this->cookThreadHits($tpcdb);
     return $tpcdb;
 }
 function delete($tableName, $fields, $expand = array())
 {
     if (perf::checkMemcache()) {
         $this->_service->cleanWeibocontentCacheWithMids($tableName, $fields);
     }
 }
Beispiel #16
0
                $query = $db->query('SELECT fid FROM pw_forumdata');
                while ($rt = $db->fetch_array($query)) {
                    $_cacheService->delete('forumdata_announce_' . $rt['fid']);
                }
            }
            adminmsg('operate_success');
        } elseif ($action == 'flushMemcache') {
            $pwServer['REQUEST_METHOD'] != 'POST' && PostCheck($verify);
            //* $memcache = new ClearMemcache();
            //* $memcache->flush();
            $_cacheService = L::loadClass('cacheservice', 'utility');
            $_cacheService->flush(PW_CACHE_MEMCACHE);
            adminmsg('operate_success');
        } elseif ($action == 'flushDatastore') {
            //* $db->update("UPDATE pw_datastore SET expire=expire-3600 WHERE skey LIKE ('UID_%')");
            $_cacheService = perf::gatherCache('pw_membersdbcache');
            $_cacheService->flush();
            if (Perf::checkMemcache()) {
                $_cacheService = L::loadClass('cacheservice', 'utility');
                $_cacheService->flush(PW_CACHE_MEMCACHE);
            }
            adminmsg('operate_success');
        }
    }
} elseif ($adminitem == 'pwcache' || $adminitem == 'blacklist') {
    if (empty($action)) {
        if ($_POST['step']) {
            S::gp(array('config'), 'P');
            $ifpwcache = 0;
            foreach ($config['ifpwcache'] as $val) {
                $ifpwcache ^= (int) $val;
Beispiel #17
0
 /**
  * 根据用户id批量获取用户名
  * 
  * @param array $userIds 用户id数组
  * @return array 以uid为key,用户名为值的数组
  */
 function getUserNamesByUserIds($userIds)
 {
     if (!is_array($userIds) || !count($userIds)) {
         return array();
     }
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_members');
         return $_cacheService->getUserNameByUserIds($userIds);
     }
     $userNames = array();
     $members = $this->getByUserIds($userIds);
     foreach ($members as $member) {
         $member['uid'] && ($userNames[$member['uid']] = $member['username']);
     }
     return $userNames;
 }
Beispiel #18
0
 function delete($tableName, $fields, $expand = array())
 {
     if (perf::checkMemcache()) {
         $this->_service->clearCacheForSpaceByUid($tableName, $fields);
     }
 }
 function delete($tableName, $fields, $expand = array())
 {
     if (perf::checkMemcache()) {
         $this->_service->clearPingLogsCacheByTid($fields);
     }
 }
Beispiel #20
0
 function getWeibosByMid($mids)
 {
     if (empty($mids) || !is_numeric($mids) && !is_array($mids)) {
         return array();
     }
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_weibo_content');
         $array = $_cacheService->getWeibosByMids($mids);
     } else {
         $contentDao = L::loadDB('weibo_content', 'sns');
         $array = $contentDao->getWeibosByMid($mids);
     }
     return is_array($mids) ? $array : current($array);
 }
Beispiel #21
0
 /**
  * 获取用户积分
  *
  * @param int		$uid		用户UID
  * @param string	$cType		获取的积分类型
  * return mixed
  */
 function get($uid, $cType = 'ALL')
 {
     global $db;
     $getv = false;
     if (isset($this->cType[$cType])) {
         if (isset($this->getUser[$uid][$cType])) {
             return $this->getUser[$uid][$cType];
         }
         if (is_numeric($cType)) {
             if (perf::checkMemcache()) {
                 $_cacheService = Perf::gatherCache('pw_members');
                 $userCredit = $_cacheService->getMemberCreditByUserIds(array($uid));
                 $getv = $userCredit[$uid][$cType];
             } else {
                 $getv = $db->get_value('SELECT value FROM pw_membercredit WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cType));
             }
             empty($getv) && ($getv = 0);
         } else {
             $getv = $db->get_value("SELECT {$cType} FROM pw_memberdata WHERE uid=" . S::sqlEscape($uid));
             $cType == 'rvrc' && ($getv = intval($getv / 10));
         }
         $this->getUser[$uid][$cType] = $getv;
     }
     if (in_array($cType, array('ALL', 'COMMON', 'CUSTOM'))) {
         $getv = array();
         if ($cType != 'CUSTOM') {
             $getv = $db->get_one("SELECT money,FLOOR(rvrc/10) AS rvrc,credit,currency FROM pw_memberdata WHERE uid=" . S::sqlEscape($uid));
         }
         if ($GLOBALS['_CREDITDB'] && $cType != 'COMMON') {
             if (perf::checkMemcache()) {
                 $_cacheService = Perf::gatherCache('pw_members');
                 $userCredit = $_cacheService->getMemberCreditByUserIds(array($uid));
                 $getv = $userCredit[$uid];
             } else {
                 $query = $db->query("SELECT cid,value FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid));
                 while ($rt = $db->fetch_array($query)) {
                     $getv[$rt['cid']] = $rt['value'];
                 }
             }
         }
         $this->getUser[$uid] = $getv;
     }
     return $getv;
 }
Beispiel #22
0
 /**
  * 获取热门活动
  * return array
  */
 function getHotActive($nums)
 {
     global $timestamp;
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_cache');
         $rt = $_cacheService->getCacheByName('hotactive_3');
     } else {
         $rt = $this->_db->get_one("SELECT * FROM pw_cache WHERE name='hotactive_3'");
     }
     if ($rt && $rt['time'] > $timestamp - 1800) {
         return unserialize($rt['cache']);
     } else {
         list($activedb) = $this->searchList(array('createtime_s' => $timestamp - 2592000), 3, 0, 'members', 'DESC');
         pwQuery::replace('pw_cache', array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp));
         //$this->_db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp)));
         return $activedb;
     }
 }
Beispiel #23
0
	
	if ($tmpUIDs) {#会员信息
		$query = $db->query("SELECT m.uid,m.username,m.gender,m.oicq,m.aliww,m.groupid,m.memberid,m.icon AS micon ,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.thisvisit,md.lastvisit,md.onlinetime,md.starttime $fieldinfo FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid $tableinfo WHERE m.uid IN (".S::sqlImplode($tmpUIDs,false).") ");
		while ($rt = $db->fetch_array($query)) {
			is_array($pwMembers[$rt['uid']]) ? $pwMembers[$rt['uid']] += $rt : $pwMembers[$rt['uid']] = $rt;
			$tmpCacheData['UID_'.$rt['uid']] = $rt;
		}
		is_object($_cache) && $_cache->update($tmpCacheData,3600);
		$db->free_result($query);
	}
	unset($skey,$_uids,$_cache,$tmpUIDs,$tmpCREDITs,$tmpGROUPs,$tmpColonydb,$tmpCustomdb,$tmpCacheData);
}
**/
if ($_uids) {
    $_userIds = array_keys($_uids);
    if (perf::checkMemcache()) {
        $_cacheService = Perf::gatherCache('pw_members');
        $pwMembers = $tableinfo ? $_cacheService->getAllByUserIds($_userIds, true, true, true) : $_cacheService->getAllByUserIds($_userIds, true, true);
        $showCustom && ($customdb = $_cacheService->getMemberCreditByUserIds($_userIds));
        $db_showcolony && ($colonydb = $_cacheService->getCmemberAndColonyByUserIds($_userIds));
    } else {
        $_dbCacheService = Perf::gatherCache('pw_membersdbcache');
        list($pwMembers, $customdb, $colonydb) = $_dbCacheService->getUserDBCacheByUserIds($_userIds, $showCustom, $db_showcolony, $showfield);
        /**		
        		$skey = array();
        		foreach ($_uids as $key=>$value) {
        			$skey[$value] = $key;
        			$db_showcolony && $skey['UID_GROUP_'.$key] = $key;
        			$showCustom && $skey['UID_CREDIT_'.$key] = $key;
        		}
        		
Beispiel #24
0
 /**
  * 获取热门话题
  * @param int $o_weibo_hottopicdays 热门话题榜缓存时间
  * @param int $timestamp 时间戳
  * @param array $db
  * @return array $TopicDb
  */
 function getWeiboHotTopics()
 {
     global $o_weibo_hottopicdays, $timestamp, $db;
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_cache');
         $rt = $_cacheService->getCacheByName('weiboHotTopics_10');
     } else {
         $rt = $db->get_one("SELECT * FROM pw_cache WHERE name='weiboHotTopics_10'");
     }
     $lastData = @unserialize($rt['cache']);
     $weiboHotTopics = array();
     if ($lastData && $rt['time'] > $timestamp - 7200) {
         $weiboHotTopics = (array) $lastData;
     } else {
         $days = $o_weibo_hottopicdays ? intval($o_weibo_hottopicdays) : 7;
         $weiboHotTopics = $this->getHotTopics(10, $days);
         /*与上一次比较排名变化*/
         foreach (array($lastData) as $k => $v) {
             if (!isset($v['order'])) {
                 continue;
             }
             if ($v['order'] < $weiboHotTopics[$k]['order']) {
                 $weiboHotTopics[$k]['change'] = 2;
                 //排名下降
             } elseif ($v['order'] > $weiboHotTopics[$k]['order']) {
                 $weiboHotTopics[$k]['change'] = 1;
                 //排名上升
             } else {
                 $weiboHotTopics[$k]['change'] = 0;
             }
         }
         /*	
         $db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array(
         	'name'	=> 'weiboHotTopics_10',
         	'cache'	=> serialize($weiboHotTopics),
         	'time'	=> $timestamp
         )));
         */
         pwQuery::replace('pw_cache', array('name' => 'weiboHotTopics_10', 'cache' => serialize($weiboHotTopics), 'time' => $timestamp));
     }
     return $weiboHotTopics;
 }