Ejemplo n.º 1
0
 if (TIMESTAMP - $_G['cache']['collection_index']['dateline'] > 3600 * 4) {
     $collectiondata = $followdata = array();
     if ($_G['setting']['collectionrecommendnum']) {
         if ($collectionrecommend['ctids']) {
             $collectionrecommend['ctidsKey'] = array_keys($collectionrecommend['ctids']);
             $tmpcollection = C::t('forum_collection')->fetch_all($collectionrecommend['ctidsKey']);
             foreach ($collectionrecommend['ctids'] as $ctid => $setcollection) {
                 if ($tmpcollection[$ctid]) {
                     $collectiondata[$ctid] = $tmpcollection[$ctid];
                 }
             }
             unset($tmpcollection, $ctid, $setcollection);
         }
         if ($collectionrecommend['autorecommend']) {
             require_once libfile('function/collection');
             $autorecommenddata = getHotCollection(500);
         }
     }
     savecache('collection_index', array('dateline' => TIMESTAMP, 'data' => $collectiondata, 'auto' => $autorecommenddata));
     $collectiondata = array('data' => $collectiondata, 'auto' => $autorecommenddata);
 } else {
     $collectiondata =& $_G['cache']['collection_index'];
 }
 if ($_G['setting']['showfollowcollection']) {
     $followcollections = $_G['uid'] ? C::t('forum_collectionfollow')->fetch_all_by_uid($_G['uid']) : array();
     if ($followcollections) {
         $collectiondata['follows'] = C::t('forum_collection')->fetch_all(array_keys($followcollections), 'dateline', 'DESC', 0, $_G['setting']['showfollowcollection']);
     }
 }
 if ($collectionrecommend['autorecommend'] && $collectiondata['auto']) {
     $randrecommend = array_rand($collectiondata['auto'], min($collectionrecommend['autorecommend'], count($collectiondata['auto'])));
Ejemplo n.º 2
0
    if (!$followctid) {
        $followctid = array();
    }
    $ctidlist = array_merge($myctid, $twctid, $followctid);
    if (count($ctidlist) > 0) {
        $tfcollection = $mycollection + $teamworker + $follow;
        $collectiondata = C::t('forum_collection')->fetch_all($ctidlist, 'dateline', 'DESC');
        $collectiondata = processCollectionData($collectiondata, $tfcollection);
    }
    include template('forum/collection_mycollection');
} else {
    if (!$tid) {
        $collectiondata = array();
        loadcache('collection');
        if (TIMESTAMP - $_G['cache']['collection']['dateline'] > 300) {
            $collection = getHotCollection(500, false);
            $collectioncache = array('dateline' => TIMESTAMP, 'data' => $collection);
            savecache('collection', $collectioncache);
        } else {
            $collection =& $_G['cache']['collection']['data'];
        }
        $count = count($collection);
        for ($i = $start; $i < $start + $cpp; $i++) {
            if (!$collection[$i]) {
                continue;
            }
            $collectiondata[] = $collection[$i];
        }
        unset($collection);
        $collectiondata = processCollectionData($collectiondata);
    } else {