| 248 |
|
|
| 249 |
while ($row = mysqli_fetch_array($rs)) |
while ($row = mysqli_fetch_array($rs)) |
| 250 |
{ |
{ |
| 251 |
|
// Rewrite title with "Re: Re: " prefix into "Re: ... " |
| 252 |
|
$title = $row["title"]; |
| 253 |
|
if ($row["TID"] != 0) |
| 254 |
|
{ |
| 255 |
|
$j = 0; |
| 256 |
|
while (substr_compare($row["title"], "Re: ", $j, strlen("Re: ")) == 0) |
| 257 |
|
{ |
| 258 |
|
$j += strlen("Re: "); |
| 259 |
|
} |
| 260 |
|
if ($j >= strlen("Re: Re: ")) |
| 261 |
|
{ |
| 262 |
|
$title = "Re: ... " . substr($row["title"], $j); |
| 263 |
|
} |
| 264 |
|
} |
| 265 |
|
|
| 266 |
array_push($result_set["data"]["articles"], array( |
array_push($result_set["data"]["articles"], array( |
| 267 |
"aid" => $row["AID"], |
"aid" => $row["AID"], |
| 268 |
"tid" => $row["TID"], |
"tid" => $row["TID"], |
| 269 |
"title" => $row["title"], |
"title" => $title, |
| 270 |
"sub_dt" => (new DateTimeImmutable($row["sub_dt"]))->setTimezone($_SESSION["BBS_user_tz"]), |
"sub_dt" => (new DateTimeImmutable($row["sub_dt"]))->setTimezone($_SESSION["BBS_user_tz"]), |
| 271 |
"length" => $row["length"], |
"length" => $row["length"], |
| 272 |
"icon" => $row["icon"], |
"icon" => $row["icon"], |
| 284 |
"last_reply_uid" => $row["last_reply_UID"], |
"last_reply_uid" => $row["last_reply_UID"], |
| 285 |
"last_reply_username" => $row["last_reply_username"], |
"last_reply_username" => $row["last_reply_username"], |
| 286 |
"last_reply_nickname" => $row["last_reply_nickname"], |
"last_reply_nickname" => $row["last_reply_nickname"], |
| 287 |
"visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0), |
"visited" => (($_SESSION["BBS_uid"] > 0 && ($row["UID"] == $_SESSION["BBS_uid"] || in_array($row["AID"], $visited_aid_list))) ? 1 : 0), |
| 288 |
)); |
)); |
| 289 |
|
|
| 290 |
if (!isset($author_list[$row["UID"]])) |
if (!isset($author_list[$row["UID"]])) |
| 295 |
{ |
{ |
| 296 |
$author_list[$row["last_reply_UID"]] = true; |
$author_list[$row["last_reply_UID"]] = true; |
| 297 |
} |
} |
| 298 |
|
|
| 299 |
|
unset($title); |
| 300 |
} |
} |
| 301 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 302 |
|
|
| 360 |
exit(json_encode($result_set)); // Output data in Json |
exit(json_encode($result_set)); // Output data in Json |
| 361 |
} |
} |
| 362 |
include $theme_view_file; |
include $theme_view_file; |
|
?> |
|