function hottags_recache() { global $DB, $db_prefix, $options; $setting = $DB->fetch_one_array("SELECT value FROM {$db_prefix}settings WHERE title='hottags_shownum'"); $limit = $setting['value'] ? (int) $setting['value'] : 0; $tagdb = $counts = array(); if ($limit) { $smallest = 14; $largest = 28; $query = $DB->query("SELECT mid, name, slug, description, count FROM {$db_prefix}metas WHERE type='tag' ORDER BY count DESC LIMIT " . $limit); while ($tag = $DB->fetch_array($query)) { $tag['counts'] = tag_count_scale($tag['count'] ? $tag['count'] : 1); $counts[$tag['mid']] = $tag['counts']; $tag['url'] = gettaglink($tag['slug']); $tagdb[$tag['mid']] = $tag; } if ($counts) { //字体大小 $min_count = @min($counts); $spread = @max($counts) - $min_count; if ($spread <= 0) { $spread = 1; } $font_spread = $largest - $smallest; if ($font_spread < 0) { $font_spread = 1; } $font_step = $font_spread / $spread; foreach ($tagdb as $mid => $tag) { $tagdb[$mid]['fontsize'] = $smallest + ($tag['counts'] - $min_count) * $font_step; } } } $contents = "\$tagcache = unserialize('" . addcslashes(serialize($tagdb), '\\\'') . "');"; writetocache('hottags', $contents); }
} if ($stats['tag_count']) { $pagenum = 400; if ($page) { $start_limit = ($page - 1) * $pagenum; } else { $start_limit = 0; $page = 1; } $smallest = 14; $largest = 28; $multipage = multi($stats['tag_count'], $pagenum, $page, $tagslist_url, '', $maxpages); $query = $DB->query("SELECT mid, name, slug, type, count FROM {$db_prefix}metas WHERE type = 'tag' ORDER BY mid DESC LIMIT {$start_limit}, " . $pagenum); $tagdb = $counts = array(); while ($tag = $DB->fetch_array($query)) { $tag['counts'] = tag_count_scale($tag['count'] ? $tag['count'] : 1); $counts[$tag['mid']] = $tag['counts']; $tag['url'] = gettaglink($tag['slug']); $tagdb[$tag['mid']] = $tag; } unset($tag); $DB->free_result($query); //字体大小 if ($counts) { $min_count = @min($counts); $spread = @max($counts) - $min_count; if ($spread <= 0) { $spread = 1; } $font_spread = $largest - $smallest; if ($font_spread < 0) {