'Nova Creator 激励计划上线', 'notice1_desc' => '发布优质原创内容可获得社区流量扶持与创作者奖励。', 'notice1_url' => '#', ); } $threadlist = G('threadlist'); $pagination = G('pagination'); $active = G('active'); $forum_list = forum_list_cache(); $page = param(1, 1); $uid = G('uid'); $gid = G('gid'); $conf = G('conf'); $runtime = G('runtime'); if(!function_exists('chuan_plugin_is_on')) { function chuan_plugin_is_on($dir) { if(function_exists('plugin_paths_enabled')) { $plugins = plugin_paths_enabled(); $path = APP_PATH.'plugin/'.$dir; return !empty($plugins[$path]) && !empty($plugins[$path]['enable']); } $plugins = G('plugins', array()); return !empty($plugins[$dir]) && !empty($plugins[$dir]['enable']); } } $chuan_ad_on = function_exists('chuan_plugin_is_on') ? chuan_plugin_is_on('Chuan_ad') : FALSE; $chuan_sponsor_on = function_exists('chuan_plugin_is_on') ? chuan_plugin_is_on('Chuan_sponsor') : FALSE; $chuan_can_mod = $gid > 0 && $gid < 5; $latest_users = user_find(array(), array('uid'=>-1), 1, 8); $theme_tab = param('chuan_tab', 'latest'); $valid_theme_tabs = array('latest', 'newreply'); // hook index_start_theme_tabs_init.php !in_array($theme_tab, $valid_theme_tabs) AND $theme_tab = 'latest'; $theme_fids = arrlist_values(G('forumlist_show'), 'fid'); $theme_threads = intval(array_value($runtime, 'threads')); if ($theme_tab == 'latest') { $threadlist = thread_find_by_fids($theme_fids, $page, $conf['pagesize'], 'tid', $theme_threads); $pagination = pagination(url("index-{page}", array('chuan_tab' => 'latest')), $theme_threads, $page, $conf['pagesize']); } elseif ($theme_tab == 'newreply') { $threadlist = thread_find_by_fids($theme_fids, $page, $conf['pagesize'], 'lastpid', $theme_threads); $pagination = pagination(url("index-{page}", array('chuan_tab' => 'newreply')), $theme_threads, $page, $conf['pagesize']); } else { // hook index_start_tab_query.php } // Prepend global stickied/top threads on page 1 if (($theme_tab == 'latest' || $theme_tab == 'newreply') && $page == 1) { $toplist3 = thread_top_find(0); if ($toplist3) { $threadlist = $toplist3 + $threadlist; } } thread_list_access_filter($threadlist, $gid); if($threadlist) { foreach ($threadlist as &$thread) { $user = user_read_cache($thread['uid']); $thread['user_avatar_url'] = !empty($user['avatar_url']) ? $user['avatar_url'] : 'view/img/avatar.png'; $thread['username'] = $user['username']; $thread['forumname'] = isset($forum_list[$thread['fid']]) ? $forum_list[$thread['fid']]['name'] : ''; $thread['create_date_fmt'] = humandate($thread['create_date']); } unset($thread); } // Batch load featured status for the current page threadlist $featured_tids = array(); if ($threadlist) { $tids = arrlist_values($threadlist, 'tid'); $keys = array(); foreach ($tids as $_tid) { $keys[] = 'chuan_thread_featured_' . $_tid; } $kv_list = db_find('kv', array('k' => $keys)); if ($kv_list) { foreach ($kv_list as $_kv) { if (xn_json_decode($_kv['v'])) { $tid_from_key = intval(substr($_kv['k'], 22)); $featured_tids[$tid_from_key] = true; } } } } // Batch load merchants, equipped user badges, and badges details for all users on the page $uids = array(); if ($threadlist) { foreach ($threadlist as $_thread) { $uids[] = $_thread['uid']; } } if (!empty($latest_users)) { foreach ($latest_users as $_u) { $uids[] = $_u['uid']; } } $uids = array_unique(array_filter($uids)); if ($uids) { global $chuan_theme_cache; if (!isset($chuan_theme_cache)) $chuan_theme_cache = array(); // Batch load merchants $merchant_on = function_exists('chuan_plugin_is_on') ? chuan_plugin_is_on('Chuan_merchant_stately') : false; if ($merchant_on) { $merchants = db_find('merchant', array('uid' => $uids, 'status' => 2)); if (!isset($chuan_theme_cache['merchants'])) $chuan_theme_cache['merchants'] = array(); foreach ($uids as $_uid) { $chuan_theme_cache['merchants'][$_uid] = null; } if ($merchants) { foreach ($merchants as $_m) { $chuan_theme_cache['merchants'][$_m['uid']] = $_m; } } } // Batch load equipped user badges $badge_on = function_exists('chuan_plugin_is_on') ? chuan_plugin_is_on('Chuan_badge') : false; if ($badge_on) { if (!isset($chuan_theme_cache['equipped_badges'])) $chuan_theme_cache['equipped_badges'] = array(); foreach ($uids as $_uid) { $chuan_theme_cache['equipped_badges'][$_uid] = ''; } $user_badges = db_find('chuan_user_badge', array('uid' => $uids, 'equipped' => 1)); if ($user_badges) { $badge_ids = array(); foreach ($user_badges as $_ub) { $badge_ids[] = $_ub['badgeid']; } $badge_ids = array_unique($badge_ids); // Batch load badge details $badges = db_find('chuan_badge', array('badgeid' => $badge_ids)); $badges_map = array(); if ($badges) { if (!isset($chuan_theme_cache['badges'])) $chuan_theme_cache['badges'] = array(); foreach ($badges as $_b) { $chuan_theme_cache['badges'][$_b['badgeid']] = $_b; $badges_map[$_b['badgeid']] = $_b; } } foreach ($user_badges as $_ub) { $_uid = $_ub['uid']; $_bid = $_ub['badgeid']; if (isset($badges_map[$_bid]) && !empty($badges_map[$_bid]['enabled'])) { $_b = $badges_map[$_bid]; $_icon = chuan_badge_icon_html($_b['icon'], $_b['color']); $chuan_theme_cache['equipped_badges'][$_uid] = ''.$_icon.''; } } } } } $theme_tabs = array( 'latest' => array('最新', url('index-1')), 'newreply' => array('新评', url('index-1', array('chuan_tab' => 'newreply'))), ); // hook index_start_theme_tabs_init_after.php $carousel_items = array(); if (!empty($chuan_theme['carousel_enabled']) && !empty($chuan_theme['carousel_items']) && is_array($chuan_theme['carousel_items'])) { foreach ($chuan_theme['carousel_items'] as $_slide) { if (empty($_slide['image'])) continue; $_slide['url'] = !empty($_slide['url']) ? $_slide['url'] : (!empty($_slide['tid']) ? url("thread-$_slide[tid]") : ''); $carousel_items[] = $_slide; } } ?> $_slide) { ?> '; for($s=0; $s<6; $s++) { $slices_html .= ''; } $slices_html .= ''; $slide_inner = $slices_html . ''.(!empty($_slide['title']) ? ''.xn_html_safe($_slide['title']).'' : ''); ?> 1) { ?> $_slide) { ?> $_tab) { ?> '" class="feed-item px-4 md:px-5 py-4 cursor-pointer"> · · 置顶 精选 评论 暂无帖子 ' . $chuan_link_html . ''; } } ?>