forked from etng/youbbs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·61 lines (50 loc) · 2.2 KB
/
index.php
File metadata and controls
executable file
·61 lines (50 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
define('IN_SAESPOT', 1);
define('CURRENT_DIR', pathinfo(__FILE__, PATHINFO_DIRNAME));
include(CURRENT_DIR . '/config.php');
include(CURRENT_DIR . '/common.php');
// 获取最近文章列表 $articledb
$articledb = $cache->get('home_articledb');
if($articledb === FALSE){
$query_sql = "SELECT a.id,a.cid,a.uid,a.ruid,a.title,a.addtime,a.edittime,a.comments,a.isred,a.top,c.name as cname,u.avatar as uavatar,u.name as author,ru.name as rauthor
FROM yunbbs_articles a
LEFT JOIN yunbbs_categories c ON c.id=a.cid
LEFT JOIN yunbbs_users u ON a.uid=u.id
LEFT JOIN yunbbs_users ru ON a.ruid=ru.id
WHERE `cid` > '1'
ORDER BY `top` DESC ,`edittime` DESC LIMIT ".$options['home_shownum'];
$query = $DBS->query($query_sql);
$articledb = array();
while ($article = $DBS->fetch_array($query)) {
// 格式化内容
if($article['isred'] == '1' && $article['top'] == '1'){
$article['title'] = "<span class=\"label label-warning\">置顶</span><span class=\"label label-success\">推荐</span>".$article['title'];
}elseif($article['isred'] == '1'){
$article['title'] = "<span class=\"label label-success\">推荐</span>".$article['title'];
}elseif($article['top'] == '1'){
$article['title'] = "<span class=\"label label-warning\">置顶</span>".$article['title'];
}
//$article['addtime'] = showtime($article['addtime']);
//$article['edittime'] = showtime($article['edittime']);
$articledb[] = $article;
}
unset($article);
$DBS->free_result($query);
// set to cache
$cache->set('home_articledb', $articledb);
}
// 页面变量
$title = $options['name'];
$site_infos = get_site_infos($DBS);
$newest_nodes = get_newest_nodes();
if(count($newest_nodes)==$options['newest_node_num']){
$bot_nodes = get_bot_nodes();
}
$links = get_links();
$meta_kws = htmlspecialchars(mb_substr($options['name'], 0, 6, 'utf-8'));
if($options['site_des']){
$meta_des = htmlspecialchars(mb_substr($options['site_des'], 0, 150, 'utf-8'));
}
$pagefile = CURRENT_DIR . '/templates/default/'.$tpl.'home.php';
include(CURRENT_DIR . '/templates/default/'.$tpl.'layout.php');
?>