| 2 |
require_once "../lib/common.inc.php"; |
require_once "../lib/common.inc.php"; |
| 3 |
require_once "../lib/db_open.inc.php"; |
require_once "../lib/db_open.inc.php"; |
| 4 |
require_once "../bbs/session_init.inc.php"; |
require_once "../bbs/session_init.inc.php"; |
| 5 |
|
require_once "../bbs/section_list.inc.php"; |
| 6 |
|
require_once "../bbs/s_favor.inc.php"; |
| 7 |
require_once "./load_doc_list.inc.php"; |
require_once "./load_doc_list.inc.php"; |
| 8 |
|
|
| 9 |
|
$s_favor = new section_favorite($_SESSION["BBS_uid"], $db_conn); |
| 10 |
|
|
| 11 |
|
// Load section list |
| 12 |
|
$section_hierachy = array(); |
| 13 |
|
|
| 14 |
|
$ret = load_section_list($section_hierachy, |
| 15 |
|
function (array $section, array $filter_param) : bool |
| 16 |
|
{ |
| 17 |
|
if ($_SESSION["BBS_uid"] > 0) |
| 18 |
|
{ |
| 19 |
|
return ($section["recommend"] && |
| 20 |
|
$_SESSION["BBS_priv"]->checkpriv($section["SID"], S_LIST) && |
| 21 |
|
$filter_param["s_favor"]->is_in($section["SID"])); |
| 22 |
|
} |
| 23 |
|
|
| 24 |
|
return $section["recommend"]; |
| 25 |
|
}, |
| 26 |
|
function (array $section, array $filter_param) : mixed |
| 27 |
|
{ |
| 28 |
|
return null; |
| 29 |
|
}, |
| 30 |
|
$db_conn, |
| 31 |
|
array( |
| 32 |
|
"s_favor" => $s_favor, |
| 33 |
|
) |
| 34 |
|
); |
| 35 |
|
|
| 36 |
|
if ($ret == false) |
| 37 |
|
{ |
| 38 |
|
$result_set["return"]["code"] = -2; |
| 39 |
|
$result_set["return"]["message"] = "Query section error: " . mysqli_error($db_conn); |
| 40 |
|
|
| 41 |
|
mysqli_close($db_conn); |
| 42 |
|
exit(json_encode($result_set)); |
| 43 |
|
} |
| 44 |
?> |
?> |
| 45 |
<html> |
<html> |
| 46 |
<head> |
<head> |
| 66 |
<td> </td> |
<td> </td> |
| 67 |
</tr> |
</tr> |
| 68 |
</table> |
</table> |
| 69 |
|
<? |
| 70 |
|
$cache_path = "../bbs/cache/www_doc_list_" . $_SESSION["BBS_uid"]; |
| 71 |
|
$buffer = false; |
| 72 |
|
if (file_exists($cache_path)) |
| 73 |
|
{ |
| 74 |
|
if (filemtime($cache_path) >= time() - 3600) // refresh interval = 1 hour |
| 75 |
|
{ |
| 76 |
|
$buffer = file_get_contents($cache_path); |
| 77 |
|
} |
| 78 |
|
} |
| 79 |
|
if ($buffer == false) |
| 80 |
|
{ |
| 81 |
|
ob_start(); |
| 82 |
|
?> |
| 83 |
<table width="760" border="0" cellpadding="0" cellspacing="0"> |
<table width="760" border="0" cellpadding="0" cellspacing="0"> |
| 84 |
<tr> |
<tr> |
| 85 |
<td width="25%" align="left" valign="top"> |
<td width="25%" align="left" valign="top"> |
| 86 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
| 87 |
<tr> |
<tr> |
| 88 |
<td class="td3"> |
<td class="td3"> |
| 102 |
<td width="50%" align="center" valign="top"> |
<td width="50%" align="center" valign="top"> |
| 103 |
<table width="95%" border="0" cellspacing="0" cellpadding="0"> |
<table width="95%" border="0" cellspacing="0" cellpadding="0"> |
| 104 |
<tr> |
<tr> |
| 105 |
<td class="alpha"><font color=brown><b><font size=3>本周导读</font></b></font></td> |
<td class="alpha"><font color=brown><b><font size=3>本周导读</font></b></font></td> |
| 106 |
</tr> |
</tr> |
| 107 |
<tr><td bgcolor=gray height=1></td></tr> |
<tr><td bgcolor=gray height=1></td></tr> |
| 108 |
<? load_top(10, 58, $db_conn); ?> |
<? load_top(10, 58, $db_conn); ?> |
| 109 |
<tr><td></td></tr> |
<tr><td></td></tr> |
| 125 |
<td> </td> |
<td> </td> |
| 126 |
</tr> |
</tr> |
| 127 |
</table> |
</table> |
| 128 |
<table width="760" border="0" cellspacing="0" cellpadding="0"> |
<table width="760" border="0" cellspacing="0" cellpadding="5"> |
| 129 |
<tr> |
<tr> |
| 130 |
<td width="35%" align="left" valign="top"> |
<? |
| 131 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
$column = 0; |
| 132 |
<? load_doc_list('Focus', 8, 43, 1, false, $db_conn); ?> |
$column_limit = 3; |
| 133 |
</table> |
$style_count = 4; |
| 134 |
</td> |
|
| 135 |
<td width="35%" align="center" valign="top"> |
foreach ($section_hierachy as $c_index => $section_class) |
| 136 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
{ |
| 137 |
<? load_doc_list('Literature', 8, 43, 2, false, $db_conn); ?> |
foreach ($section_class["sections"] as $s_index => $section) |
| 138 |
</table> |
{ |
| 139 |
</td> |
if ($column % $column_limit == 0) |
| 140 |
<td width="30%" align="right" valign="top"> |
{ |
| 141 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
?> |
|
<? load_doc_list('Health', 8, 35, 3, false, $db_conn); ?> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
<tr height=5> |
|
|
<td> </td> |
|
|
</tr> |
|
|
</table> |
|
|
<table width="760" border="0" cellspacing="0" cellpadding="0"> |
|
|
<tr> |
|
|
<td width="35%" align="left" valign="top"> |
|
|
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
|
|
<? load_class_list('study', array('Science','Exam','English'), 6, 43, 1, $db_conn); ?> |
|
|
</table> |
|
|
</td> |
|
|
<td width="35%" align="center" valign="top"> |
|
|
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
|
|
<? load_class_list('entertain', array('Movie','Music','Cartoon'), 6, 43, 2, $db_conn); ?> |
|
|
</table> |
|
|
</td> |
|
|
<td width="30%" align="right" valign="top"> |
|
|
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
|
|
<? load_class_list('computer', array('Technology','Programming','Security'), 6, 35, 4, $db_conn); ?> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
<tr height=5> |
|
|
<td> </td> |
|
| 142 |
</tr> |
</tr> |
| 143 |
</table> |
</table> |
| 144 |
<table width="760" border="0" cellspacing="0" cellpadding="0"> |
<table width="760" border="0" cellspacing="0" cellpadding="5"> |
| 145 |
<tr> |
<tr> |
| 146 |
<td width="35%" align="left" valign="top"> |
<? |
| 147 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
} |
| 148 |
<? load_doc_list('Feeling', 8, 43, 1, false, $db_conn); ?> |
?> |
| 149 |
</table> |
<td width="33%" align="center" valign="top"> |
| 150 |
</td> |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
| 151 |
<td width="35%" align="center" valign="top"> |
<? load_doc_list($section["sid"], 8, 38, $column % $style_count + 1, false, $db_conn); ?> |
| 152 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
</table> |
| 153 |
<? load_doc_list('ID_Story', 8, 43, 2, false, $db_conn); ?> |
</td> |
| 154 |
</table> |
<? |
| 155 |
</td> |
$column++; |
| 156 |
<td width="30%" align="right" valign="top"> |
} |
| 157 |
<table width="98%" border="0" cellspacing="0" cellpadding="0"> |
} |
| 158 |
<? load_doc_list('Cate', 8, 35, 3, false, $db_conn); ?> |
|
| 159 |
</table> |
for (; $column % $column_limit != 0; $column++) |
| 160 |
</td> |
{ |
| 161 |
</tr> |
?> |
| 162 |
<tr height=5> |
<td width="33%" align="center" valign="top"> |
| 163 |
<td> </td> |
</td> |
| 164 |
|
<? |
| 165 |
|
} |
| 166 |
|
?> |
| 167 |
|
<td width="1%"> |
| 168 |
|
</td> |
| 169 |
</tr> |
</tr> |
| 170 |
</table> |
</table> |
| 171 |
<? |
<? |
| 172 |
|
$buffer = ob_get_clean(); |
| 173 |
|
|
| 174 |
|
file_put_contents($cache_path, $buffer); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
echo $buffer; |
| 178 |
|
|
| 179 |
|
// Cleanup |
| 180 |
|
unset($s_favor); |
| 181 |
|
unset($section_hierachy); |
| 182 |
|
|
| 183 |
|
mysqli_close($db_conn); |
| 184 |
|
|
| 185 |
include "./foot.inc.php"; |
include "./foot.inc.php"; |
| 186 |
?> |
?> |
|
<table width="760" border="0" cellspacing="0" cellpadding="1"> |
|
|
<tr> |
|
|
<td align="center" valign="top"> |
|
|
</td> |
|
|
</tr> |
|
|
</table> |
|
| 187 |
</center> |
</center> |
| 188 |
</body> |
</body> |
| 189 |
</html> |
</html> |
|
<? |
|
|
mysqli_close($db_conn); |
|
|
?> |
|