index.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. require_once("../../../api.php");
  3. require_once("../../../include/lib.php");
  4. if (!isset($_GET["id"])) header("Location: /404.php");
  5. $id = (int)$_GET["id"];
  6. $cur = "/users/bookmarks/?id=".$id;
  7. $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
  8. if ($page < 1) $page = 1;
  9. $pagemax = 40;
  10. $offset = $pagemax * ($page - 1);
  11. $res = get("user/".$id."/illusts/bookmarks?offset=".$offset."&limit=".$pagemax."&rest=show&tag=");
  12. if (!isset($res->body)) {
  13. header("Location: /404.php");
  14. die();
  15. }
  16. $top = get("user/".$id."/profile/top");
  17. $res = $res->body;
  18. $top = $top->body;
  19. if (count((array)$res->works) == 0) header("Location: /404.php");
  20. $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
  21. $bookmarks = count((array)$res->works);
  22. ?>
  23. <?php
  24. include("../../../include/header.php");
  25. $title = $top->extraData->meta->ogp->title;
  26. $now = "bookmark";
  27. $bmc = $bookmarks;
  28. $cunt = get("user/".$id."/profile/all");
  29. $ilc = count((array)$cunt->body->illusts);
  30. $mgc = count((array)$cunt->body->manga);
  31. unset($cunt);
  32. include("../../../include/usermenu.php");
  33. ?>
  34. <hr />
  35. <?php
  36. if ($bookmarks > 0) {
  37. ?>
  38. <h2>ブックマーク</h2>
  39. <?php
  40. foreach ($res->works as $k => $v) {
  41. ?>
  42. <div class="searchres">
  43. <a href="/artworks/?id=<?= $v->id ?>">
  44. <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
  45. <?= $v->title ?>
  46. </a>
  47. <br />
  48. <a href="/users/?id=<?= $v->userId ?>">
  49. <img src="<?= imgprx($v->profileImageUrl) ?>" alt="<?= $v->userName ?>" style="width: 24px; height: 24px;" />
  50. <?= $v->userName ?>
  51. </a>
  52. </div>
  53. <?php
  54. }
  55. }
  56. unset($res);
  57. unset($top);
  58. $sum = ceil($bookmarks/$pagemax);
  59. include("../../../include/pagination.php");
  60. include("../../../include/footer.php");
  61. ?>