index.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 = "/artworks/?id=".$id;
  7. $res = get("illust/".$id);
  8. if (!isset($res->body)) {
  9. header("Location: /404.php");
  10. die();
  11. }
  12. $res = $res->body;
  13. if ($res->commentCount > 0) {
  14. $com = get("illusts/comments/roots?illust_id=".$id);
  15. }
  16. $rec = get("illust/".$id."/recommend/init?limit=".$rpsize);
  17. $out = ["title" => $res->alt, "desc" => $res->description, "img_sec" => "artwork", "img_id" => $id];
  18. $icon = "";
  19. foreach ($res->userIllusts as $k => $v) {
  20. if (is_null($v)) continue;
  21. if (isset($v->profileImageUrl)) $icon = imgprx($v->profileImageUrl);
  22. }
  23. ?>
  24. <?php include("../../include/header.php"); ?>
  25. <div style="text-align: center;">
  26. <?php for ($i = 0; $i < $res->pageCount; $i++) { ?>
  27. <p>
  28. <a href="<?= imgprx(str_replace("_p0", "_p".$i, $res->urls->original)) ?>">
  29. <img src="<?= imgprx(str_replace("_p0_", "_p".$i."_", $res->urls->regular)) ?>" alt="<?= $res->illustTitle ?>" />
  30. </a>
  31. </p>
  32. <?php } ?>
  33. </div>
  34. <h1><?= $res->illustTitle ?></h1>
  35. <p>
  36. 好:<?= $res->likeCount ?> 保:<?= $res->bookmarkCount ?> 視:<?= $res->viewCount ?><br />
  37. <img src="<?= $icon ?>" alt="<?= $res->userName ?>" /> <a href="/users?id=<?= $res->userId ?>"><?= $res->userName ?></a>
  38. </p>
  39. <h2>コメント (<?= $res->commentCount ?>)</h2>
  40. <table>
  41. <?php
  42. if (!$com->error) {
  43. foreach ($com->body->comments as $c) {
  44. ?>
  45. <tr>
  46. <td rowspan="2" style="vertical-align: top;"><img src="<?= imgprx($c->img) ?>" alt="<?= $c->userName ?>" style="width: 40px; height: 40px;" /></td>
  47. <td style="padding-left: 12px;"><a href="/users/?id=<?= $c->userId ?>"><?= $c->userName ?></a> <?= $c->commentDate ?></td>
  48. </tr>
  49. <tr>
  50. <td style="padding-left: 12px;">
  51. <?php
  52. if (is_null($c->stampId)) {
  53. echo $c->comment;
  54. }
  55. else {
  56. ?>
  57. <img src="/proxy.php?url=s.pximg.net/common/images/stamp/generated-stamps/<?= $c->stampId ?>_s.jpg" alt="<?= $c->stampId ?>" />
  58. <?php
  59. }
  60. ?>
  61. </td>
  62. </tr>
  63. <?php
  64. }
  65. }
  66. else {
  67. echo $com->message;
  68. }
  69. ?>
  70. </table>
  71. <h2>関連作品</h2>
  72. <?php
  73. if (!$rec->error) {
  74. foreach ($rec->body->illusts as $r) {
  75. if (is_null($r->id)) continue;
  76. ?>
  77. <div class="searchres">
  78. <a href="/artworks/?id=<?= $r->id ?>">
  79. <img src="<?= imgprx($r->url) ?>" alt="<?= $r->alt ?>" style="width: 260px; height: 260px;" />
  80. <?= $r->title ?>
  81. </a>
  82. <br />
  83. <a href="/users/?id=<?= $r->userId ?>">
  84. <img src="<?= imgprx($r->profileImageUrl) ?>" alt="<?= $r->userName ?>" style="width: 24px; height: 24px;" />
  85. <?= $r->userName ?>
  86. </a>
  87. </div>
  88. <?php
  89. }
  90. }
  91. else {
  92. echo $rec->message;
  93. }
  94. ?>
  95. <?php include("../../include/footer.php"); ?>