| 25 |
$page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1); |
$page = (isset($_GET["page"]) ? intval($_GET["page"]) : 1); |
| 26 |
$rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20); |
$rpp = (isset($_GET["rpp"]) ? intval($_GET["rpp"]) : 20); |
| 27 |
|
|
| 28 |
|
if (!in_array($rpp, $BBS_list_rpp_options)) |
| 29 |
|
{ |
| 30 |
|
$rpp = $BBS_list_rpp_options[0]; |
| 31 |
|
} |
| 32 |
|
|
| 33 |
if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST)) |
if (!$_SESSION["BBS_priv"]->checkpriv($sid, S_LIST)) |
| 34 |
{ |
{ |
| 35 |
force_login(); |
force_login(); |
| 112 |
} |
} |
| 113 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 114 |
|
|
|
if (!in_array($rpp, $BBS_list_rpp_options)) |
|
|
{ |
|
|
$rpp = $BBS_list_rpp_options[0]; |
|
|
} |
|
|
|
|
| 115 |
$page_total = ceil($toa / $rpp); |
$page_total = ceil($toa / $rpp); |
| 116 |
if ($page > $page_total) |
if ($page > $page_total) |
| 117 |
{ |
{ |
| 244 |
} |
} |
| 245 |
} |
} |
| 246 |
|
|
| 247 |
|
$author_list = array(); |
| 248 |
|
|
| 249 |
while ($row = mysqli_fetch_array($rs)) |
while ($row = mysqli_fetch_array($rs)) |
| 250 |
{ |
{ |
| 251 |
array_push($result_set["data"]["articles"], array( |
array_push($result_set["data"]["articles"], array( |
| 271 |
"last_reply_nickname" => $row["last_reply_nickname"], |
"last_reply_nickname" => $row["last_reply_nickname"], |
| 272 |
"visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0), |
"visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0), |
| 273 |
)); |
)); |
| 274 |
|
|
| 275 |
|
if (!isset($author_list[$row["UID"]])) |
| 276 |
|
{ |
| 277 |
|
$author_list[$row["UID"]] = true; |
| 278 |
|
} |
| 279 |
|
if (!isset($author_list[$row["last_reply_UID"]])) |
| 280 |
|
{ |
| 281 |
|
$author_list[$row["last_reply_UID"]] = true; |
| 282 |
|
} |
| 283 |
|
} |
| 284 |
|
mysqli_free_result($rs); |
| 285 |
|
|
| 286 |
|
$uid_list = "-1"; |
| 287 |
|
foreach ($author_list as $uid => $status) |
| 288 |
|
{ |
| 289 |
|
$uid_list .= (", " . $uid); |
| 290 |
|
} |
| 291 |
|
unset($author_list); |
| 292 |
|
|
| 293 |
|
$author_list = array(); |
| 294 |
|
|
| 295 |
|
$sql = "SELECT UID FROM user_list WHERE UID IN ($uid_list) AND enable"; |
| 296 |
|
|
| 297 |
|
$rs = mysqli_query($db_conn, $sql); |
| 298 |
|
if ($rs == false) |
| 299 |
|
{ |
| 300 |
|
$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 |
|
while ($row = mysqli_fetch_array($rs)) |
| 308 |
|
{ |
| 309 |
|
$author_list[$row["UID"]] = true; |
| 310 |
} |
} |
| 311 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 312 |
|
|
| 313 |
|
$result_set["data"]["author_list"] = $author_list; |
| 314 |
|
unset($author_list); |
| 315 |
|
|
| 316 |
mysqli_close($db_conn); |
mysqli_close($db_conn); |
| 317 |
|
|
| 318 |
// Cleanup |
// Cleanup |