index.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/illusts/?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->illusts) == 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. $illusts = count((array)$res->illusts);
  23. $iurl = "user/".$id."/profile/illusts?";
  24. foreach ($res->illusts as $k => $v) {
  25. $index++;
  26. if ($index <= $offset) continue;
  27. if ($index >= ($pagemax+$offset)+1) break;
  28. $iurl .= "ids[]=".$k."&";
  29. }
  30. $iurl .= "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 = "illust";
  37. include("../../../include/usermenu.php");
  38. unset($res);
  39. ?>
  40. <hr />
  41. <?php
  42. if ($illusts > 0) {
  43. ?>
  44. <h2>イラスト</h2>
  45. <?php
  46. $i = get($iurl);
  47. foreach ($i->body->works as $k => $v) {
  48. ?>
  49. <div class="searchres">
  50. <a href="/artworks/?id=<?= $v->id ?>">
  51. <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
  52. <?= $v->title ?>
  53. </a>
  54. </div>
  55. <?php
  56. }
  57. }
  58. unset($top);
  59. $sum = ceil($illusts/$pagemax);
  60. include("../../../include/pagination.php");
  61. include("../../../include/footer.php");
  62. ?>