Esempio n. 1
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();
Esempio n. 2
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;
Esempio n. 3
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;
    }
}