| 1 |
<? |
<? |
| 2 |
require_once "../lib/db_open.inc.php"; |
require_once "../lib/db_open.inc.php"; |
|
require_once "../lib/lml.inc.php"; |
|
|
require_once "../lib/str_process.inc.php"; |
|
| 3 |
require_once "./session_init.inc.php"; |
require_once "./session_init.inc.php"; |
| 4 |
|
require_once "./section_list_gen.inc.php"; |
| 5 |
require_once "./message.inc.php"; |
require_once "./message.inc.php"; |
| 6 |
?> |
require_once "./theme.inc.php"; |
|
<? |
|
|
$redir = $_SERVER["SCRIPT_NAME"] . |
|
|
(isset($_SERVER["QUERY_STRING"]) ? "?" . urlencode($_SERVER["QUERY_STRING"]) : ""); |
|
| 7 |
|
|
| 8 |
$sid = (isset($_GET["sid"]) ? intval($_GET["sid"]) : $BBS_default_sid); |
$result_set = array( |
| 9 |
$ex = (isset($_GET["ex"]) && $_GET["ex"] == "1" ? 1 : 0); |
"return" => array( |
| 10 |
$reply = (isset($_GET["reply"]) && $_GET["reply"] == "1" ? 1 : 0); |
"code" => 0, |
| 11 |
$use_nick = (isset($_GET["use_nick"]) && $_GET["use_nick"] == "0" ? 0 : 1); |
"message" => "", |
| 12 |
$sort = (isset($_GET["sort"]) ? $_GET["sort"] : "topic"); |
"errorFields" => array(), |
| 13 |
$search_text = (isset($_GET["search_text"]) ? $_GET["search_text"] : ""); |
) |
| 14 |
$page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1); |
); |
| 15 |
$rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20); |
|
| 16 |
|
$redir = $_SERVER["SCRIPT_NAME"] . |
| 17 |
if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST)) |
(isset($_SERVER["QUERY_STRING"]) ? "?" . urlencode($_SERVER["QUERY_STRING"]) : ""); |
| 18 |
{ |
|
| 19 |
force_login(); |
$sid = (isset($_GET["sid"]) ? intval($_GET["sid"]) : $BBS_default_sid); |
| 20 |
|
$ex = (isset($_GET["ex"]) && $_GET["ex"] == "1" ? 1 : 0); |
| 21 |
echo ("您无权访问该版块!"); |
$reply = (isset($_GET["reply"]) && $_GET["reply"] == "1" ? 1 : 0); |
| 22 |
exit(); |
$use_nick = (isset($_GET["use_nick"]) && $_GET["use_nick"] == "0" ? 0 : 1); |
| 23 |
} |
$sort = (isset($_GET["sort"]) ? $_GET["sort"] : "topic"); |
| 24 |
|
$search_text = (isset($_GET["search_text"]) ? $_GET["search_text"] : ""); |
| 25 |
switch($sort) |
$page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1); |
| 26 |
{ |
$rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20); |
| 27 |
case "topic": |
|
| 28 |
$sort_sql = "sub_dt DESC"; //sub_dt |
if (!in_array($rpp, $BBS_list_rpp_options)) |
|
break; |
|
|
case "reply": |
|
|
$sort_sql = "last_reply_dt DESC"; |
|
|
break; |
|
|
case "hot": |
|
|
$sort_sql = "(view_count + reply_count) DESC"; |
|
|
break; |
|
|
default: |
|
|
echo ("不支持的排序方式!"); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
$sql = "SELECT section_config.sname, section_config.title AS s_title, |
|
|
section_config.announcement, section_class.title AS c_title, section_class.cname |
|
|
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
|
|
WHERE section_config.SID = $sid AND section_config.enable AND section_class.enable"; |
|
|
|
|
|
$rs = mysqli_query($db_conn, $sql); |
|
|
if ($rs == false) |
|
|
{ |
|
|
echo("数据查询错误:" . mysqli_error($db_conn)); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
if($row = mysqli_fetch_array($rs)) |
|
|
{ |
|
|
$class_title = $row["c_title"]; |
|
|
$class_name = $row["cname"]; |
|
|
$section_name = $row["sname"]; |
|
|
$section_title = $row["s_title"]; |
|
|
$announcement = $row["announcement"]; |
|
|
} |
|
|
else |
|
|
{ |
|
|
echo("版块不存在!"); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
mysqli_free_result($rs); |
|
|
|
|
|
$search_topic = mysqli_real_escape_string($db_conn, $search_text); |
|
|
|
|
|
$sql = "SELECT count(*) AS article_count FROM bbs WHERE SID = $sid AND visible AND " . |
|
|
($reply ? "" : " TID = 0 AND ") . |
|
|
($ex ? " excerption AND " : "") . |
|
|
" title LIKE '%" . $search_topic . "%'"; |
|
|
|
|
|
$rs = mysqli_query($db_conn, $sql); |
|
|
if ($rs == false) |
|
|
{ |
|
|
echo("数据查询错误:" . mysqli_error($db_conn)); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
$toa = 0; |
|
|
if ($row = mysqli_fetch_array($rs)) |
|
|
{ |
|
|
$toa = $row["article_count"]; |
|
|
} |
|
|
|
|
|
mysqli_free_result($rs); |
|
|
|
|
|
if (!in_array($rpp, $BBS_list_rpp_options)) |
|
|
{ |
|
|
$rpp = $BBS_list_rpp_options[0]; |
|
|
} |
|
|
|
|
|
$page_total = ceil($toa / $rpp); |
|
|
if ($page > $page_total) |
|
|
{ |
|
|
$page = $page_total; |
|
|
} |
|
|
|
|
|
if ($page <= 0) |
|
|
{ |
|
|
$page = 1; |
|
|
} |
|
|
|
|
|
if ($_SESSION["BBS_uid"] > 0 && time() - $_SESSION["BBS_last_msg_check"] >= $BBS_check_msg_interval) |
|
|
{ |
|
|
$_SESSION["BBS_new_msg"] = check_new_msg($_SESSION["BBS_uid"], $db_conn); |
|
|
$_SESSION["BBS_last_msg_check"] = time(); |
|
|
} |
|
|
?> |
|
|
<html> |
|
|
<head> |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|
|
<title><? echo $section_title . "——" . ($ex ? "文摘区" : "讨论区"); ?></title> |
|
|
<link rel="stylesheet" href="css/default.css" type="text/css"> |
|
|
<style type="text/css"> |
|
|
TD.head,TD.favor,TD.reply,TD.dark,TD.topic |
|
|
{ |
|
|
border-right: #d0d3F0 1px solid; |
|
|
border-left: #d0d3F0 1px solid; |
|
|
border-bottom: #d0d3F0 1px solid; |
|
|
} |
|
|
TD.head |
|
|
{ |
|
|
font-family: 楷体; |
|
|
color: blue; |
|
|
} |
|
|
TD.favor,TD.dark |
|
|
{ |
|
|
text-align: center; |
|
|
} |
|
|
TD.reply,TD.dark |
|
|
{ |
|
|
color: #909090; |
|
|
background-color: #eaf0Fa; |
|
|
} |
|
|
TD.head,TD.favor |
|
|
{ |
|
|
background-color: #fafbfc; |
|
|
} |
|
|
TD.favor |
|
|
{ |
|
|
color: #c0c3f0; |
|
|
font-weight: bold; |
|
|
} |
|
|
TD.topic |
|
|
{ |
|
|
background-color: #fafbfc; |
|
|
} |
|
|
TD.topic:hover |
|
|
{ |
|
|
background-color: #eaf0Fa; |
|
|
} |
|
|
</style> |
|
|
|
|
|
<script type="text/javascript" src="../js/nw_open.js"></script> |
|
|
<script type="text/javascript" src="../js/bbs_article.js"></script> |
|
|
<script type="text/javascript"> |
|
|
function ch_page(page) |
|
|
{ |
|
|
document.change_page.page.value = page; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function ch_rpp() |
|
|
{ |
|
|
document.change_page.page.value = Math.floor((document.change_page.page.value - 1) * <? echo $rpp; ?> / document.change_page.rpp.value) + 1; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function ch_sect(sid) |
|
|
{ |
|
|
if (sid > 0) |
|
|
{ |
|
|
document.change_page.sid.value = sid; |
|
|
document.change_page.page.value = 1; |
|
|
document.change_page.submit(); |
|
|
} |
|
|
return false; |
|
|
} |
|
|
|
|
|
function ch_ex(ex) |
|
|
{ |
|
|
document.change_page.ex.value = ex; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function ch_reply(reply) |
|
|
{ |
|
|
document.change_page.reply.value = reply; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function use_nick(use) |
|
|
{ |
|
|
document.change_page.use_nick.value = use; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function ch_sort(type) |
|
|
{ |
|
|
document.change_page.sort.value = type; |
|
|
document.change_page.submit(); |
|
|
return false; |
|
|
} |
|
|
|
|
|
window.addEventListener("load", () => { |
|
|
var s = document.change_section.sid; |
|
|
for (i = 0; i < s.options.length; i++) |
|
| 29 |
{ |
{ |
| 30 |
if (s.options[i].value == <? echo $sid; ?>) |
$rpp = $BBS_list_rpp_options[0]; |
| 31 |
{ |
} |
| 32 |
s.selectedIndex = i; |
|
| 33 |
|
if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST)) |
| 34 |
|
{ |
| 35 |
|
force_login(); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
switch($sort) |
| 39 |
|
{ |
| 40 |
|
case "topic": |
| 41 |
|
$sort_sql = "sub_dt DESC"; //sub_dt |
| 42 |
break; |
break; |
| 43 |
} |
case "reply": |
| 44 |
|
$sort_sql = "last_reply_dt DESC"; |
| 45 |
|
break; |
| 46 |
|
case "hot": |
| 47 |
|
$sort_sql = "(view_count + reply_count) DESC"; |
| 48 |
|
break; |
| 49 |
|
default: |
| 50 |
|
$result_set["return"]["code"] = -1; |
| 51 |
|
$result_set["return"]["message"] = "不支持的排序方式"; |
| 52 |
|
|
| 53 |
|
mysqli_close($db_conn); |
| 54 |
|
exit(json_encode($result_set)); |
| 55 |
} |
} |
|
}); |
|
| 56 |
|
|
| 57 |
</script> |
$sql = "SELECT section_config.sname, section_config.title AS s_title, |
| 58 |
</head> |
section_config.announcement, section_class.title AS c_title, section_class.cname |
| 59 |
<body> |
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
| 60 |
<center> |
WHERE section_config.SID = $sid AND section_config.enable AND section_class.enable"; |
| 61 |
<table cols="2" border="0" cellpadding="0" cellspacing="0" width="770"> |
|
| 62 |
<tr> |
$rs = mysqli_query($db_conn, $sql); |
| 63 |
<td width="60%" style="color: green;"> |
if ($rs == false) |
|
<a class="s2" href="main.php?sid=<? echo $sid; ?>"><? echo $BBS_name; ?></a>>><? echo ($class_title . "[" . $class_name . "]"); ?>>><? echo ($section_title."[".$section_name."]"); ?>>><? echo ($ex ? "文摘区" : "讨论区"); ?> |
|
|
</td> |
|
|
<td width="40%" align="right" style="color: gray;"> |
|
|
<? |
|
|
if ($_SESSION["BBS_uid"] == 0) |
|
| 64 |
{ |
{ |
| 65 |
?> |
$result_set["return"]["code"] = -2; |
| 66 |
[<a class="s2" href="index.php?redir=<? echo $redir; ?>">登录</a>] |
$result_set["return"]["message"] = "Query data error: " . mysqli_error($db_conn); |
| 67 |
<? |
|
| 68 |
|
mysqli_close($db_conn); |
| 69 |
|
exit(json_encode($result_set)); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
if($row = mysqli_fetch_array($rs)) |
| 73 |
|
{ |
| 74 |
|
$class_title = $row["c_title"]; |
| 75 |
|
$class_name = $row["cname"]; |
| 76 |
|
$section_name = $row["sname"]; |
| 77 |
|
$section_title = $row["s_title"]; |
| 78 |
|
$announcement = $row["announcement"]; |
| 79 |
} |
} |
| 80 |
else |
else |
| 81 |
{ |
{ |
| 82 |
if ($_SESSION["BBS_new_msg"] > 0) |
$result_set["return"]["code"] = -1; |
| 83 |
{ |
$result_set["return"]["message"] = "版块不存在"; |
| 84 |
?> |
|
| 85 |
[<a class="s6" href="read_msg.php" target=_blank><? echo $_SESSION["BBS_new_msg"]; ?>条新消息</a>] |
mysqli_close($db_conn); |
| 86 |
<? |
exit(json_encode($result_set)); |
|
} |
|
|
?> |
|
|
欢迎回来 <font color=blue><? echo ($_SESSION["BBS_username"]); ?></font> |
|
|
[<a class="s6" href="logout.php">退出</a>] |
|
|
<? |
|
| 87 |
} |
} |
|
?> |
|
|
</td> |
|
|
</tr> |
|
|
</table> |
|
|
<table cols="2" border="0" cellpadding="0" cellspacing="0" width="770"> |
|
|
<tr bgcolor="#d0d3F0" height="2"> |
|
|
<td colspan="2"></td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td class="dark" width="3%"><img src="images/master.gif" width="16" height="16" alt="本版版主"></td> |
|
|
<td class="head" width="97%"> |
|
|
<? |
|
|
$sql = "SELECT user_list.UID, user_list.username, section_master.major FROM section_master |
|
|
INNER JOIN user_list ON section_master.UID = user_list.UID |
|
|
WHERE SID = $sid AND section_master.enable AND (NOW() BETWEEN begin_dt AND end_dt) |
|
|
ORDER BY major DESC"; |
|
|
|
|
|
$rs = mysqli_query($db_conn, $sql); |
|
|
if ($rs == false) |
|
|
{ |
|
|
echo "版主数据查询错误:" . mysqli_error($db_conn); |
|
|
exit(); |
|
|
} |
|
| 88 |
|
|
| 89 |
while($row = mysqli_fetch_array($rs)) |
mysqli_free_result($rs); |
|
{ |
|
|
?> |
|
|
<img src="images/<? echo ($row["major"] ? "master_major.gif" : "master_minor.gif"); ?>" width="12" height="11" alt="<? echo ($row["major"] ? "正版主" : "副版主"); ?>"><a class="s3" href="show_profile.php?uid=<? echo $row['UID']; ?>" target=_blank title="查看版主资料"><? echo $row["username"]; ?></a> |
|
|
<? |
|
|
} |
|
| 90 |
|
|
| 91 |
mysqli_free_result($rs); |
$search_topic = mysqli_real_escape_string($db_conn, $search_text); |
| 92 |
?> |
|
| 93 |
</td> |
$sql = "SELECT count(*) AS article_count FROM bbs WHERE SID = $sid AND visible AND " . |
| 94 |
</tr> |
($reply ? "" : " TID = 0 AND ") . |
| 95 |
<? |
($ex ? " excerption AND " : "") . |
| 96 |
if ($announcement != "") |
" title LIKE '%" . $search_topic . "%'"; |
| 97 |
{ |
|
| 98 |
?> |
$rs = mysqli_query($db_conn, $sql); |
| 99 |
<tr> |
if ($rs == false) |
| 100 |
<td class="dark"><img src="images/announce.gif" width="18" height="18" alt="本版公告"></td> |
{ |
| 101 |
<td class="head"> |
$result_set["return"]["code"] = -2; |
| 102 |
<? |
$result_set["return"]["message"] = "Query data error: " . mysqli_error($db_conn); |
| 103 |
echo (LML(htmlspecialchars($announcement, ENT_HTML401, 'UTF-8'), true)); |
|
| 104 |
?> |
mysqli_close($db_conn); |
| 105 |
</td> |
exit(json_encode($result_set)); |
| 106 |
</tr> |
} |
| 107 |
<? |
|
| 108 |
} |
$toa = 0; |
| 109 |
?> |
if ($row = mysqli_fetch_array($rs)) |
| 110 |
<tr> |
{ |
| 111 |
<td class="dark"></td> |
$toa = $row["article_count"]; |
| 112 |
<td class="head" align="right"> |
} |
| 113 |
<? |
mysqli_free_result($rs); |
| 114 |
if ($_SESSION["BBS_priv"]->checkpriv($sid, S_POST)) |
|
| 115 |
{ |
$page_total = ceil($toa / $rpp); |
| 116 |
?> |
if ($page > $page_total) |
| 117 |
<a class="s4" href="post.php?sid=<? echo $sid; ?>" title="发表新文章">发帖</a> |
{ |
| 118 |
<? |
$page = $page_total; |
| 119 |
} |
} |
| 120 |
?> |
|
| 121 |
<a class="s4" href="" onclick="return ch_ex(<? echo ($ex ? 0 : 1); ?>);" title="切换"><? echo ($ex ? "讨论区" : "文摘区"); ?></a> |
if ($page <= 0) |
| 122 |
<a class="s4" href="/gen_ex/<? echo $sid; ?>/" title="浏览本版块精华区" target=_blank>精华区</a> |
{ |
| 123 |
<a class="s4" href="" onclick="return ch_reply(<? echo ($reply ? 0 : 1); ?>);" title="切换文章显示模式"><? echo ($reply ? "主题" : "普通"); ?></a> |
$page = 1; |
| 124 |
</td> |
} |
| 125 |
</tr> |
|
| 126 |
<tr height="10"> |
if ($_SESSION["BBS_uid"] > 0 && time() - $_SESSION["BBS_last_msg_check"] >= $BBS_check_msg_interval) |
| 127 |
<td colspan="2"></td> |
{ |
| 128 |
</tr> |
$_SESSION["BBS_new_msg"] = check_new_msg($_SESSION["BBS_uid"], $db_conn); |
| 129 |
</table> |
$_SESSION["BBS_last_msg_check"] = time(); |
| 130 |
<table cols="5" border="0" cellpadding="0" cellspacing="0" width="770"> |
} |
| 131 |
<tr bgcolor="#d0d3F0" height="20"> |
|
| 132 |
<td width="4%" class="title">状态</td> |
$section_select_options = section_list_gen($db_conn); |
| 133 |
<td width="39%" class="title"><a class="s10" href="" onclick="return ch_sort('topic');" title="按主题发表时间排序">标题</a></td> |
|
| 134 |
<td width="16%" class="title"><a class="s10" href="" onclick="return use_nick(<? echo ($use_nick ? 0 : 1); ?>);" title="切换用户显示模式">作者</a></td> |
// Fill up result data |
| 135 |
<td width="10%" class="title"><a class="s10" href="" onclick="return ch_sort('hot');" title="按人气回复排序">回复/人气</a></td> |
$result_set["data"] = array( |
| 136 |
<td width="31%" class="title"><a class="s10" href="" onclick="return ch_sort('reply');" title="按最后回复时间排序">最后更新 | 回复人</a></td> |
"redir" => $redir, |
| 137 |
</tr> |
"sid" => $sid, |
| 138 |
</table> |
"ex" => $ex, |
| 139 |
<div id="article_list"></div> |
"reply" => $reply, |
| 140 |
<? |
"use_nick" => $use_nick, |
| 141 |
$sql = "SELECT * FROM bbs WHERE SID = $sid AND visible AND ". |
"sort" => $sort, |
| 142 |
($reply ? "" : " TID = 0 AND ") . |
"search_text" => $search_text, |
| 143 |
($ex ? " excerption AND " : "") . |
"page" => $page, |
| 144 |
" title LIKE '%" . $search_topic . "%'". |
"rpp" => $rpp, |
| 145 |
" ORDER BY ontop DESC, ". |
"page_total" => $page_total, |
| 146 |
($reply ? "sub_dt DESC" : $sort_sql). |
|
| 147 |
" LIMIT " . (($page - 1) * $rpp) . ", $rpp"; |
"class_title" => $class_title, |
| 148 |
|
"class_name" => $class_name, |
| 149 |
$rs = mysqli_query($db_conn, $sql); |
"section_name" => $section_name, |
| 150 |
if ($rs == false) |
"section_title" => $section_title, |
| 151 |
{ |
"announcement" => $announcement, |
| 152 |
echo "文章列表查询错误:" . mysqli_error($db_conn); |
"section_masters" => array(), |
| 153 |
exit(); |
|
| 154 |
} |
"section_select_options" => $section_select_options, |
| 155 |
|
|
| 156 |
echo ("<script language=\"JavaScript\">\n"); |
"articles" => array(), |
| 157 |
|
); |
| 158 |
$visited_aid_list = array(); |
|
| 159 |
|
// Query section master |
| 160 |
if ($_SESSION["BBS_uid"] > 0) |
$sql = "SELECT user_list.UID, user_list.username, section_master.major FROM section_master |
| 161 |
{ |
INNER JOIN user_list ON section_master.UID = user_list.UID |
| 162 |
$aid_list = "-1"; |
WHERE SID = $sid AND section_master.enable AND (NOW() BETWEEN begin_dt AND end_dt) |
| 163 |
|
ORDER BY major DESC"; |
| 164 |
|
|
| 165 |
|
$rs = mysqli_query($db_conn, $sql); |
| 166 |
|
if ($rs == false) |
| 167 |
|
{ |
| 168 |
|
$result_set["return"]["code"] = -2; |
| 169 |
|
$result_set["return"]["message"] = "Query section master error: " . mysqli_error($db_conn); |
| 170 |
|
|
| 171 |
|
mysqli_close($db_conn); |
| 172 |
|
exit(json_encode($result_set)); |
| 173 |
|
} |
| 174 |
|
|
| 175 |
while ($row = mysqli_fetch_array($rs)) |
while ($row = mysqli_fetch_array($rs)) |
| 176 |
{ |
{ |
| 177 |
if ((new DateTimeImmutable("-" . $BBS_new_article_period . " day")) < (new DateTimeImmutable($row["sub_dt"]))) |
array_push($result_set["data"]["section_masters"], array( |
| 178 |
|
"uid" => $row["UID"], |
| 179 |
|
"username" => $row["username"], |
| 180 |
|
"major" => $row["major"], |
| 181 |
|
)); |
| 182 |
|
} |
| 183 |
|
mysqli_free_result($rs); |
| 184 |
|
|
| 185 |
|
// Query articles |
| 186 |
|
$sql = "SELECT * FROM bbs WHERE SID = $sid AND visible AND ". |
| 187 |
|
($reply ? "" : " TID = 0 AND ") . |
| 188 |
|
($ex ? " excerption AND " : "") . |
| 189 |
|
" title LIKE '%" . $search_topic . "%'". |
| 190 |
|
" ORDER BY ontop DESC, ". |
| 191 |
|
($reply ? "sub_dt DESC" : $sort_sql). |
| 192 |
|
" LIMIT " . (($page - 1) * $rpp) . ", $rpp"; |
| 193 |
|
|
| 194 |
|
$rs = mysqli_query($db_conn, $sql); |
| 195 |
|
if ($rs == false) |
| 196 |
|
{ |
| 197 |
|
$result_set["return"]["code"] = -2; |
| 198 |
|
$result_set["return"]["message"] = "Query article list error: " . mysqli_error($db_conn); |
| 199 |
|
|
| 200 |
|
mysqli_close($db_conn); |
| 201 |
|
exit(json_encode($result_set)); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
$visited_aid_list = array(); |
| 205 |
|
|
| 206 |
|
if ($_SESSION["BBS_uid"] > 0) |
| 207 |
|
{ |
| 208 |
|
$aid_list = "-1"; |
| 209 |
|
|
| 210 |
|
while ($row = mysqli_fetch_array($rs)) |
| 211 |
{ |
{ |
| 212 |
$aid_list .= (", " . $row["AID"]); |
if ((new DateTimeImmutable("-" . $BBS_new_article_period . " day")) < (new DateTimeImmutable($row["sub_dt"]))) |
| 213 |
|
{ |
| 214 |
|
$aid_list .= (", " . $row["AID"]); |
| 215 |
|
} |
| 216 |
|
else |
| 217 |
|
{ |
| 218 |
|
array_push($visited_aid_list, $row["AID"]); |
| 219 |
|
} |
| 220 |
} |
} |
| 221 |
else |
|
| 222 |
|
mysqli_data_seek($rs, 0); |
| 223 |
|
|
| 224 |
|
if ($aid_list != "-1") |
| 225 |
{ |
{ |
| 226 |
array_push($visited_aid_list, $row["AID"]); |
$sql = "SELECT AID FROM view_article_log WHERE AID IN ($aid_list) AND UID = " . $_SESSION["BBS_uid"]; |
| 227 |
|
|
| 228 |
|
$rs_view = mysqli_query($db_conn, $sql); |
| 229 |
|
if ($rs_view == false) |
| 230 |
|
{ |
| 231 |
|
$result_set["return"]["code"] = -2; |
| 232 |
|
$result_set["return"]["message"] = "Query view_article_log error: " . mysqli_error($db_conn); |
| 233 |
|
|
| 234 |
|
mysqli_close($db_conn); |
| 235 |
|
exit(json_encode($result_set)); |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
while ($row_view = mysqli_fetch_array($rs_view)) |
| 239 |
|
{ |
| 240 |
|
array_push($visited_aid_list, $row_view["AID"]); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
mysqli_free_result($rs_view); |
| 244 |
} |
} |
| 245 |
} |
} |
|
|
|
|
mysqli_data_seek($rs, 0); |
|
| 246 |
|
|
| 247 |
if ($aid_list != "-1") |
$author_list = array(); |
| 248 |
|
|
| 249 |
|
while ($row = mysqli_fetch_array($rs)) |
| 250 |
{ |
{ |
| 251 |
$sql = "SELECT AID FROM view_article_log WHERE AID IN ($aid_list) AND UID = " . $_SESSION["BBS_uid"]; |
array_push($result_set["data"]["articles"], array( |
| 252 |
|
"aid" => $row["AID"], |
| 253 |
|
"tid" => $row["TID"], |
| 254 |
|
"title" => $row["title"], |
| 255 |
|
"sub_dt" => (new DateTimeImmutable($row["sub_dt"]))->setTimezone($_SESSION["BBS_user_tz"]), |
| 256 |
|
"length" => $row["length"], |
| 257 |
|
"icon" => $row["icon"], |
| 258 |
|
"uid" => $row["UID"], |
| 259 |
|
"username" => $row["username"], |
| 260 |
|
"nickname" => $row["nickname"], |
| 261 |
|
"reply_count" => $row["reply_count"], |
| 262 |
|
"view_count" => $row["view_count"], |
| 263 |
|
"transship" => $row["transship"], |
| 264 |
|
"lock" => $row["lock"], |
| 265 |
|
"ontop" => $row["ontop"], |
| 266 |
|
"excerption" => $row["excerption"], |
| 267 |
|
"gen_ex" => $row["gen_ex"], |
| 268 |
|
"last_reply_dt" => (new DateTimeImmutable($row["last_reply_dt"]))->setTimezone($_SESSION["BBS_user_tz"]), |
| 269 |
|
"last_reply_uid" => $row["last_reply_UID"], |
| 270 |
|
"last_reply_username" => $row["last_reply_username"], |
| 271 |
|
"last_reply_nickname" => $row["last_reply_nickname"], |
| 272 |
|
"visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0), |
| 273 |
|
)); |
| 274 |
|
|
| 275 |
$rs_view = mysqli_query($db_conn, $sql); |
if (!isset($author_list[$row["UID"]])) |
|
if ($rs_view == false) |
|
| 276 |
{ |
{ |
| 277 |
echo "文章查看记录查询错误:" . mysqli_error($db_conn); |
$author_list[$row["UID"]] = true; |
|
exit(); |
|
| 278 |
} |
} |
| 279 |
|
if (!isset($author_list[$row["last_reply_UID"]])) |
|
while ($row_view = mysqli_fetch_array($rs_view)) |
|
| 280 |
{ |
{ |
| 281 |
array_push($visited_aid_list, $row_view["AID"]); |
$author_list[$row["last_reply_UID"]] = true; |
| 282 |
} |
} |
|
|
|
|
mysqli_free_result($rs_view); |
|
| 283 |
} |
} |
| 284 |
} |
mysqli_free_result($rs); |
| 285 |
|
|
| 286 |
while ($row = mysqli_fetch_array($rs)) |
$uid_list = "-1"; |
| 287 |
{ |
foreach ($author_list as $uid => $status) |
| 288 |
$length = $row["length"]; |
{ |
| 289 |
$sub_dt = (new DateTimeImmutable($row["sub_dt"]))->setTimezone($_SESSION["BBS_user_tz"])->format("Y-m-d H:i"); |
$uid_list .= (", " . $uid); |
| 290 |
$last_reply_dt = (new DateTimeImmutable($row["last_reply_dt"]))->setTimezone($_SESSION["BBS_user_tz"])->format("Y-m-d H:i"); |
} |
| 291 |
$visited = (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0); |
unset($author_list); |
|
$status = ($row["ontop"] ? "B" : ($row["gen_ex"] ? "G" : ($row["excerption"] ? "M" : ($row["reply_count"] < 10 ? "N" : "H")))); |
|
|
$status = ($visited ? strtolower($status) : strtoupper($status)); |
|
|
|
|
|
echo ("show_article(" . |
|
|
$row["TID"] . ", " . //tid |
|
|
$row["AID"] . ", " . //aid |
|
|
"'" . split_line(htmlspecialchars($row["title"], ENT_QUOTES | ENT_HTML401, 'UTF-8'), "", 42, 2, "<br />") . "', " . //title |
|
|
"$ex, " . //ex |
|
|
"'$status', " . //status |
|
|
"'" . $sub_dt . "', " . //sub_dt |
|
|
"'$length', " . //length |
|
|
$row["icon"] . ", " . //icon |
|
|
$row["UID"] . ", " . //uid |
|
|
"'" . htmlspecialchars($row["username"], ENT_QUOTES | ENT_HTML401, 'UTF-8') . "', " . //username |
|
|
"'" . htmlspecialchars($row["nickname"], ENT_QUOTES | ENT_HTML401, 'UTF-8') . "', " . //nickname |
|
|
$row["reply_count"] . ", " . //reply_count |
|
|
$row["view_count"] . ", " . //view_count |
|
|
$row["transship"] . ", " . //transship |
|
|
$row["lock"] . ", " . //lock |
|
|
"'" . $last_reply_dt . "', " . //last_reply_dt |
|
|
$row["last_reply_UID"] . ", " . //last_reply_uid |
|
|
"'" . htmlspecialchars($row["last_reply_username"], ENT_QUOTES | ENT_HTML401, 'UTF-8') . "', " . //last_reply_username |
|
|
"'" . htmlspecialchars($row["last_reply_nickname"], ENT_QUOTES | ENT_HTML401, 'UTF-8') . "', " . //last_reply_nickname |
|
|
"0, " . //visible_mode |
|
|
$use_nick . //use_nick |
|
|
");\n"); |
|
|
} |
|
| 292 |
|
|
| 293 |
mysqli_free_result($rs); |
$author_list = array(); |
| 294 |
|
|
| 295 |
echo ("</script>\n"); |
$sql = "SELECT UID FROM user_list WHERE UID IN ($uid_list) AND enable"; |
| 296 |
?> |
|
| 297 |
<table cols="3" border="0" cellpadding="0" cellspacing="0" width="770"> |
$rs = mysqli_query($db_conn, $sql); |
| 298 |
<tr bgcolor="#d0d3F0" height="5"> |
if ($rs == false) |
|
<td colspan="3"></td></tr> |
|
|
<tr height="10"> |
|
|
<td colspan="3"></td></tr> |
|
|
<tr valign="top"> |
|
|
<form action="list.php" method="get" id="change_page" name="change_page"> |
|
|
<td width="40%" style="color:#909090"> |
|
|
<input type="hidden" id="sid" name="sid" value="<? echo $sid; ?>"> |
|
|
<input type="hidden" id="reply" name="reply" value="<? echo $reply; ?>"> |
|
|
<input type="hidden" id="ex" name="ex" value="<? echo $ex; ?>"> |
|
|
<input type="hidden" id="use_nick" name="use_nick" value="<? echo $use_nick; ?>"> |
|
|
<input type="hidden" id="sort" name="sort" value="<? echo $sort; ?>"> |
|
|
每页<select size="1" id="rpp" name="rpp" onchange="ch_rpp();"> |
|
|
<? |
|
|
foreach ($BBS_list_rpp_options as $v) |
|
| 299 |
{ |
{ |
| 300 |
echo ("<option value=\"$v\"" . ($v == $rpp ? " selected" : "") . ">$v</option>"); |
$result_set["return"]["code"] = -2; |
| 301 |
|
$result_set["return"]["message"] = "Query user list error: " . mysqli_error($db_conn); |
| 302 |
|
|
| 303 |
|
mysqli_close($db_conn); |
| 304 |
|
exit(json_encode($result_set)); |
| 305 |
} |
} |
| 306 |
?> |
|
| 307 |
</select>篇 |
while ($row = mysqli_fetch_array($rs)) |
| 308 |
<? |
{ |
| 309 |
if ($page > 1) |
$author_list[$row["UID"]] = true; |
| 310 |
{ |
} |
| 311 |
?> |
mysqli_free_result($rs); |
| 312 |
<a class="s8" title="首页" href="" onclick="return ch_page(1);"><font face=webdings>9</font></a> |
|
| 313 |
<a class="s8" title="上一页" href="" onclick="return ch_page(<? echo ($page - 1); ?>);"><font face=webdings>7</font></a> |
$result_set["data"]["author_list"] = $author_list; |
| 314 |
<? |
unset($author_list); |
| 315 |
} |
|
|
else |
|
|
{ |
|
|
?> |
|
|
<font face=webdings>9 7</font> |
|
|
<? |
|
|
} |
|
|
?> |
|
|
第<input id="page" name="page" value="<? echo ($page) ; ?>" style="width: 30px;">/<? echo $page_total; ?>页 |
|
|
<? |
|
|
if ($page < $page_total) |
|
|
{ |
|
|
?> |
|
|
<a class="s8" title="下一页" href="" onclick="return ch_page(<? echo ($page + 1); ?>);"><font face=webdings>8</font></a> |
|
|
<a class="s8" title="尾页" href="" onclick="return ch_page(<? echo ($page_total); ?>);"><font face=webdings>:</font></a> |
|
|
<? |
|
|
} |
|
|
else |
|
|
{ |
|
|
?> |
|
|
<font face=webdings>8 :</font> |
|
|
<? |
|
|
} |
|
|
?> |
|
|
</td> |
|
|
<td width="35%"> |
|
|
<font color=#909090>查找文章</font> |
|
|
<input type="text" id="search_text" name="search_text" value="<? echo $search_text;?>" size="15"> <input type=image src="images/search.gif" alt="按主题内容查找文章" border="0"></a> |
|
|
<a class="s8" href="search_form.php?sid=<? echo $sid; ?>" target=_blank title="全功能检索">高级</a> |
|
|
</td> |
|
|
</form> |
|
|
<td width="25%" align="right"> |
|
|
<form action="" method="get" id="change_section" name="change_section"> |
|
|
<select size="1" id="sid" name="sid" onchange="ch_sect(this.value);"> |
|
|
<? |
|
|
include "section_list_gen.inc.php"; |
|
|
?> |
|
|
</select> |
|
|
</form> |
|
|
</td> |
|
|
</tr> |
|
|
</table> |
|
|
</center> |
|
|
<? |
|
| 316 |
mysqli_close($db_conn); |
mysqli_close($db_conn); |
| 317 |
|
|
| 318 |
|
// Cleanup |
| 319 |
|
unset($redir); |
| 320 |
|
unset($sid); |
| 321 |
|
unset($ex); |
| 322 |
|
unset($reply); |
| 323 |
|
unset($use_nick); |
| 324 |
|
unset($sort); |
| 325 |
|
unset($search_text); |
| 326 |
|
unset($search_topic); |
| 327 |
|
unset($page); |
| 328 |
|
unset($rpp); |
| 329 |
|
unset($page_total); |
| 330 |
|
|
| 331 |
|
unset($class_title); |
| 332 |
|
unset($class_name); |
| 333 |
|
unset($section_name); |
| 334 |
|
unset($section_title); |
| 335 |
|
unset($announcement); |
| 336 |
|
|
| 337 |
|
unset($section_select_options); |
| 338 |
|
|
| 339 |
|
// Output with theme view |
| 340 |
|
$theme_view_file = get_theme_file("view/list", $_SESSION["BBS_theme_name"]); |
| 341 |
|
if ($theme_view_file == null) |
| 342 |
|
{ |
| 343 |
|
exit(json_encode($result_set)); // Output data in Json |
| 344 |
|
} |
| 345 |
|
include $theme_view_file; |
| 346 |
?> |
?> |
|
<? |
|
|
include "./foot.inc.php"; |
|
|
?> |
|
|
</body> |
|
|
</html> |
|