function categories_recache()
{
    global $DB, $db_prefix, $options;
    $metas = $DB->query("SELECT mid, name, slug, description, count FROM {$db_prefix}metas WHERE type='category' ORDER BY displayorder");
    $catedb = array();
    while ($cate = $DB->fetch_array($metas)) {
        $cate['url'] = getcatelink($cate['mid'], $cate['slug']);
        $cate['rss_url'] = getrsslink($cate['mid'], $cate['slug']);
        $catedb[$cate['mid']] = $cate;
    }
    $contents = "\$catecache = unserialize('" . addcslashes(serialize($catedb), '\\\'') . "');";
    writetocache('categories', $contents);
}
예제 #2
0
     }
     $articledb[$article['articleid']] = $article;
 }
 unset($article);
 $DB->free_result($query);
 //设置一个时间戳,一定时间内该时间戳有效.用于COOKIE防盗链
 scookie('viewarticle', $timestamp);
 $metadb = array();
 if ($aids) {
     $query = $DB->query("SELECT m.mid, m.name, m.slug, m.type, r.cid FROM {$db_prefix}metas m\r\n\t\t\tINNER JOIN {$db_prefix}relationships r ON r.mid = m.mid\r\n\t\t\tWHERE m.type IN ('category', 'tag') AND r.cid IN ({$aids})\r\n\t\t\tORDER BY m.displayorder ASC, m.mid DESC");
     while ($meta = $DB->fetch_array($query)) {
         if ($meta['type'] == 'tag') {
             $meta['url'] = gettaglink($meta['slug']);
             $articledb[$meta['cid']]['content'] = highlight_tag($articledb[$meta['cid']]['content'], $meta['name']);
         } else {
             $meta['url'] = getcatelink($meta['mid'], $meta['slug']);
         }
         $metadb[$meta['cid']][$meta['type']][] = $meta;
     }
     unset($meta);
     $DB->free_result($query);
     if ($haveattach) {
         require_once SABLOG_ROOT . 'include/func/attachment.func.php';
         $attachdb = array();
         $query = $DB->query("SELECT attachmentid, articleid, dateline, filename, filetype, filesize, downloads, filepath, thumb_filepath, thumb_width, thumb_height, isimage FROM {$db_prefix}attachments WHERE articleid IN ({$aids}) ORDER BY attachmentid");
         $size = explode('x', strtolower($options['attachments_thumbs_size']));
         while ($attach = $DB->fetch_array($query)) {
             $attach['filesize'] = sizecount($attach['filesize']);
             $attach['dateline'] = sadate('Y-m-d H:i', $attach['dateline']);
             $attach['filepath'] = $options['attachments_dir'] . $attach['filepath'];
             $attach['thumbs'] = 0;