Browse Source

作業完成!!

諏訪子 1 year ago
parent
commit
7f3ef48fd0
5 changed files with 145 additions and 16 deletions
  1. 5 16
      include/usermenu.php
  2. 64 0
      www/users/bookmarks/index.php
  3. 3 0
      www/users/illusts/index.php
  4. 3 0
      www/users/index.php
  5. 70 0
      www/users/manga/index.php

+ 5 - 16
include/usermenu.php

@@ -11,7 +11,7 @@
   }
 ?>
 <?php
-  if ($res->bookmarkCount->public->illust > 0 || $res->bookmarkCount->public->novel > 0) {
+  if ($bmc > 0) {
     if ($now == "bookmark") {
 ?>
         <span class="userbtn now">ブックマーク</span>
@@ -22,7 +22,7 @@
 <?php
     }
   }
-  if (count((array)$res->illusts) > 0) {
+  if ($ilc > 0) {
     if ($now == "illust") {
 ?>
         <span class="userbtn now">イラスト</span>
@@ -33,25 +33,14 @@
 <?php
     }
   }
-  if (count((array)$res->manga) > 0) {
+  if ($mgc > 0) {
     if ($now == "manga") {
 ?>
-      <span class="userbtn now">漫画</span>
+        <span class="userbtn now">漫画</span>
 <?php
     } else {
 ?>
-      <a href="/users/manga/?id=<?= $id ?>" class="userbtn">漫画</a>
-<?php
-    }
-  }
-  if (count((array)$res->novels) > 0) {
-    if ($now == "novel") {
-?>
-      <span class="userbtn now">小説</span>
-<?php
-    } else {
-?>
-      <a href="/users/novels/?id=<?= $id ?>" class="userbtn">小説</a>
+        <a href="/users/manga/?id=<?= $id ?>" class="userbtn">漫画</a>
 <?php
     }
   }

+ 64 - 0
www/users/bookmarks/index.php

@@ -0,0 +1,64 @@
+<?php
+  require_once("../../../api.php");
+  require_once("../../../include/lib.php");
+  if (!isset($_GET["id"])) header("Location: /404.php");
+  $id = (int)$_GET["id"];
+  $cur = "/users/bookmarks/?id=".$id;
+  $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
+  if ($page < 1) $page = 1;
+  $pagemax = 40;
+  $offset = $pagemax * ($page - 1);
+  $res = get("user/".$id."/illusts/bookmarks?offset=".$offset."&limit=".$pagemax."&rest=show&tag=");
+  if (!isset($res->body)) {
+    header("Location: /404.php");
+    die();
+  }
+  $top = get("user/".$id."/profile/top");
+  $res = $res->body;
+  $top = $top->body;
+  if (count((array)$res->works) == 0) header("Location: /404.php");
+  $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
+
+  $bookmarks = count((array)$res->works);
+?>
+
+<?php
+  include("../../../include/header.php");
+  $title = $top->extraData->meta->ogp->title;
+  $now = "bookmark";
+  $bmc = $bookmarks;
+  $cunt = get("user/".$id."/profile/all");
+  $ilc = count((array)$cunt->body->illusts);
+  $mgc = count((array)$cunt->body->manga);
+  unset($cunt);
+  include("../../../include/usermenu.php");
+?>
+      <hr />
+<?php
+  if ($bookmarks > 0) {
+?>
+      <h2>ブックマーク</h2>
+<?php
+    foreach ($res->works as $k => $v) {
+?>
+      <div class="searchres">
+        <a href="/artworks/?id=<?= $v->id ?>">
+          <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
+          <?= $v->title ?>
+        </a>
+        <br />
+        <a href="/users/?id=<?= $v->userId ?>">
+          <img src="<?= imgprx($v->profileImageUrl) ?>" alt="<?= $v->userName ?>" style="width: 24px; height: 24px;" />
+          <?= $v->userName ?>
+        </a>
+      </div>
+<?php
+    }
+  }
+
+  unset($res);
+  unset($top);
+  $sum = ceil($bookmarks/$pagemax);
+  include("../../../include/pagination.php");
+  include("../../../include/footer.php");
+?>

+ 3 - 0
www/users/illusts/index.php

@@ -38,6 +38,9 @@
   include("../../../include/header.php");
   $title = $top->extraData->meta->ogp->title;
   $now = "illust";
+  $bmc = $res->bookmarkCount->public->illust;
+  $ilc = count((array)$res->illusts);
+  $mgc = count((array)$res->manga);
   include("../../../include/usermenu.php");
   unset($res);
 ?>

+ 3 - 0
www/users/index.php

@@ -18,6 +18,9 @@
   include("../../include/header.php");
   $title = $top->extraData->meta->ogp->title;
   $now = "home";
+  $bmc = $res->bookmarkCount->public->illust;
+  $ilc = count((array)$res->illusts);
+  $mgc = count((array)$res->manga);
   include("../../include/usermenu.php");
   unset($res);
 ?>

+ 70 - 0
www/users/manga/index.php

@@ -0,0 +1,70 @@
+<?php
+  require_once("../../../api.php");
+  require_once("../../../include/lib.php");
+  if (!isset($_GET["id"])) header("Location: /404.php");
+  $id = (int)$_GET["id"];
+  $cur = "/users/manga/?id=".$id;
+  $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
+  if ($page < 1) $page = 1;
+  $pagemax = 40;
+  $offset = $pagemax * ($page - 1);
+  $res = get("user/".$id."/profile/all");
+  if (!isset($res->body)) {
+    header("Location: /404.php");
+    die();
+  }
+  $top = get("user/".$id."/profile/top");
+  $res = $res->body;
+  $top = $top->body;
+  if (count((array)$res->manga) == 0) header("Location: /404.php");
+  $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
+
+  $index = 0;
+  $manga = count((array)$res->manga);
+  $murl = "user/".$id."/profile/illusts?";
+
+  foreach ($res->manga as $k => $v) {
+    $index++;
+    if ($index <= $offset) continue;
+    if ($index >= ($pagemax+$offset)+1) break;
+    $murl .= "ids[]=".$k."&";
+  }
+
+  $murl .= "work_category=illustManga&is_first_page=0";
+  unset($index);
+?>
+
+<?php
+  include("../../../include/header.php");
+  $title = $top->extraData->meta->ogp->title;
+  $now = "manga";
+  $bmc = $res->bookmarkCount->public->illust;
+  $ilc = count((array)$res->illusts);
+  $mgc = count((array)$res->manga);
+  include("../../../include/usermenu.php");
+  unset($res);
+?>
+      <hr />
+<?php
+  if ($manga > 0) {
+?>
+      <h2>漫画</h2>
+<?php
+    $m = get($murl);
+    foreach ($m->body->works as $k => $v) {
+?>
+      <div class="searchres">
+        <a href="/artworks/?id=<?= $v->id ?>">
+          <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
+          <?= $v->title ?>
+        </a>
+      </div>
+<?php
+    }
+  }
+
+  unset($top);
+  $sum = ceil($manga/$pagemax);
+  include("../../../include/pagination.php");
+  include("../../../include/footer.php");
+?>