/** * @param $tag * @param $result * @return unknown_type */ function writeCache($result) { $cache = ''; $cache .= "<?php\r\n"; $cache .= "\$_result=" . var_export($result, TRUE) . ";\r\n"; $cache .= "?>\r\n"; pwCache::setData($this->filepath, $cache); }
function findByTypeId($typeId) { $data = array(); if (file_exists($this->_getCacheKey())) { include S::escapePath($this->_getCacheKey()); } else { $data = $this->findByTypeIdWithoutCache($typeId); pwCache::setData($this->_getCacheKey(), '<?php $data = ' . var_export($data, true) . ';'); } return $data; }
function updatecache_bg() { global $db; $query = $db->query("SELECT * FROM pw_hack WHERE hk_name LIKE 'bg_%'"); $blogdb = "<?php\r\n"; while (@extract($db->fetch_array($query))) { $hk_name = key_cv($hk_name); $blogdb .= "\${$hk_name}=" . pw_var_export($hk_value) . ";\r\n"; } $blogdb .= "\n?>"; pwCache::setData(D_P . 'data/bbscache/bg_config.php', $blogdb); }
/** * 打包该钩子内的所有扩展文件 * Enter description here ... */ function packHookFiles() { $hookPack = L::loadClass('hookpack', 'hook'); $temp = $hookPack->packHookFile($this->_hookName); if (!$temp) { return false; } $file = $hookPack->getPackedFile($this->_hookName); $classesBegin = get_declared_classes(); require_once S::escapePath($file); $classesEnd = get_declared_classes(); $difference = array_diff($classesEnd, $classesBegin); $temp = $this->_cookDifferenceClasses($difference); pwCache::setData($this->_getHookClassesCacheFile(), $temp, true); }
function generate($rss_path) { /*modded for YunLiao 1.2: start*/ /* original -- start*/ /* $all = $this->rssHeader; $all .= $this->rssChannel; $all .= $this->rssImage; $all .= $this->rssItem; $all .= "</channel></rss>"; */ /* original -- end*/ $all = $this->getRss(); /*modded for YunLiao 1.2: end*/ pwCache::setData($rss_path, $all); }
if ($pwSendmail['by'] == 3) { $query = $db->query("SELECT m.uid,m.username,m.email FROM pw_members m left join pw_memberdata d USING(uid) {$pwSQL} {$limit}"); } else { $query = $db->query("SELECT uid,username,email FROM pw_members " . $pwSQL . $limit); } while ($rt = $db->fetch_array($query)) { if (!$rt['email'] || !preg_match("/^[-a-zA-Z0-9_\\.]+@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$/", $rt['email'])) { continue; } $sendsubject = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['subject']); $sendcontent = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['content']); sendemail($rt['email'], $sendsubject, $sendcontent, 'email_additional'); } $pwSendmail['step']++; $havesend = $pwSendmail['sent'] = $pwSendmail['step'] * $pwSendmail['num']; $count = $pwSendmail['count']; if ($pwSendmail['count'] > $pwSendmail['sent']) { pwCache::setData($tmpCachefile, "<?php\r\ndie();\r\n?>\r\n" . serialize($pwSendmail)); touch($tmpCachefile); $j_url = "{$basename}&action={$action}"; adminmsg("sendmsg_step", EncodeUrl($j_url), 1); } else { pwCache::deleteData($tmpCachefile); $notExistUsers = $pwSendmail['notExistUsers']; !$pwSendmail['notExistUsers'] ? adminmsg('sendmsg_success') : adminmsg('sendmail_success_part'); } } elseif ($action == 'erase') { PostCheck($verify); pwCache::deleteData($tmpCachefile); adminmsg('operate_success'); }
/** * 设置文件缓存 */ function setFileCache() { if (!$this->_cache) { return; } $overPrintDao = $this->_getOverPrintDao(); $overPrints = $overPrintDao->getAll(); $tmp_overPrints = "\$overPrints=" . pw_var_export($overPrints) . ";"; pwCache::setData($this->getCacheFileName(), "<?php\r\n" . $tmp_overPrints . "\r\n?>"); return $overPrints; }
$mark = $sorttype[$step]; $db->update("DELETE FROM pw_elements WHERE type='usersort' AND mark=" . S::sqlEscape($mark)); $step++; $_usersort = $getinfo->userSort($mark, $db_sortnum, false); $_usersort = arr_unique($_usersort); if (is_array($_usersort) && count($_usersort) == $db_sortnum) { $tmpdate = end($_usersort); $usersort_judge[$mark] = $tmpdate['value']; } else { $usersort_judge[$mark] = 0; } if ($_usersort) { $sql = "REPLACE INTO pw_elements(id,value,addition,type,mark) VALUES" . S::sqlMulti($_usersort, false); $db->update($sql); } pwCache::setData(D_P . 'data/bbscache/usersort_judge.php', "<?php\r\n\$usersort_judge=" . pw_var_export($usersort_judge) . ";\r\n?>"); adminmsg('updatecache_total_step', "{$basename}&action=update&type=usersort&step={$step}"); } } elseif ($type == 'newsubject') { $step = intval(S::getGP('step')); //* require_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php'); pwCache::getData(D_P . 'data/bbscache/forum_cache.php'); $arr_forumkeys = array_keys($forum); if (!$step) { $step = 0; $db->query("DELETE FROM pw_elements WHERE type='newsubject'"); } $total = count($arr_forumkeys); for ($i = 0; $i < 5; $i++) { if ($step < $total) { $fourmid = $arr_forumkeys[$step];
list($tabledb) = N_getTabledb(); $sysinfo['pw_size'] = $sysinfo['o_size'] = 0; $query = $db->query('SHOW TABLE STATUS'); while ($rt = $db->fetch_array($query)) { if (in_array($rt['Name'], $tabledb)) { $sysinfo['pw_size'] += $rt['Data_length'] + $rt['Index_length'] + 0; } else { $sysinfo['o_size'] += $rt['Data_length'] + $rt['Index_length'] + 0; } } $sysinfo['o_size'] = number_format($sysinfo['o_size'] / (1024 * 1024), 2); $sysinfo['pw_size'] = number_format($sysinfo['pw_size'] / (1024 * 1024), 2); $cachetext[1] = serialize($sysinfo); $cachetime = $timestamp + 60 * 60; /** writeover(D_P.'data/bbscache/admin_cache.php',"<?php die;?>{$cachetext[0]}\r\n$cachetime|{$cachetext[1]}"); **/ pwCache::setData(D_P . 'data/bbscache/admin_cache.php', "<?php die;?>{$cachetext[0]}\r\n{$cachetime}|{$cachetext[1]}"); } else { $sysinfo = unserialize($sysinfo); } $fids = array(); foreach ($forum as $key => $value) { $fids[] = $key; } if ($fids) { $sql = "fid IN(" . S::sqlImplode($fids) . ")"; $sysinfo['tcheck'] = $db->get_value("SELECT COUNT(*) FROM pw_threads WHERE {$sql} AND ifcheck='0'"); } else { $sysinfo['tcheck'] = 0; } $sysinfo['pcheck'] = 0; if ($db_plist && count($db_plist) > 1) {
function threadscateGory($classdb) { //生成帖子交换分类 $classcache = "<?php\r\n\$info_class=array(\r\n"; foreach ($classdb as $key => $class) { !$class['ifshow'] && ($class['ifshow'] = '0'); $class['cid'] = (int) $class['cid']; $flag && $info_class[$class['cid']]['ifshow'] && ($class['ifshow'] = '1'); $class['name'] = str_replace(array('"', "'"), array(""", "'"), $class['name']); $classcache .= "'{$class['cid']}'=>" . pw_var_export($class) . ",\r\n\r\n"; } $classcache .= ");\r\n?>"; pwCache::setData(D_P . "data/bbscache/info_class.php", $classcache); }
function setFileCache() { $jobDao = $this->_getJobDao(); $jobs = $jobDao->getAll(); $jobLists = "\$jobLists=" . pw_var_export($jobs) . ";"; pwCache::setData($this->getCacheFileName(), "<?php\r\n" . $jobLists . "\r\n?>"); return $jobs; }
<?php !function_exists('readover') && exit('Forbidden'); global $db_picpath, $db_attachname; $imgdt = $timestamp + $db_hour; $attachdt = $imgdt + $db_hour * 100; if (@rename($db_picpath, $imgdt) && @rename($db_attachname, $attachdt)) { require_once R_P . 'admin/cache.php'; setConfig('db_picpath', $imgdt); setConfig('db_attachname', $attachdt); updatecache_c(); } pwCache::setData(D_P . "data/bbscache/set_cache.php", "<?php die;?>|{$timestamp}");
function _set_RateConfigCache() { $rateConfigDB = $this->_getRateConfigDB(); $configs = $rateConfigDB->gets(); if (!$configs) { return null; } $tmp = array(); foreach ($configs as $config) { $tmp[$config['typeid']][] = $config; } //写入缓存文件 $result = serialize($tmp); pwCache::setData($this->_getReteConfigFilePath(), $result, false, 'w'); return $result; }
/* @var $register PW_Register */ $userService->update($winduid, array('authmobile' => $authmobile)); $userService->setUserStatus($winduid, PW_USERSTATUS_AUTHMOBILE, true); //颁发勋章 if ($db_md_ifopen) { $medalService = L::loadClass('medalservice', 'medal'); $medalService->awardMedalByIdentify($winduid, 'shimingrenzheng'); } } //$iptime=$timestamp+86400; //Cookie("ifregip",$onlineip,$iptime); if ($rg_config['rg_allowsameip']) { if (file_exists(D_P . 'data/bbscache/ip_cache.php')) { pwCache::setData(D_P . 'data/bbscache/ip_cache.php', "<{$onlineip}>", false, "ab"); } else { pwCache::setData(D_P . 'data/bbscache/ip_cache.php', "<?php die;?><{$timestamp}>\n<{$onlineip}>"); } } //addonlinefile(); if (GetCookie('userads') && $inv_linkopen && $inv_linktype == '1') { require_once R_P . 'require/userads.php'; } if (GetCookie('o_invite') && $db_modes['o']['ifopen'] == 1) { list($o_u, $hash, $app) = explode("\t", GetCookie('o_invite')); if (is_numeric($o_u) && strlen($hash) == 18) { require_once R_P . 'require/o_invite.php'; } } if ($rgyz == 1) { Cookie("winduser", StrCode($winduid . "\t" . PwdCode($windpwd) . "\t" . $safecv)); Cookie("ck_info", $db_ckpath . "\t" . $db_ckdomain);
function _get_RateConfigResultCache($rateConfigs) { //每一个小时更新一次 $filePath = $this->_getReteConfigFilePath($this->_typeId); if (!file_exists($filePath) || time() - filemtime($filePath) > 3600) { $weekHTML = $this->_buildWeekResultHtml($rateConfigs); pwCache::setData(s::escapePath($filePath), $weekHTML); //write ignore null or not } else { //* $weekHTML = readover ( $filePath ); $weekHTML = pwCache::getData(S::escapePath($filePath), false, true); } return $weekHTML; }
/** * @desc 更新扫描进度 */ function updateProgress() { if ($this->progress > $this->count) { $this->progress = $this->count; } if ($this->objid) { foreach ($this->threaddb as $key => $forums) { foreach ($forums as $key2 => $value) { if ($this->fid == $key2) { $this->threaddb[$key][$key2]['progress'] = $this->progress; $this->threaddb[$key][$key2]['result'] = $this->result; $this->threaddb[$key][$key2]['table_progress'][$this->table] = $this->objid; } } } $threaddb = serialize($this->threaddb); $catedb = serialize($this->catedb); # 写入文件 $filecontent = "<?php\r\n"; $filecontent .= "\$catedb=" . pw_var_export($catedb) . ";\r\n"; $filecontent .= "\$threaddb=" . pw_var_export($threaddb) . ";\r\n"; $filecontent .= "?>"; $cahce_file = D_P . 'data/bbscache/wordsfb_progress.php'; pwCache::setData($cahce_file, $filecontent); } }
$gids[] = $rt['gid']; } $gids = S::sqlImplode($gids); $admindb = array(); $query = $db->query("SELECT uid,username,groupid,groups FROM pw_members WHERE groupid IN({$gids}) ORDER BY groupid"); while ($rt = $db->fetch_array($query)) { $admindb[$rt['username']] = array('uid' => $rt['uid'], 'gid' => $rt['groupid'], 'total' => 0); } $query = $db->query("SELECT COUNT(*) AS count,username2 AS manager,type FROM pw_adminlog WHERE timestamp>" . S::sqlEscape($montime) . " GROUP BY username2,type"); while ($rt = $db->fetch_array($query)) { if (isset($admindb[$rt['manager']])) { $admindb[$rt['manager']][$rt['type']] = $rt['count']; $admindb[$rt['manager']]['total'] += $rt['count']; } } pwCache::setData($monthFile, "<?php\n\$admindb=" . pw_var_export($admindb) . ";\n?>"); touch($monthFile); } $cachetime = get_date($cachetime + $per * 3600); $sort_a = $dateSelect = array(); $fg = opendir(D_P . 'data/bbscache/'); while ($othermonth = readdir($fg)) { if (eregi("^admin_sort_[0-9]+\\.php\$", $othermonth)) { $fileTime = pwFilemtime(D_P . 'data/bbscache/' . $othermonth); $outTime = get_date($fileTime, 'Y-m'); $keyTime = PwStrtoTime($outTime . '-1'); $dateSelect[$keyTime] = $outTime; $tmpDateTime[] = $keyTime; } } closedir($fg);
<?php !defined('P_W') && exit('Forbidden'); $cachetime = pwFilemtime(D_P . "data/bbscache/tagdb.php"); if (!file_exists(D_P . "data/bbscache/tagdb.php") || $timestamp - $cachetime > 3600) { $tagnum = max($db_tagindex, 200); $tagdb = array(); $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . S::sqlLimit($tagnum)); while ($rs = $db->fetch_array($query)) { $tagdb[$rs['tagname']] = $rs['num']; } /** writeover(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>"); **/ pwCache::setData(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>"); touch(D_P . "data/bbscache/tagdb.php"); } else { //* include_once (D_P . "data/bbscache/tagdb.php"); extract(pwCache::getData(D_P . "data/bbscache/tagdb.php", false)); } foreach ($tagdb as $key => $num) { echo $key . ',' . $num . "\t"; } ajax_footer();
} else { if ($token == -2) { adminmsg('域名长度有误(1~64)'); } elseif ($token == -3) { adminmsg('域名输入有误(比如输入汉字)'); } elseif ($token == -4) { adminmsg('域名插入数据库有误'); } elseif ($token == -5) { adminmsg('IP用户调用页面超过阀值,阀值暂定为10'); } } } elseif (is_array($token) && isset($token)) { $adm_user = $token['adm_user']; $adm_pwd = $token['adm_pwd']; $apikey = $token['adm_key']; pwCache::setData(D_P . 'data/bbscache/adm_config.php', "<?php\r\n\$adm_user="******";\r\n\$adm_pwd=" . $adm_pwd . "\r\n?>"); } } } include PrintEot('app'); exit; function generatestr($len) { mt_srand((double) microtime() * 1000000); $keychars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ"; $maxlen = strlen($keychars) - 1; $str = ''; for ($i = 0; $i < $len; $i++) { $str .= $keychars[mt_rand(0, $maxlen)]; } return substr(md5($str . microtime() . $GLOBALS['HTTP_HOST'] . $GLOBALS['pwServer']["HTTP_USER_AGENT"] . $GLOBALS['db_hash']), 0, $len);
/** * 根据KEY=>VALUE读写文件 * 读取原有的KEY的值并写入新的值 * @param string/array $key * @param string $value * @return string */ function _readFileByKey($key, $value = '') { $_filename = D_P . "data/bbscache/datanalyse.php"; //* if (file_exists($_filename)) include pwCache::getPath($_filename); if (file_exists($_filename)) { extract(pwCache::getData($_filename, false)); } $_data = "\$overtimes=array(\r\n"; $_result = ''; foreach ((array) $overtimes as $k => $var) { if ($key == $k) { $_result = $var; $_data .= $value ? "\t\t'" . $k . "'=>'" . $value . "',\r\n" : "\t\t'" . $k . "'=>'" . $var . "',\r\n"; } else { $_data .= "\t\t'" . $k . "'=>'" . $var . "',\r\n"; } } $_data .= "\t)"; pwCache::setData($_filename, "<?php\r\n" . $_data . "\r\n?>"); return $_result; }
if ($node != 'NULL') { fputin($fp, $node, $dbtdsize, $nowfp); } if ($node != $nowfp) { fputin($fp, $nowfp, $dbtdsize, 'node', $node, Y); } /*添加数据*/ } fclose($fp); } } } if ($yestime != $tdtime) { //* P_unlink($filename); pwCache::deleteData($filename); pwCache::setData($filename, str_pad("<?php die;?>\tNULL\t{$tdtime}\t", $dbtdsize) . "\n"); /*24小时初始化一次*/ } function fputin($fp, $offset, $dbtdsize, $prior = 'M', $next = 'M', $ifadd = 'N') { $offset = $offset * ($dbtdsize + 1); /*将行数转换成指针偏移量*/ fseek($fp, $offset, SEEK_SET); if ($ifadd == 'N') { $iddata = fread($fp, $dbtdsize); $idarray = explode("\t", $iddata); fseek($fp, $offset, SEEK_SET); } if ($next != 'M' && $prior != 'M') { /*说明这一数据是被更改的数据段.需要对其他辅助信息进行更改*/ global $windid, $timestamp, $onlineip, $winddb;
$name = array(); $id = array(); $T = ''; $maxnum = 8; $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $data, $arr_vals); xml_parser_free($xml_parser); foreach ($arr_vals as $v) { if ($v['tag'] == 'ITEM' && $v['attributes']) { $name[] = $v['attributes']['NAME']; } elseif ($v['tag'] == 'CODE') { $id[] = $v['value']; } } if ($db_charset != 'utf-8') { L::loadClass('Chinese', 'utility/lang', false); $chs = new Chinese('UTF-8', $db_charset); foreach ($name as $k => $v) { $name[$k] = $chs->Convert($v); } } foreach ($id as $k => $v) { $T .= $T ? ",{$v} : '{$name[$k]}'" : "{$v} : '{$name[$k]}'"; if (!$maxnum--) { break; } } pwCache::setData(D_P . "data/bbscache/myshow_default.php", "<?php\r\n\t\$mDef = \"{$T}\";\r\n?>"); } } exit;
function setScanCache() { global $db, $timestamp, $db_plist; # 获取回复表 if ($db_plist && is_array($db_plist)) { foreach ($db_plist as $key => $value) { if ($key > 0) { $postslist[] = 'pw_posts' . (int) $key; } else { $postslist[] = 'pw_posts'; } } } else { $postslist[] = 'pw_posts'; } if (file_exists(D_P . 'data/bbscache/wordsfb_progress.php')) { # 读取缓存 //* require_once pwCache::getPath(D_P.'data/bbscache/wordsfb_progress.php'); pwCache::getData(D_P . 'data/bbscache/wordsfb_progress.php'); $temp_threaddb = unserialize($threaddb); } else { $temp_threaddb = array(); } $forum = $catedb = $forumdb = $subdb1 = $subdb2 = $threaddb = array(); # 获取版块列表 $query = $db->query("SELECT fid,name,fup,type FROM pw_forums WHERE cms!='1' ORDER BY vieworder"); while ($forums = $db->fetch_array($query)) { $forums['name'] = Quot_cv(strip_tags($forums['name'])); if ($forums['type'] == 'category') { $catedb[] = $forums; } elseif ($forums['type'] == 'forum') { $forumdb[] = $forums; } elseif ($forums['type'] == 'sub') { $subdb1[] = $forums; } else { $subdb2[] = $forums; } } foreach ($catedb as $cate) { $threaddb[$cate['fid']] = array(); foreach ($forumdb as $key2 => $forumss) { if ($forumss['fup'] == $cate['fid']) { if (!array_key_exists($forumss['fid'], $temp_threaddb[$cate['fid']])) { # 读取版块帖子总数和表进度 $forumss['count'] = 0; $forumss['progress'] = 0; $forumss['result'] = 0; $forumss['table_progress']['pw_threads'] = 0; foreach ($postslist as $pw_posts) { $forumss['table_progress'][$pw_posts] = 0; } $threaddb[$cate['fid']][$forumss['fid']] = $forumss; } else { $threaddb[$cate['fid']][$forumss['fid']] = $temp_threaddb[$cate['fid']][$forumss['fid']]; unset($threaddb[$cate['fid']][$forumss['fid']]['table_progress']); $threaddb[$cate['fid']][$forumss['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$forumss['fid']]['table_progress']['pw_threads']; foreach ($postslist as $pw_posts) { $threaddb[$cate['fid']][$forumss['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$forumss['fid']]['table_progress'][$pw_posts]; } } unset($forumdb[$key2]); foreach ($subdb1 as $key3 => $sub1) { if ($sub1['fup'] == $forumss['fid']) { if (!array_key_exists($sub1['fid'], $temp_threaddb[$cate['fid']])) { # 读取版块帖子总数和表进度 $sub1['count'] = 0; $sub1['progress'] = 0; $sub1['result'] = 0; $sub1['table_progress']['pw_threads'] = 0; foreach ($postslist as $pw_posts) { $sub1['table_progress'][$pw_posts] = 0; } $threaddb[$cate['fid']][$sub1['fid']] = $sub1; } else { $threaddb[$cate['fid']][$sub1['fid']] = $temp_threaddb[$cate['fid']][$sub1['fid']]; unset($threaddb[$cate['fid']][$sub1['fid']]['table_progress']); $threaddb[$cate['fid']][$sub1['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$sub1['fid']]['table_progress']['pw_threads']; foreach ($postslist as $pw_posts) { $threaddb[$cate['fid']][$sub1['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$sub1['fid']]['table_progress'][$pw_posts]; } } unset($subdb1[$key3]); foreach ($subdb2 as $key4 => $sub2) { if ($sub2['fup'] == $sub1['fid']) { if (!array_key_exists($sub2['fid'], $temp_threaddb[$cate['fid']])) { # 读取版块帖子总数和表进度 $sub2['count'] = 0; $sub2['progress'] = 0; $sub2['result'] = 0; $sub2['table_progress']['pw_threads'] = 0; foreach ($postslist as $pw_posts) { $sub2['table_progress'][$pw_posts] = 0; } $threaddb[$cate['fid']][$sub2['fid']] = $sub2; } else { $threaddb[$cate['fid']][$sub2['fid']] = $temp_threaddb[$cate['fid']][$sub2['fid']]; unset($threaddb[$cate['fid']][$sub2['fid']]['table_progress']); $threaddb[$cate['fid']][$sub2['fid']]['table_progress']['pw_threads'] = $temp_threaddb[$cate['fid']][$sub2['fid']]['table_progress']['pw_threads']; foreach ($postslist as $pw_posts) { $threaddb[$cate['fid']][$sub2['fid']]['table_progress'][$pw_posts] = $temp_threaddb[$cate['fid']][$sub2['fid']]['table_progress'][$pw_posts]; } } unset($subdb2[$key4]); } } } } } } } $catedb = serialize($catedb); $threaddb = serialize($threaddb); # 写入文件 $filecontent = "<?php\r\n"; $filecontent .= "\$catedb=" . pw_var_export($catedb) . ";\r\n"; $filecontent .= "\$threaddb=" . pw_var_export($threaddb) . ";\r\n"; $filecontent .= "?>"; $cahce_file = D_P . 'data/bbscache/wordsfb_progress.php'; pwCache::setData($cahce_file, $filecontent); setConfig('db_wordsfb_cachetime', $timestamp); updatecache_c(); return array('catedb' => $catedb, 'threaddb' => $threaddb); }
function updatetags() { global $db, $db_tagindex; $tagnum = max($db_tagindex, 200); $tagdb = array(); $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . S::sqlLimit($tagnum)); while ($rs = $db->fetch_array($query)) { $tagdb[$rs['tagname']] = $rs['num']; } /** pwCache::writeover(D_P."data/bbscache/tagdb.php","<?php\r\n\$tagdb=".pw_var_export($tagdb).";\r\n?>"); **/ pwCache::setData(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>"); touch(D_P . "data/bbscache/tagdb.php"); }
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); } if (empty($subject) || empty($atc_content)) { adminmsg('sendmsg_empty'); } $subject = S::escapeChar($subject); $sendmessage = S::escapeChar($atc_content); $percount = 100; empty($step) && ($step = 1); // $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $db_onlinetime = $db_onlinetime > 0 ? $db_onlinetime : 1200;
function findNavConfigs() { static $navConfigData = array(); $_navCacheFilePath = $this->_getCacheFilePath(); if (!$navConfigData && file_exists($_navCacheFilePath)) { //* include_once pwCache::getPath($_navCacheFilePath,true); extract(pwCache::getData($_navCacheFilePath, false)); //* $navConfigData = ($navConfigData) ? $navConfigData : $GLOBALS['navConfigData']; } if (!$navConfigData) { $navConfigData = $this->findAllByTypeWithoutCache(); pwCache::setData($_navCacheFilePath, array('navConfigData' => $navConfigData), true); } return $navConfigData; }
/** * 更新缓存 */ function updatecache_search() { global $db; $query = $db->query("SELECT * FROM pw_searchadvert WHERE ifshow = 1 ORDER BY orderby ASC"); while ($rt = $db->fetch_array($query)) { $t = array(); $t['keyword'] = $rt['keyword']; $t['starttime'] = $rt['starttime']; $t['endtime'] = $rt['endtime']; $t['code'] = str_replace(array("\\\\", "\\'", '<', '>', '"'), array("\\", "'", '<', '>', '"'), $rt['code']); $rt['config'] = unserialize($rt['config']); $rt['config']['ddate'] && ($t['ddate'] = $rt['config']['ddate']); $rt['config']['dweek'] && ($t['dweek'] = $rt['config']['dweek']); $rt['config']['dtime'] && ($t['dtime'] = $rt['config']['dtime']); $_cachedb[] = $t; } $_cachedb = $_cachedb ? $_cachedb : array(); $query = $db->query("SELECT fid,vieworder FROM pw_searchforum ORDER BY vieworder,fid DESC"); while ($rt = $db->fetch_array($query)) { $fids[] = $rt['fid']; } $db->free_result($query); $forumsDB = $_cacheforumsdb = array(); if ($fids) { $query = $db->query("SELECT fid,name FROM pw_forums WHERE fid IN(" . pwImplode($fids) . ")"); while ($rt = $db->fetch_array($query)) { $forumsDB[$rt['fid']] = $rt; } $db->free_result($query); foreach ($fids as $fid) { if (!$forumsDB[$fid]['name']) { continue; } $_cacheforumsdb[$fid] = $forumsDB[$fid]['name']; } } pwCache::setData(D_P . 'data/bbscache/search_config.php', array('s_searchforumdb' => $_cacheforumsdb, 's_advertdb' => $_cachedb), true); }
$nf_newinfodb[$key][$k] = array('id' => $v['addition']['uid'], 'name' => $v['title'], 'value' => $v['value']); } } elseif (in_array($val['type'], array('todaypost', 'rvrc', 'postnum', 'onlinetime', 'monthpost', 'monoltime', 'money', 'digests', 'currency', 'credit')) || array_key_exists($val['type'], $_CREDITDB)) { $nf_newinfodb[$key] = $element->userSort($val['type']); foreach ($nf_newinfodb[$key] as $k => $v) { $nf_newinfodb[$key][$k] = array('id' => $v['addition']['uid'], 'name' => $v['title'], 'value' => $v['value']); } } elseif (in_array($val['type'], array('topic', 'article', 'tpost'))) { $nf_newinfodb[$key] = $element->forumSort($val['type']); foreach ($nf_newinfodb[$key] as $k => $v) { $nf_newinfodb[$key][$k] = array('id' => $v['addition']['fid'], 'name' => $v['title'], 'value' => $v['value']); } } $nf_order[$key]['cachetime'] = $timestamp; uasort($nf_order, 'cacheTimeCmp'); pwCache::setData(D_P . 'data/bbscache/newinfo_config.php', "<?php\r\n\$nf_config=" . pw_var_export($nf_config) . ";\r\n\$nf_newinfodb=" . pw_var_export($nf_newinfodb) . ";\r\n\$nf_order=" . pw_var_export($nf_order) . ";\r\n?>"); break; } } uasort($nf_order, 'orderCmp'); function cacheTimeCmp($row1, $row2) { $first = strcmp($row1['cachetime'], $row2['cachetime']); if ($first) { return $first; } elseif ($row2['order'] > $row1['order']) { return 1; } elseif ($row2['order'] < $row1['order']) { return -1; } else { return 0;
/** * 缓存100个热门标签 * * @param int $num * @param int $updatas 强制更新 */ function setTopCache($num = 100, $updates = null) { $tmpnum = intval($num); $num = min($tmpnum, 100); $cachetime = pwFilemtime($this->_memberTagDbFile); if (!file_exists($this->_memberTagDbFile) || $this->_timestamp - $cachetime > $this->_hour || $updates) { $memberTagsDb = $this->_getMemberTagsDB(); $memberTagsData = $memberTagsDb->getTagsByNum($num); pwCache::setData($this->_memberTagDbFile, array('memberTagsData' => $memberTagsData), true); touch($this->_memberTagDbFile); } }
function addguestfile($offset) { global $timestamp, $onlineip, $tid, $fid, $wind_in, $db_olsize; if (strlen($fid) > 4) { $fidwt = ''; } else { $fidwt = $fid; } if (strlen($tid) > 7) { $tidwt = ''; } else { $tidwt = $tid; } $wherebbsyou = getuseraction($fid, $wind_in); $acttime = get_date($timestamp, 'm-d H:i'); $newonline = "{$onlineip}\t{$timestamp}\t<FiD>{$fidwt}\t{$tidwt}\t{$wherebbsyou}\t{$acttime}\t"; //<FiD>主要用于thread.php里快速找到指定的版块游客 $newonline = str_pad($newonline, $db_olsize) . "\n"; $D_name = "data/bbscache/guest.php"; if (!file_exists(D_P . $D_name)) { pwCache::setData(D_P . $D_name, str_pad("<?php die;?>", 96) . "\n"); } if (checkinline(D_P . $D_name, $offset, $onlineip)) { $isModify = 0; writeinline(D_P . $D_name, $newonline, $offset); } else { list($offset, $isModify) = GetInsertOffset(D_P . $D_name); writeinline(D_P . $D_name, $newonline, $offset); } if ($isModify === 1) { //频度可控制性 ModifySelectFile(D_P . "data/bbscache/online.php"); if ($GLOBALS['userinbbs'] === 0) { $GLOBALS['userinbbs']--; ModifySelectFile(D_P . $D_name, 1); } } return array($offset, $isModify); }