zhangjingyu
打开require/updateforum.php
“function updatetop() {
global $db,$timestamp;
if ($timestamp) {
$db->update("DELETE FROM pw_poststopped WHERE pid = '0' AND fid != '0' AND overtime != '0' AND overtime < $timestamp ");
}
$fids = array();
$query = $db->query("SELECT t.* FROM pw_poststopped t WHERE t.pid = '0' AND t.fid != '0' ");
$fids = array();
while ($rt = $db->fetch_array($query)) {
$fids[$rt['fid']]['topthreads'] .= $fids[$rt['fid']]['topthreads'] ? ','.$rt['tid'] : $rt['tid'];
if ($rt['uptime'] == $rt['fid']) {
$fids[$rt['fid']]['top1']++;
} else {
$fids[$rt['fid']]['top2']++;
}
}
//update kmd threads
$kmdService = L::loadClass('kmdservice', 'forum');
$kmdInfo = $kmdService->getKmdInfosByStatus(KMD_THREAD_STATUS_OK);
if (is_array($kmdInfo)){
$kmdTids = array();
foreach ($kmdInfo as $v){
if(!$v['tid'] || !$v['fid']) continue;
$kmdTids[$v['fid']][$v['tid']] = null;
}
foreach ($kmdTids as $fid=>$v){
$fids[$fid]['topthreads'] .= $fids[$fid] ? ','.implode(',', array_keys($v)) : implode(',', array_keys($v));
}
}
//* $db->update("UPDATE pw_forumdata SET top1 = '', top2 = '' , topthreads = '' ");
pwQuery::update('pw_forumdata', null, null, array('top1'=>'', 'top2'=>'', 'topthreads'=>''));
$_fids = array();
foreach ($fids as $key => $value) {
if (is_array($value)) {
$_fids[] = $key;
//* $db->update("UPDATE pw_forumdata SET " . S::sqlSingle($value) . " WHERE fid = ".S::sqlEscape($key));
pwQuery::update('pw_forumdata', 'fid=:fid', array($key), $value);
}
}
if (!empty($_fids)) {
require_once(R_P.'admin/cache.php');
$_fids = S::sqlEscape($_fids);
updatecache_forums($_fids);
}
}”(