function updateUserInfo($type, $add, $content = '') { global $db_creditset, $credit, $db_upgrade, $timestamp, $db_tcheck; if ($this->groupid != 'guest') { require_once R_P . 'require/credit.php'; $this->user['todaypost']++; $this->user['monthpost']++; $this->user['postnum']++; $this->user['lastpost'] = $timestamp; $credit->addLog('topic_' . $type, $add, array('uid' => $this->uid, 'username' => $this->username, 'ip' => $GLOBALS['onlineip'], 'fname' => $this->forum->name)); $credit->sets($this->uid, $add, false); $this->user['rvrc'] += $add['rvrc']; $this->user['money'] += $add['money']; $this->user['credit'] += $add['credit']; $this->user['currency'] += $add['currency']; $usercredit = array('postnum' => $this->user['postnum'], 'digests' => $this->user['digests'], 'rvrc' => $this->user['rvrc'], 'money' => $this->user['money'], 'credit' => $this->user['credit'], 'currency' => $this->user['currency'], 'onlinetime' => $this->user['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($this->user['uid'], 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } require_once R_P . 'require/functions.php'; $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ if ($this->user['memberid'] != $memberid) { $userService->update($this->user['uid'], array('memberid' => $memberid)); $membername = getMembername($memberid); $upmemberid = getNextMemberid($memberid); $upmembername = getMembername($upmemberid); $upneedcredit = getmemberNeed($upmemberid); $userneed = $upneedcredit - CalculateCredit($usercredit, $upgradeset); M::sendNotice(array($this->user['username']), array('title' => getLangInfo('writemsg', 'user_update_title', array('username' => $windid)), 'content' => getLangInfo('writemsg', 'user_update_content', array('membername' => $membername, 'upmembername' => $upmembername, 'username' => $this->user['username'], 'userneed' => $userneed)))); //$data=array('uid'=>$this->user['uid'],'behavior'=>5,'lastday'=>$GLOBALS['tdtime'],'num'=>$memberid); //$data=array('uid'=>1,'behavior'=>5,'lastday'=>123,'num'=>1); $this->elementUpdate($this->user['uid']); /*升级记录排行*/ } $pwSQL = array('postnum' => $this->user['postnum'], 'todaypost' => $this->user['todaypost'], 'monthpost' => $this->user['monthpost'], 'lastpost' => $this->user['lastpost'], 'uploadtime' => $this->user['uploadtime'], 'uploadnum' => $this->user['uploadnum']); if ($db_tcheck) { $postcheck = unserialize($this->user['postcheck']); $this->fromGroup ? $postcheck['group'] = PwPost::tcheck($content) : ($postcheck['post'] = PwPost::tcheck($content)); $pwSQL['postcheck'] = serialize($postcheck); } $userService->update($this->uid, array(), $pwSQL); $credit->runsql(); /** if (!array_sum($add)) { $_cache = getDatastore(); $_cache->delete('UID_'.$this->uid); } **/ } else { Cookie('userlastptime', $timestamp); } }
function updateMemberid($uid, $isown = true) { global $db, $winddb, $creditset, $db_upgrade, $credit, $lneed; $lneed || ($lneed = L::config('lneed', 'level')); if ($isown == true) { $userdb = $winddb; } else { $userdb = $db->get_one("SELECT m.memberid,md.rvrc,md.money,md.credit,md.currency,md.postnum,md.digests,md.onlinetime FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid=" . pwEscape($uid)); } $userdb['rvrc'] += $creditset['rvrc']; $userdb['money'] += $creditset['money']; $userdb['credit'] += $creditset['credit']; $userdb['currency'] += $creditset['currency']; $usercredit = array('postnum' => $userdb['postnum'], 'digests' => $userdb['digests'], 'rvrc' => $userdb['rvrc'], 'money' => $userdb['money'], 'credit' => $userdb['credit'], 'currency' => $userdb['currency'], 'onlinetime' => $userdb['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($uid, 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); if ($userdb['memberid'] != $memberid) { $db->update("UPDATE pw_members SET memberid=" . pwEscape($memberid) . " WHERE uid=" . pwEscape($uid)); $_cache = getDatastore(); $_cache->delete('UID_' . $uid); } }
$userdb['medals'] = explode(',', $userdb['medals']); $userdb['medals'] = array_diff($userdb['medals'], $medals); $userdb['medals'] = implode(',', $userdb['medals']); $db->update("UPDATE pw_members SET medals=" . pwEscape($userdb['medals'], false) . " WHERE uid=" . pwEscape($userdb['uid'], false)); $db->update('DELETE FROM pw_medaluser WHERE uid=' . pwEscape($userdb['uid'], false) . ' AND mid IN(' . pwImplode($medals) . ')'); updatemedal_list(); } } $userdb['medals'] = explode(',', $userdb['medals']); } $usercredit = array('postnum' => $userdb['postnum'], 'digests' => $userdb['digests'], 'rvrc' => $userdb['rvrc'], 'money' => $userdb['money'], 'credit' => $userdb['credit'], 'currency' => $userdb['currency'], 'onlinetime' => $userdb['onlinetime']); foreach ($credit->get($userdb['uid'], 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } $totalcredit = CalculateCredit($usercredit, unserialize($db_upgrade)); $newmemberid = getmemberid($totalcredit); if ($userdb['memberid'] != $newmemberid) { $userdb['memberid'] = $newmemberid; $db->update("UPDATE pw_members SET memberid=" . pwEscape($newmemberid, false) . "WHERE uid=" . pwEscape($userdb['uid'])); } if ($db_autoban) { require_once R_P . 'require/autoban.php'; autoban($userdb['uid']); } if ($userdb['groupid'] == '6' || getstatus($userdb['userstatus'], 1)) { $pwSQL = ''; $isBan = false; $bandb = $delban = array(); $query = $db->query("SELECT * FROM pw_banuser WHERE uid=" . pwEscape($userdb['uid'])); while ($rt = $db->fetch_array($query)) { if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) {
function _setMemberid() { /* $lneed = L::config('lneed', 'level'); @asort($lneed); $this->data['memberid'] = key($lneed); */ global $db_upgrade; is_array($upgradeset = unserialize($db_upgrade)) || ($upgradeset = array()); $usercredit = L::reg('rg_regcredit'); isset($usercredit['rvrc']) && ($usercredit['rvrc'] *= 10); require_once R_P . 'require/functions.php'; $this->data['memberid'] = getmemberid(CalculateCredit($usercredit, $upgradeset)); }
function updateMemberid($uid, $isown = true) { require_once R_P . 'require/functions.php'; global $db, $winddb, $creditset, $db_upgrade, $credit, $lneed; if (!is_object($credit)) { require_once R_P . 'require/credit.php'; } $lneed || ($lneed = L::config('lneed', 'level')); if ($isown == true) { $userdb = $winddb; } else { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userdb = $userService->get($uid, true, true); } $userdb['rvrc'] += $creditset['rvrc']; $userdb['money'] += $creditset['money']; $userdb['credit'] += $creditset['credit']; $userdb['currency'] += $creditset['currency']; $usercredit = array('postnum' => $userdb['postnum'], 'digests' => $userdb['digests'], 'rvrc' => $userdb['rvrc'], 'money' => $userdb['money'], 'credit' => $userdb['credit'], 'currency' => $userdb['currency'], 'onlinetime' => $userdb['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($uid, 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); if ($userdb['memberid'] != $memberid) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($uid, array('memberid' => $memberid)); //* $_cache = getDatastore(); //* $_cache->delete('UID_'.$uid); } }
$query = $db->query("SELECT uid,postnum,digests,rvrc,money,credit as credits,currency,onlinetime FROM pw_memberdata LIMIT {$start},{$percount}"); while (@extract($db->fetch_array($query))) { $goon = 1; $usercredit = array('postnum' => $postnum, 'digests' => $digests, 'rvrc' => $rvrc, 'money' => $money, 'credit' => $credits, 'currency' => $currency, 'onlinetime' => $onlinetime); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key)) { require_once R_P . 'require/credit.php'; foreach ($credit->get($uid, 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } require_once R_P . 'require/functions.php'; $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($uid, array('memberid' => $memberid)); //* $_cache->delete('UID_'.$uid); } if ($goon) { adminmsg('updatecache_step', EncodeUrl($j_url)); } else { adminmsg('operate_success'); } } elseif ($_POST['action'] == 'usergroup') { /* * 更新系统组成员头衔 */ //* $_cache = getDatastore();
function bbspostguide($type = 'Post') { global $db, $creditset, $db_creditset, $db_upgrade, $db_hour, $groupid, $windid, $winduid, $winddb, $timestamp, $fid, $tid, $tdtime, $db_autochange, $db_tcheck, $atc_content, $_G, $credit; if ($db_autochange) { if (file_exists(D_P . "data/bbscache/set_cache.php")) { list(, $set_control) = explode("|", readover(D_P . "data/bbscache/set_cache.php")); } else { $set_control = 0; } if ($timestamp - $set_control > $db_hour * 3600) { require_once R_P . 'require/postconcle.php'; } } if ($groupid != 'guest') { require_once R_P . 'require/credit.php'; $creditset = $credit->creditset($creditset, $db_creditset); $winddb['todaypost']++; $winddb['monthpost']++; $winddb['lastpost'] = $timestamp; $winddb['postnum']++; $winddb['rvrc'] += $creditset[$type]['rvrc']; $winddb['money'] += $creditset[$type]['money']; $winddb['credit'] += $creditset[$type]['credit']; $winddb['currency'] += $creditset[$type]['currency']; $usercredit = array('postnum' => $winddb['postnum'], 'digests' => $winddb['digests'], 'rvrc' => $winddb['rvrc'], 'money' => $winddb['money'], 'credit' => $winddb['credit'], 'currency' => $winddb['currency'], 'onlinetime' => $winddb['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($winduid, 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } require_once R_P . 'require/functions.php'; $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); if ($winddb['memberid'] != $memberid) { $userService->update($winduid, array('memberid' => $memberid)); } $credit->addLog('topic_' . $type, $creditset[$type], array('uid' => $winduid, 'username' => $windid, 'ip' => $GLOBALS['onlineip'], 'fname' => $GLOBALS['forum'][$fid]['name'])); $credit->sets($winduid, $creditset[$type], false); $credit->runsql(); $updateMemberData = array('postnum' => $winddb['postnum'], 'todaypost' => $winddb['todaypost'], 'monthpost' => $winddb['monthpost'], 'lastpost' => $winddb['lastpost'], 'uploadtime' => $winddb['uploadtime'], 'uploadnum' => $winddb['uploadnum']); if ($db_tcheck) { $updateMemberData['postcheck'] = tcheck($atc_content); } $userService->update($winduid, array(), $updateMemberData); } else { Cookie('userlastptime', $timestamp); } }
function bbspostguide($type = 'Post') { global $db, $creditset, $db_creditset, $db_upgrade, $db_hour, $groupid, $windid, $winduid, $winddb, $timestamp, $fid, $tid, $tdtime, $db_autochange, $db_tcheck, $atc_content, $_G, $credit; if ($db_autochange) { if (file_exists(D_P . "data/bbscache/set_cache.php")) { list(, $set_control) = explode("|", readover(D_P . "data/bbscache/set_cache.php")); } else { $set_control = 0; } if ($timestamp - $set_control > $db_hour * 3600) { require_once R_P . 'require/postconcle.php'; } } if ($groupid != 'guest') { require_once R_P . 'require/credit.php'; $creditset = $credit->creditset($creditset, $db_creditset); $winddb['todaypost']++; $winddb['monthpost']++; $winddb['lastpost'] = $timestamp; $winddb['postnum']++; $winddb['rvrc'] += $creditset[$type]['rvrc']; $winddb['money'] += $creditset[$type]['money']; $winddb['credit'] += $creditset[$type]['credit']; $winddb['currency'] += $creditset[$type]['currency']; $usercredit = array('postnum' => $winddb['postnum'], 'digests' => $winddb['digests'], 'rvrc' => $winddb['rvrc'], 'money' => $winddb['money'], 'credit' => $winddb['credit'], 'currency' => $winddb['currency'], 'onlinetime' => $winddb['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($winduid, 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); if ($winddb['memberid'] != $memberid) { $db->update("UPDATE pw_members SET memberid=" . pwEscape($memberid) . " WHERE uid=" . pwEscape($winduid)); } $credit->addLog('topic_' . $type, $creditset[$type], array('uid' => $winduid, 'username' => $windid, 'ip' => $GLOBALS['onlineip'], 'fname' => $GLOBALS['forum'][$fid]['name'])); $credit->sets($winduid, $creditset[$type], false); $credit->runsql(); $sqladd = ''; $db_tcheck && ($sqladd .= "postcheck='" . tcheck($atc_content) . "',"); $pwSQL = $sqladd . pwSqlSingle(array('postnum' => $winddb['postnum'], 'todaypost' => $winddb['todaypost'], 'monthpost' => $winddb['monthpost'], 'lastpost' => $winddb['lastpost'], 'uploadtime' => $winddb['uploadtime'], 'uploadnum' => $winddb['uploadnum'])); $db->update("UPDATE pw_memberdata SET {$pwSQL} WHERE uid=" . pwEscape($winduid)); } else { Cookie('userlastptime', $timestamp); } }
function updateUserInfo($type, $add, $content = '') { global $db_creditset, $credit, $db_upgrade, $timestamp, $db_tcheck; if ($this->groupid != 'guest') { require_once R_P . 'require/credit.php'; $this->user['todaypost']++; $this->user['monthpost']++; $this->user['postnum']++; $this->user['lastpost'] = $timestamp; $credit->addLog('topic_' . $type, $add, array('uid' => $this->uid, 'username' => $this->username, 'ip' => $GLOBALS['onlineip'], 'fname' => $this->forum->name)); $credit->sets($this->uid, $add, false); $this->user['rvrc'] += $add['rvrc']; $this->user['money'] += $add['money']; $this->user['credit'] += $add['credit']; $this->user['currency'] += $add['currency']; $usercredit = array('postnum' => $this->user['postnum'], 'digests' => $this->user['digests'], 'rvrc' => $this->user['rvrc'], 'money' => $this->user['money'], 'credit' => $this->user['credit'], 'currency' => $this->user['currency'], 'onlinetime' => $this->user['onlinetime']); $upgradeset = unserialize($db_upgrade); foreach ($upgradeset as $key => $val) { if (is_numeric($key) && $val) { foreach ($credit->get($this->user['uid'], 'CUSTOM') as $key => $value) { $usercredit[$key] = $value; } break; } } $memberid = getmemberid(CalculateCredit($usercredit, $upgradeset)); if ($this->user['memberid'] != $memberid) { $this->db->update("UPDATE pw_members SET memberid=" . pwEscape($memberid) . " WHERE uid=" . pwEscape($this->user['uid'])); } $credit->runsql(); $pwSQL = array('postnum' => $this->user['postnum'], 'todaypost' => $this->user['todaypost'], 'monthpost' => $this->user['monthpost'], 'lastpost' => $this->user['lastpost'], 'uploadtime' => $this->user['uploadtime'], 'uploadnum' => $this->user['uploadnum']); $db_tcheck && ($pwSQL['postcheck'] = PwPost::tcheck($content)); $this->db->update("UPDATE pw_memberdata SET " . pwSqlSingle($pwSQL) . " WHERE uid=" . pwEscape($this->uid)); } else { Cookie('userlastptime', $timestamp); } }