123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- require_once __DIR__ . '/../include/utils.php';
- require_once __DIR__ . '/../include/artwork_sections.php';
- require_once __DIR__ . '/../include/truncated_text.php';
- if (!isset($_GET['id']) || !ctype_digit($_GET['id'])) {
- die_with_message(400, get_string('illegal-id'));
- }
- list($artwork, $error) = get_artwork_info($_GET['id']);
- if ($error) {
- die_with_message(500, get_string($error));
- }
- $artwork = $artwork->body;
- $type = artwork_is_hidden($artwork);
- if ($type) {
- die_with_message(418, get_string('artwork.hidden-' . $type));
- }
- render_page_header($artwork->title);
- ?>
- <div class="container container-card">
- <div class="artwork-images">
- <?php render_artwork_images() ?>
- </div>
- <div class="artwork-info">
- <h1><?= htmlspecialchars($artwork->title) ?></h1>
- <div class="description"><?= render_truncated_text($artwork->description) ?></div>
- <div class="tags"><?php
- $restrict_type = get_xrestrict_string($artwork->xRestrict);
- if ($restrict_type) { ?>
- <a class="warning" href="<?= BASE_URL ?>/tags/<?= $restrict_type ?>">
- <b><?= $restrict_type ?></b>
- </a><?php
- }
- if ($artwork->aiType == 2) { ?>
- <a href="<?= BASE_URL ?>/tags/AI-generated">
- <span><b><?= get_string('artwork.aigc') ?></b></span>
- </a><?php
- }
- foreach ($artwork->tags->tags as $tag) {
- if ($restrict_type && ($tag->tag == $restrict_type)) continue;
- $tag_ja = htmlspecialchars($tag->tag);
- $tag_translated = '';
- if (!empty($tag->translation->en))
- $tag_translated = htmlspecialchars($tag->translation->en);
- else if (!empty($tag->romaji))
- $tag_translated = htmlspecialchars($tag->romaji); ?>
- <a href="<?= BASE_URL ?>/tags/<?= $tag_ja ?>">
- <span><?= $tag_ja ?></span><?php
- if ($tag_translated) { ?>
- <small><?= $tag_translated ?></small><?php
- } ?>
- </a><?php
- } ?>
- </div>
- <div class="stats">
- <div><?= sprintf(get_string('artwork.likes'), $artwork->likeCount) ?></div>
- <div><?= sprintf(get_string('artwork.bookmarks'), $artwork->bookmarkCount) ?></div>
- <div><?= sprintf(get_string('artwork.views'), $artwork->viewCount) ?></div>
- </div>
- <p><?= format_date($artwork->createDate); ?></p>
- <?php
- $pfp_url = '';
- foreach ($artwork->userIllusts as $v) {
- if (isset($v->profileImageUrl)) {
- $pfp_url = get_proxy_url($v->profileImageUrl);
- }
- } ?>
- <p><a class="img-with-text" href="<?= BASE_URL ?>/users/<?= $artwork->userId ?>">
- <img loading="lazy" class="avatar" src="<?= $pfp_url ?>" alt=" ">
- <span><b><?= htmlspecialchars($artwork->userName) ?></b></span>
- </a></p>
- </div><?php
-
- if ($settings['load-comments'] == 'on') { ?>
- <hr>
- <div class="comments">
- <?php render_artwork_comments() ?>
- </div><?php
- } ?>
- </div><?php
- if ($settings['load-related'] == 'on') { ?>
- <div class="container container-big">
- <?php render_artwork_related() ?>
- </div><?php
- } ?>
- <?php
- render_page_footer();
|