index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/manga/?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."/profile/all");
  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->manga) == 0) header("Location: /404.php");
  20. $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
  21. $index = 0;
  22. $manga = count((array)$res->manga);
  23. $murl = "user/".$id."/profile/illusts?";
  24. foreach ($res->manga as $k => $v) {
  25. $index++;
  26. if ($index <= $offset) continue;
  27. if ($index >= ($pagemax+$offset)+1) break;
  28. $murl .= "ids[]=".$k."&";
  29. }
  30. $murl .= "work_category=illustManga&is_first_page=0";
  31. unset($index);
  32. ?>
  33. <?php
  34. include("../../../include/header.php");
  35. $title = $top->extraData->meta->ogp->title;
  36. $now = "manga";
  37. $bmc = $res->bookmarkCount->public->illust;
  38. $ilc = count((array)$res->illusts);
  39. $mgc = count((array)$res->manga);
  40. include("../../../include/usermenu.php");
  41. unset($res);
  42. ?>
  43. <hr />
  44. <?php
  45. if ($manga > 0) {
  46. ?>
  47. <h2>漫画</h2>
  48. <?php
  49. $m = get($murl);
  50. foreach ($m->body->works as $k => $v) {
  51. ?>
  52. <div class="searchres">
  53. <a href="/artworks/?id=<?= $v->id ?>">
  54. <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
  55. <?= $v->title ?>
  56. </a>
  57. </div>
  58. <?php
  59. }
  60. }
  61. unset($top);
  62. $sum = ceil($manga/$pagemax);
  63. include("../../../include/pagination.php");
  64. include("../../../include/footer.php");
  65. ?>