function updateForumCount($fid, $topic, $replies, $tpost = 0) { global $db, $db_fcachenum; $fm = $db->get_one("SELECT fup,type,password,allowvisit,f_type FROM pw_forums WHERE fid=" . S::sqlEscape($fid)); if ($fm['type'] == 'category') { return false; } delfcache($fid, $db_fcachenum); $topic = intval($topic); $article = $topic + intval($replies); $tpost = intval($tpost); $lastpost = ''; $lt = $db->get_one("SELECT tid,author,postdate,lastpost,lastposter,subject FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort='0' AND ifcheck='1' AND lastpost>0 ORDER BY lastpost DESC LIMIT 1"); if ($lt) { if ($lt['postdate'] == $lt['lastpost']) { $subject = substrs($lt['subject'], 26); } else { $subject = 'Re:' . substrs($lt['subject'], 26); } $lastpost = ",lastpost=" . S::sqlEscape($subject . "\t" . $lt['lastposter'] . "\t" . $lt['lastpost'] . "\t" . "read.php?tid={$lt['tid']}&page=e#a"); } $db->update("UPDATE pw_forumdata SET article=article+'{$article}',topic=topic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid=" . S::sqlEscape($fid)); Perf::gatherInfo('changeForumData', array('fid' => $fid)); if (($fm['type'] == 'sub' || $fm['type'] == 'sub2') && ($fids = getUpFids($fid))) { if ($fm['password'] != '' || $fm['allowvisit'] != '' || $fm['f_type'] == 'hidden') { $lastpost = ''; } $db->update("UPDATE pw_forumdata SET article=article+'{$article}',subtopic=subtopic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid IN(" . S::sqlImplode($fids) . ')'); Perf::gatherInfo('changeForumData', array('fid' => $fids)); } }
function _getThreadData($tid) { //* $threadService = L::loadClass('threads','forum'); //* return $threadService->getThreads($tid, true); $_cacheService = Perf::gatherCache('pw_threads'); return $_cacheService->getThreadAndTmsgByThreadId($tid); }
function clearForumsCache($tableName, $fields) { $fids = isset($fields['fid']) ? is_array($fields['fid']) ? $fields['fid'] : array($fields['fid']) : null; $_cacheService = Perf::getCacheService(); switch ($tableName) { case 'pw_forums': $_cacheService->delete('all_forums_info'); break; case 'pw_forumdata': $_cacheService->delete('all_forums_info'); if ($fids) { foreach ($fids as $fourmId) { $_cacheService->delete('forumdata_announce_' . $fourmId); } break; } case 'pw_announce': $query = $GLOBALS['db']->query('SELECT fid FROM pw_forumdata'); while ($rt = $GLOBALS['db']->fetch_array($query)) { $_cacheService->delete('forumdata_announce_' . $rt['fid']); } break; default: break; } }
function getSendToUsernames($type, $tid) { global $windid, $db; $usernames = array(); if (!$type || !$tid) { return $usernames; } $remindUsernames = $db->get_value("SELECT db_value FROM pw_config WHERE db_name = 'report_remind'"); $remindUsernames = $remindUsernames ? unserialize($remindUsernames) : array(); foreach ($remindUsernames as $key => $value) { if ($value['username'] == $windid) { continue; } $usernames[] = $value['username']; } if ($type != 'topic') { return $usernames; } $_cacheService = Perf::gatherCache('pw_threads'); $threads = $_cacheService->getThreadByThreadId($tid); $fid = $threads['fid']; L::loadClass('forum', 'forum', false); $forumService = new PwForum($fid); $foruminfo = $forumService->foruminfo; $forumadmins = $foruminfo['forumadmin']; $forumadmins = explode(',', $forumadmins); foreach ($forumadmins as $forumadmin) { if (!$forumadmin || $forumadmin == $windid) { continue; } $usernames[] = $forumadmin; } return $usernames; }
function clearCacheForSpaceByUid($tableName, $fields) { if (!isset($fields['uid'])) { return false; } $cache = Perf::gatherCache('PW_Space'); $cache->clearCacheForSpaceByUid($fields['uid']); }
function clearCacheByName($tableName, $fields) { if (!isset($fields['name'])) { return false; } $cache = Perf::gatherCache('PW_Cache'); $cache->clearCacheByName($fields['name']); }
function cleanWeibocontentCacheWithMids($tableName, $fields) { if (!isset($fields['mid'])) { return false; } $mids = is_array($fields['mid']) ? $fields['mid'] : array($fields['mid']); $cache = Perf::gatherCache('pw_weibo_content'); $cache->clearCacheForWeiboContentsByMids($mids); }
/** * 获取个人APP列表 */ function userApplist($uids, $appids = '', $arrt = 0) { if (!$uids) { return false; } $this->_app_array = array(); $this->_appslist = $this->getApplist(); $sql_uid = $sql_appid = ''; if (is_numeric($uids)) { $sql_uid .= ' uid=' . S::sqlEscape($uids); } elseif (is_array($uids)) { $sql_uid .= ' uid IN(' . S::sqlImplode($uids) . ')'; } if (is_numeric($appids)) { $sql_appid .= ' AND appid=' . S::sqlEscape($appids); } elseif (is_array($appids)) { $sql_appid .= ' AND appid IN(' . S::sqlImplode($appids) . ')'; } //$query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE $sql_uid $sql_appid"); if (perf::checkMemcache()) { $appids = is_array($appids) ? $appids : array(intval($appids)); $_cacheService = Perf::gatherCache('pw_userapp'); $array = $_cacheService->getUserappsCacheByUids($uids); foreach ($array as $v) { if (in_array($v['appid'], $appids)) { continue; } if ($this->_appslist[$v['appid']]) { if ($arrt == 1) { $this->_app_array[$v['appid']] = $v['appname']; } elseif ($arrt == 2) { $this->_app_array[$v['uid']][$v['appid']] = $v; } else { $this->_app_array[] = $v; } } } } else { $query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE {$sql_uid} {$sql_appid}"); while ($rt = $this->_db->fetch_array($query)) { if ($this->_appslist[$rt['appid']]) { if ($arrt == 1) { $this->_app_array[$rt['appid']] = $rt['appname']; } elseif ($arrt == 2) { $this->_app_array[$rt['uid']][$rt['appid']] = $rt; } else { $this->_app_array[] = $rt; } } } } if (!$this->_app_array || !$this->appifopen) { $this->_app_array = array(); } return $this->_app_array; }
function run() { $tid = $this->getVar('tid'); $db_htmifopen = $this->getVar('db_htmifopen'); $winduid = $this->getVar('winduid'); require_once R_P . 'require/functions.php'; $_cacheService = Perf::gatherCache('pw_threads'); $thread = $page > 1 ? $_cacheService->getThreadByThreadId($tid) : $_cacheService->getThreadAndTmsgByThreadId($tid); initJob($winduid, "doReply", array('tid' => $tid, 'user' => $thread['author'])); }
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); }
function _postThread($id, $postAudit, $expand) { $postVerifyService = $this->getPostVerifyService(); $postVerifyService->insertPostVerify(1, $id, 0); $GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . CLOUDWIND_SECURITY_SERVICE::sqlEscape($id)); if (class_exists("Perf")) { Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $expand['fid'])); // 8.3+ } else { $threadList = L::loadClass("threadlist", 'forum'); $threadList && $threadList->refreshThreadIdsByForumId($expand['fid']); } return true; }
function clearPingLogsCacheByTid($fields) { global $tid, $db; $id = isset($fields['id']) ? $fields['id'] : 1; if (!$tid && !$id) { return false; } if (!$tid) { $id = is_array($id) ? end($id) : $id; $tid = $db->get_value('SELECT tid FROM pw_pinglog WHERE id=' . S::sqlEscape($id)); } $cache = Perf::gatherCache('pw_ping'); $cache->clearPingLogsCache($tid); }
function shieldThread($tid, $fid) { list($tid, $fid) = array(intval($tid), intval($fid)); if ($tid < 1 || $fid < 1) { return $this->buildResponse(THREAD_INVALID_PARAMS); } $GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . S::sqlEscape($tid)); if (class_exists("Perf")) { Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid)); } else { $threadList = L::loadClass("threadlist", 'forum'); $threadList && $threadList->refreshThreadIdsByForumId($fid); } return $this->buildResponse(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'; } }
if (is_numeric($o_u) && strlen($hash) == 18) { require_once R_P . 'require/o_invite.php'; } } $visitors = unserialize($space['visitors']); is_array($visitors) || ($visitors = array()); if (!isset($visitors[$winduid]) || $timestamp - $visitors[$winduid] > 900) { $visitors[$winduid] = $timestamp; arsort($visitors); if (count($visitors) > 12) { array_pop($visitors); } $db->pw_update("SELECT uid FROM pw_space WHERE uid=" . S::sqlEscape($uid), pwQuery::buildClause("UPDATE :pw_table SET visits=visits+1,visitors=:visitors WHERE uid=:uid", array('pw_space', serialize($visitors), intval($uid))), pwQuery::insertClause('pw_space', array('uid' => $uid, 'visits' => 1, 'visitors' => serialize($visitors)))); } if (perf::checkMemcache()) { $_cacheService = Perf::gatherCache('pw_space'); $tmp = $_cacheService->getSpaceByUid($winduid); $tovisitors = $tmp['tovisitors']; } else { $tovisitors = $db->get_value("SELECT tovisitors FROM pw_space WHERE uid=" . S::sqlEscape($winduid)); } $tovisitors = unserialize($tovisitors); is_array($tovisitors) || ($tovisitors = array()); if (!isset($tovisitors[$uid]) || $timestamp - $tovisitors[$uid] > 900) { $tovisitors[$uid] = $timestamp; arsort($tovisitors); if (count($tovisitors) > 12) { array_pop($tovisitors); } //$db->update("UPDATE pw_space SET tovisits=tovisits+'1',tovisitors=" . S::sqlEscape(serialize($tovisitors),false) . " WHERE uid=" . S::sqlEscape($winduid)); $db->update(pwQuery::buildClause("UPDATE :pw_table SET tovisits=tovisits+1,tovisitors=:tovisitors WHERE uid=:uid", array('pw_space', serialize($tovisitors), $winduid)));
$tmpArray = $sendto + array(0); $db->query("CREATE TEMPORARY TABLE tmp_datastate SELECT uid FROM pw_members WHERE groupid IN(" . S::sqlImplode($tmpArray) . ')' . pwLimit(($step - 1) * $perpage, $perpage)); $db->update("INSERT INTO pw_ms_configs (uid) SELECT a.uid FROM tmp_datastate a LEFT JOIN pw_ms_configs b ON a.uid=b.uid WHERE b.uid IS NULL"); $db->update("UPDATE tmp_datastate a LEFT JOIN pw_members m ON a.uid=m.uid LEFT JOIN pw_ms_configs c ON a.uid=c.uid SET m.newpm=m.newpm+1,c.notice_num=c.notice_num+1"); //* 清除pw_members缓存 start $_num = $db->get_value("SELECT count(*) FROM tmp_datastate"); if ($_num > 1500) { $_cacheService = L::loadClass('cacheservice', 'utility'); $_cacheService->flush(PW_CACHE_MEMCACHE); } else { $_query = $db->query("SELECT uid FROM tmp_datastate"); $_uids = array(); while ($rt = $db->fetch_array($_query)) { $_uids[] = $rt['uid']; } Perf::gatherInfo('changeMembersWithUserIds', array('uid' => $_uids)); } //* 清除pw_members缓存 end if ($havesend < $count) { $step++; $j_url = "{$basename}&action={$action}&step={$step}&sendto=" . implode(',', $sendto) . "&by={$by}&count={$count}"; adminmsg("sendmsg_step", EncodeUrl($j_url), 1); } adminmsg('operate_success'); } elseif ($by == 2) { $cache_file = D_P . "data/bbscache/" . substr(md5($admin_pwd), 10, 10) . ".txt"; if (!$step) { pwCache::setData($cache_file, $atc_content); } else { //* $atc_content = readover($cache_file); $atc_content = pwCache::getData($cache_file, false, true);
function clearCacheForThreadPost($tid) { $_cacheService = Perf::gatherCache('pw_posts'); $_cacheService->clearCacheForThreadPost($tid); }
function recountTopic($read, $ifdel, $recycle) { global $db_anonymousname, $timestamp; $ret = 0; $tid = $read['tid']; $pw_posts = GetPtable($read['ptable']); $replies = $this->db->get_value("SELECT COUNT(*) AS replies FROM {$pw_posts} WHERE tid='{$tid}' AND ifcheck='1'"); if (!$replies) { $read['anonymous'] && ($read['author'] = $db_anonymousname); if ($ifdel) { if ($recycle) { //$this->db->update("UPDATE pw_threads SET fid='0',ifshield='0' WHERE tid='$tid'"); pwQuery::update('pw_threads', 'tid = :tid', array($tid), array('fid' => 0, 'ifshield' => 0)); } else { //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByThreadId($read['fid'], $tid); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByThreadId($tid); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $read['fid'])); $pw_tmsgs = GetTtable($tid); //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid='$tid'"); pwQuery::delete($pw_tmsgs, 'tid=:tid', array($tid)); } $ret = 1; } else { $pwSQL = array('replies' => 0, 'lastposter' => $read['author']); !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $read['postdate']); //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid)); pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL); } } else { $pt = $this->db->get_one("SELECT postdate,author,anonymous FROM {$pw_posts} WHERE tid='{$tid}' ORDER BY postdate DESC LIMIT 1"); $pt['anonymous'] && ($pt['author'] = $db_anonymousname); $pwSQL = array('replies' => $replies, 'lastposter' => $pt['author']); !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $pt['postdate']); //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid)); pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL); } return $ret; }
function recycle($ids) { global $db, $fid; $delids = array(); foreach ($ids as $key => $value) { if (is_numeric($value)) { $delids[] = $value; } } if ($delids) { $delids = S::sqlImplode($delids); } else { Showmsg('forumcp_recycle_nodata'); } $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid WHERE r.tid IN ({$delids}) AND r.pid='0' AND r.fid=" . S::sqlEscape($fid)); $taid_a = $ttable_a = $ptable_a = array(); $delids = $pollids = $actids = $delaids = $rewids = $ids = array(); while (@extract($db->fetch_array($query))) { $ids[] = $tid; ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid); $special == 1 && ($pollids[] = $tid); $special == 2 && ($actids[] = $tid); $special == 3 && ($rewids[] = $tid); if ($ifshield != '2' || $replies == '0' || $ckfid == '0') { $ptable_a[$ptable] = 1; $ttable_a[GetTtable($tid)][] = $tid; } if ($ifupload) { $taid_a[GetTtable($tid)][] = $tid; if ($ifshield != '2' || $replies == '0' || $ckfid == '0') { $pw_posts = GetPtable($ptable); $query2 = $db->query("SELECT aid FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . " AND aid!=''"); while (@extract($db->fetch_array($query2))) { if (!$aid) { continue; } $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key => $value) { is_numeric($key) && ($delaids[] = $key); pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } } } } } foreach ($taid_a as $pw_tmsgs => $value) { $value = S::sqlImplode($value); $query = $db->query("SELECT aid FROM {$pw_tmsgs} WHERE tid IN({$value}) AND aid!=''"); while (@extract($db->fetch_array($query))) { if (!$aid) { continue; } $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key => $value) { is_numeric($key) && ($delaids[] = $key); pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']); $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']); } } } if ($pollids) { $pollids = S::sqlImplode($pollids); $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})"); } if ($actids) { $actids = S::sqlImplode($actids); $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})"); $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})"); } if ($rewids) { $rewids = S::sqlImplode($rewids); $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})"); } if ($delaids) { $pw_attachs = L::loadDB('attachs', 'forum'); $pw_attachs->delete($delaids); } //$delids = S::sqlImplode($delids); if ($delids) { # $db->update("DELETE FROM pw_threads WHERE tid IN($delids)"); # ThreadManager //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByThreadIds($fid,$delids); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByThreadIds($delids); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid)); } foreach ($ttable_a as $pw_tmsgs => $val) { //* $val = S::sqlImplode($val); //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)"); pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val)); } foreach ($ptable_a as $key => $val) { $pw_posts = GetPtable($key); //$db->update("DELETE FROM $pw_posts WHERE tid IN($delids)"); pwQuery::delete($pw_posts, 'tid IN(:tid)', array($delids)); } delete_tag(S::sqlImplode($delids)); if ($ids) { $ids = S::sqlImplode($ids); $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})"); } pwFtpClose($GLOBALS['ftp']); }
/** * 根据用户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; }
$_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; } setConfig('db_ifpwcache', $ifpwcache);
/** * 根据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); }
<?php !defined('P_W') && exit('Forbidden'); InitGP(array('id'), null, 2); InitGP(array('record')); $rt = $db->get_one("SELECT tid,fid FROM pw_pinglog WHERE ifhide=0 AND id=" . S::sqlEscape($id)); if (empty($rt) || !$rt['fid']) { Showmsg('data_error'); } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($rt['fid']); $isGM = CkInArray($windid, $manager); if (!$isGM && !pwRights($pwforum->isBM($windid), 'pingcp', $rt['fid'])) { Showmsg('mawhole_right'); } //$db->update("UPDATE pw_pinglog SET record=" . S::sqlEscape($record) . " WHERE id=" . S::sqlEscape($id)); pwQuery::update('pw_pinglog', 'id=:id', array($id), array('record' => $record)); echo "success"; # memcache reflesh if ($db_memcache) { //* $threads = L::loadClass('Threads', 'forum'); //* $threads->delThreads($rt['tid']); Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $rt['tid'])); } ajax_footer();
//info deploy if (isset($deployfids['info'])) { $cate_img = 'open'; $cate_info = 'none'; } else { $cate_img = 'fold'; $cate_info = ''; } // update birth day if ($db_indexshowbirth) { $brithcache = ''; require_once R_P . 'require/birth.php'; } // get bbsinfo if (Perf::checkMemcache()) { $_cacheService = Perf::getCacheService(); $_bbsInfoResult = $_cacheService->get('bbsinfo_id_1'); if (!$_bbsInfoResult) { $_bbsInfoService = L::loadClass('BbsInfoService', 'forum'); $_bbsInfoResult = $_bbsInfoService->getBbsInfoById(1); } extract($_bbsInfoResult); } else { extract($db->get_one("SELECT * FROM pw_bbsinfo WHERE id=1")); } $newmember = '<a href="u.php?username='******'" target="_blank" class=" _cardshow" data-card-url="pw_ajax.php?action=smallcard&type=showcard&username='******'" data-card-key=' . $newmember . '>' . $newmember . '</a>'; $article += $o_post; $topics += $o_post; $tposts += $o_tpost; // online users Update_ol();
$timelimit < 0 && ($timelimit = 24); $downtime = $timelimit * 3600; $msgdb = $logdb = array(); //* $threadList = L::loadClass("threadlist", 'forum'); $query = $db->query("SELECT tid,fid,postdate,author,authorid,subject,locked FROM pw_threads WHERE tid IN(" . S::sqlImplode($selids) . ")"); while ($rt = $db->fetch_array($query)) { $sql = "locked='" . ($ifpush ? $rt['locked'] % 3 + 3 : $rt['locked'] % 3) . "'"; $db->update("UPDATE pw_argument SET lastpost=lastpost-" . S::sqlEscape($downtime) . " WHERE tid=" . S::sqlEscape($rt['tid'])); //$db->update("UPDATE pw_threads SET $sql WHERE tid=".S::sqlEscape($rt['tid'])); $db->update(pwQuery::buildClause("UPDATE :pw_table SET {$sql} WHERE tid=:tid", array('pw_threads', $rt['tid']))); if ($ifmsg) { $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'down_title'), 'content' => getLangInfo('writemsg', 'down_content', array('manager' => $windid, 'timelimit' => $timelimit, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content)))); } $logdb[] = array('type' => 'down', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'down_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content)); //* $threadList->updateThreadIdsByForumId($fid,$rt['tid'],$downtime); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid)); } sendMawholeMessages($msgdb); foreach ($logdb as $key => $val) { writelog($val); } refreshto("apps.php?q=group&a=thread&cyid={$cyid}", 'downtopic_success'); } } elseif ($action == 'highlight') { if (empty($_POST['step'])) { if (is_numeric($seltid)) { $rt = $db->get_one("SELECT a.titlefont,t.author FROM pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.tid=" . S::sqlEscape($seltid)); $titledetail = explode("~", $rt['titlefont']); $titlecolor = $titledetail[0]; if ($titlecolor && !preg_match('/\\#[0-9A-F]{6}/is', $titlecolor)) { $titlecolor = '';
function _clearMembersCache($id) { global $db; $query = $db->query("SELECT uid FROM pw_userbinding WHERE id =" . S::sqlEscape($id)); $uid = array(); while ($rt = $db->fetch_array($query)) { $uid[] = $rt['uid']; } Perf::gatherInfo('changeMembersWithUserIds', array('uid' => $uid)); }
/** * 获取用户积分 * * @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; }
function deleteThreadsHander($tidarray) { global $windid, $manager, $groupid, $SYSTEM; PostCheck(); (!$SYSTEM['superright'] || !$SYSTEM['delatc']) && Showmsg('mawhole_right'); if ($tidarray == "") { Showmsg('data_error'); } $tidarray = explode("|", $tidarray); if (!is_array($tidarray)) { Showmsg('data_error'); } $forums = $threadIds = array(); foreach ($tidarray as $v) { if ($v == "") { continue; } if (intval($v) < 0) { continue; } $threadIds[] = $v; } /** $threadManager = L::loadclass('threadmanager', 'forum'); foreach($forums as $fid=>$threadIds){ $threadManager->deleteByThreadIds($fid,$threadIds); }**/ $threadService = L::loadclass('threads', 'forum'); foreach ($forums as $fid => $_threadIds) { $threadService->deleteByThreadIds($_threadIds); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid)); } $delarticle = L::loadClass('DelArticle', 'forum'); $delarticle->delTopicByTids($threadIds, true); echo getLangInfo('other', 'search_manager_success'); ajax_footer(); }
} 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; } //* $_cache = getDatastore(); $arrValues = $_cache->get(array_keys($skey)); $tmpUIDs = $tmpGROUPs = $tmpGROUPs = $tmpCacheData = $tmpColonydb = $tmpCustomdb = array(); foreach ($skey as $key=>$value) { $prefix = substr($key,0,strrpos($key,'_'));
/** * 取消评分 * @param $tid * @param $pids * @param $params */ function deletePing($params = array()) { global $groupid, $windid, $winduid, $credit, $onlineip, $timestamp, $gp_gptype; //* $threadService = L::loadClass("threads", 'forum'); require_once R_P . 'require/credit.php'; foreach ($this->postData as $pid => $atc) { $rpid = $pid == 'tpc' ? '0' : $pid; // delete pinglog $pingdata = $this->db->get_one('SELECT * FROM pw_pinglog WHERE tid=' . S::sqlEscape($this->tid) . ' AND pid=' . S::sqlEscape($rpid) . ' AND pinger=' . S::sqlEscape($windid) . ' ORDER BY pingdate DESC LIMIT 1'); //$this->db->update('DELETE FROM pw_pinglog WHERE id=' . S::sqlEscape($pingdata['id'])); pwQuery::delete('pw_pinglog', 'id=:id', array($pingdata['id'])); $this->update_markinfo($this->tid, $rpid); //* $threadService->clearTmsgsByThreadId($this->tid); Perf::gatherInfo('changeTmsgWithThreadIds', array('tid' => $this->tid)); $addpoint = $pingdata['point']; if (!($cid = $credit->getCreditTypeByName($pingdata['name']))) { continue; } $cName = $credit->cType[$cid]; $addpoint = $addpoint > 0 ? -$addpoint : abs($addpoint); !$atc['subject'] && ($atc['subject'] = substrs(strip_tags(convert($atc['content'])), 35)); $credit->addLog('credit_delping', array($cid => $addpoint), array('uid' => $atc['authorid'], 'username' => $atc['author'], 'ip' => $onlineip, 'operator' => $windid, 'tid' => $this->tid, 'subject' => $atc['subject'], 'reason' => $params['atc_content'])); $credit->set($atc['authorid'], $cid, $addpoint); if (!is_numeric($pid)) { //* $this->db->update('UPDATE pw_threads SET ifmark=ifmark+'.S::sqlEscape($addpoint).' WHERE tid='.S::sqlEscape($tid)); $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET ifmark=ifmark+:ifmark WHERE tid=:tid", array('pw_threads', $addpoint, $this->tid))); } if ($params['ifmsg'] && !$atc['anonymous'] && $atc['author'] != $windid) { //发消息 $title = getLangInfo('writemsg', 'delping_title', array('sender' => $windid, 'receiver' => $atc['author'])); $content = getLangInfo('writemsg', 'delping_content', array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $this->tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($this->forum->foruminfo['name']), 'affect' => "{$cName}:{$addpoint}", 'admindate' => get_date($timestamp), 'reason' => stripslashes($params['atc_content']), 'sender' => $windid, 'receiver' => $atc['author'])); $this->sendMessage($atc['author'], $title, $content); } if ($gp_gptype == 'system') { require_once R_P . 'require/writelog.php'; $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $atc['fid'], 'field2' => '', 'field3' => '', 'descrip' => 'creditdel_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $this->tid, 'forum' => strip_tags($this->forum->foruminfo['name']), 'subject' => $atc['subject'], 'affect' => "{$name}:{$addpoint}", 'reason' => $params['atc_content']); writelog($log); } $pingLog[$pid] = $pingdata['id']; } $credit->runsql(); defined('AJAX') && ($GLOBALS['pingLog'] = $pingLog); //GLOBAL if ($this->forum->foruminfo['allowhtm'] && $_REQUEST['page'] == 1) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } return true; }