。 $table_map = array( 'thread'=>'tid', 'post'=>'pid', 'user'=>'uid', ); foreach ($table_map as $table=>$col) { $maxid = db_maxid($table, $col, array('create_date'=>array('<'=>$crontime))); $count = db_count($table, array('create_date'=>array('<'=>$crontime))); $arr = array( 'year'=>$y, 'month'=>$m, 'day'=>$d, 'create_date'=>$crontime, 'table'=>$table, 'maxid'=>$maxid, 'count'=>$count ); db_replace('table_day', $arr); } } // 重新生成数据 function table_day_rebuild() { global $time; $user = user__read(1); $crontime = $user['create_date']; while($crontime < $time) { table_day_cron($crontime); $crontime = $crontime + 86400; } } ?>'] < $tag_update_time) { $tagidarr = tag_thread_find_tagid_by_tid($thread['tid'], $forum['tagcatelist']); $thread['tagids'] = implode(',', $tagidarr); thread_update($thread['tid'], array('tagids'=>$thread['tagids'], 'tagids_time'=>$time)); } else { $tagidarr = explode(',', $thread['tagids']); } foreach($tagidarr as $tagid) { isset($forum['tagmap'][$tagid]) AND $thread['taglist'][] = $forum['tagmap'][$tagid]; } } } function thread_format_last_date(&$thread) { if($thread['last_date'] != $thread['create_date']) { $thread['last_date_fmt'] = humandate($thread['last_date']); } else { $thread['create_date_fmt'] = humandate($thread['create_date']); } } function thread_count($cond = array()) { $n = db_count('thread', $cond); return $n; } function thread_maxid() { $n = db_maxid('thread', 'tid'); return $n; } function thread_safe_info($thread) { unset($thread['userip']); if(!empty($thread['user'])) { $thread['user'] = user_safe_info($thread['user']); } return $thread; } function thread_get_level($n, $levelarr) { foreach($levelarr as $k=>$level) { if($n <= $level) return $k; } return $k; } // 对 $threadlist 权限过滤 function thread_list_access_filter(&$threadlist, $gid) { global $conf, $forumlist; if(empty($threadlist)) return; foreach($threadlist as $tid=>$thread) { if(empty($forumlist[$thread['fid']]['accesson'])) continue; if($thread['top'] > 0) continue; if(!forum_access_user($thread['fid'], $gid, 'allowread')) { unset($threadlist[$tid]); } } } function thread_find_by_tids($tids, $order = array()) { //$start = ($page - 1) * $pagesize; //$tids = array_slice($tids, $start, $pagesize); if(!$tids) return array(); $threadlist = db_find('thread', array('tid'=>$tids), $order, 1, 1000, 'tid'); if($threadlist) foreach($threadlist as &$thread) thread_format($thread); return $threadlist; } // 查找 lastpid function thread_find_lastpid($tid) { $arr = db_find_one("post", array('tid'=>$tid), array('pid'=>-1), array('pid')); $lastpid = empty($arr) ? 0 : $arr['pid']; return $lastpid; } // 更新最后的 uid pid function thread_update_last($tid) { $lastpid = thread_find_lastpid($tid); if(empty($lastpid)) return; $lastpost = post__read($lastpid); if(empty($lastpost)) return; $r = thread__update($tid, array('lastpid'=>$lastpid, 'lastuid'=>$lastpost['uid'], 'last_date'=>$lastpost['create_date'])); return $r; } ?>', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '9', '⑲', '⑳', '⑴', '⑵', '⑶', '⑷', '⑸', '⑹', '⑺', '⑻', '⑼', '⑽', '⑾', '⑿', '⒀', '⒁', '⒂', '⒃', '⒄', '⒅', '⒆', '⒇'), '', $str); } // 过滤英文 ABCD EFGH IJKL MNOP QRST UVWXYZ if (array_value($filter, 'numeric')) { $str = strtolower($str); $str = str_replace(array('`', "'", '@', ",", ".", '/', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '`', ''', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'), '', $str); }*/ // 返回入库字符 return $str; } function well_shield_replace($str) { // 过滤提示字符 return str_replace(array(' ', "\r", "\n", "\t", ' ', ' ', ' ', ' ', '\\', '/', '·', '`', '~', '!', '!', '@', '#', '¥', '%', '^', '……', '*', '(', '(', ')', ')', '+', '_', '-', '=', ':', ':', ';', ';', '’', '‘', '', '"', '“', '”', '、', ',', ',', '.', '。', '|', '【', '】', '[', ']', '『', '』', '「', '」', '《', '》', '<', '>', '{', '}', '?', '?', '★', '☆', '〖', '〗', '⊙', '●', '〇', '◎', '¤', '◆', '◇', '※', '卐', '√', '╳'), '', $str); } ?>