index.php 2.4 KB

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