Browse Source

Modified the code to make it work on URL path

poesty 1 year ago
parent
commit
ed622900d8

+ 4 - 0
.htaccess

@@ -0,0 +1,4 @@
+RewriteEngine on
+RewriteBase /vixip/
+RewriteCond %{REQUEST_URI} !^/vixip/www/
+RewriteRule ^(.*)$ /vixip/www/$1 [L]

+ 1 - 1
include/footer.php

@@ -1,6 +1,6 @@
     </div>
     <p class="footer">
-      <a href="https://gitler.moe/suwako/vixip"><img src="/git.png" alt="Git"></a> |
+      <a href="https://git.qunn.eu/poesty/vixip-extra"><img src="<?= SITEURL ?>/git.png" alt="Git"></a> |
       <a href="https://owacon.moe/">オワコンテック</a>
     </p>
   </body>

+ 3 - 3
include/header.php

@@ -26,12 +26,12 @@
 <?php } ?>
     <?php if (isset($out["img"])) { ?><meta name="thumbnail" content="<?= $out["img"] ?>" /><?php } ?>
     <title>vixip 〜 <?= htmlspecialchars($out["title"]) ?></title>
-    <link rel="stylesheet" type="text/css" href="/style.css" />
+    <link rel="stylesheet" type="text/css" href="<?= SITEURL ?>/style.css" />
   </head>
   <body>
     <div class="header">
-      <form action="/search" method="get">
-        <a href="/" style="padding-right: 12px;">vixip</a>
+      <form action="<?= SITEURL ?>/search/" method="get">
+        <a href="<?= SITEURL ?>" style="padding-right: 12px;">vixip</a>
         <input type="text" value="" class="searchbar" name="q" placeholder="商品を検索" />
         <button class="searchbtn">検索</button>
       </form>

+ 1 - 1
include/lib.php

@@ -1,5 +1,5 @@
 <?php
   function imgprx (string $url): string {
-    return "/proxy.php?url=".str_replace("https://", "", $url);
+    return SITEURL . "/proxy.php?url=".str_replace("https://", "", $url);
   }
 ?>

+ 6 - 6
include/usermenu.php

@@ -1,5 +1,5 @@
-      <img src="/userhead.php?id=<?= $id ?>" alt="<?= $title ?>" style="background-size: cover;" />
-      <a href="/rss.php?id=<?= $id ?>" class="userbtn">RSSで登録</a>
+      <img src="<?= SITEURL ?>/userhead.php?id=<?= $id ?>" alt="<?= $title ?>" style="background-size: cover;" />
+      <a href="<?= SITEURL ?>/rss.php?id=<?= $id ?>" class="userbtn">RSSで登録</a>
 <?php
   if ($now == "home") {
 ?>
@@ -7,7 +7,7 @@
 <?php
   } else {
 ?>
-      <a href="/users/?id=<?= $id ?>" class="userbtn">トップ</a>
+      <a href="<?= SITEURL ?>/users/?id=<?= $id ?>" class="userbtn">トップ</a>
 <?php
   }
 ?>
@@ -19,7 +19,7 @@
 <?php
     } else {
 ?>
-      <a href="/users/bookmarks/?id=<?= $id ?>" class="userbtn">ブックマーク</a>
+      <a href="<?= SITEURL ?>/users/bookmarks/?id=<?= $id ?>" class="userbtn">ブックマーク</a>
 <?php
     }
   }
@@ -30,7 +30,7 @@
 <?php
     } else {
 ?>
-      <a href="/users/illusts/?id=<?= $id ?>" class="userbtn">イラスト</a>
+      <a href="<?= SITEURL ?>/users/illusts/?id=<?= $id ?>" class="userbtn">イラスト</a>
 <?php
     }
   }
@@ -41,7 +41,7 @@
 <?php
     } else {
 ?>
-      <a href="/users/manga/?id=<?= $id ?>" class="userbtn">漫画</a>
+      <a href="<?= SITEURL ?>/users/manga/?id=<?= $id ?>" class="userbtn">漫画</a>
 <?php
     }
   }

+ 1 - 1
www/404.php

@@ -1,5 +1,5 @@
 <?php $out = ["title" => "見つけられない"]; ?>
-
+<?php require_once("../config.php"); ?>
 <?php include("../include/header.php"); ?>
     <h1>見つけられなかった</h1>
     <p>ごめんね!</p>

+ 7 - 7
www/artworks/index.php

@@ -1,12 +1,12 @@
 <?php
   require_once("../../api.php");
   require_once("../../include/lib.php");
-  if (!isset($_GET["id"])) header("Location: /404.php");
+  if (!isset($_GET["id"])) header("Location: " . SITEURL . "/404.php");
   $id = (int)$_GET["id"];
   $cur = "/artworks/?id=".$id;
   $res = get("illust/".$id);
   if (!isset($res->body)) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/404.php");
     die();
   }
   $res = $res->body;
@@ -35,7 +35,7 @@
     <h1><?= $res->illustTitle ?></h1>
     <p>
       好:<?= $res->likeCount ?> 保:<?= $res->bookmarkCount ?> 視:<?= $res->viewCount ?><br /> 
-      <img src="<?= $icon ?>" alt="<?= $res->userName ?>" /> <a href="/users?id=<?= $res->userId ?>"><?= $res->userName ?></a>
+      <img src="<?= $icon ?>" alt="<?= $res->userName ?>" /> <a href="<?= SITEURL ?>/users?id=<?= $res->userId ?>"><?= $res->userName ?></a>
     </p>
     <h2>コメント (<?= $res->commentCount ?>)</h2>
     <table>
@@ -45,7 +45,7 @@
 ?>
       <tr>
         <td rowspan="2" style="vertical-align: top;"><img src="<?= imgprx($c->img) ?>" alt="<?= $c->userName ?>" style="width: 40px; height: 40px;" /></td>
-        <td style="padding-left: 12px;"><a href="/users/?id=<?= $c->userId ?>"><?= $c->userName ?></a> <?= $c->commentDate ?></td>
+        <td style="padding-left: 12px;"><a href="<?= SITEURL ?>/users/?id=<?= $c->userId ?>"><?= $c->userName ?></a> <?= $c->commentDate ?></td>
       </tr>
       <tr>
         <td style="padding-left: 12px;">
@@ -55,7 +55,7 @@
   }
   else {
 ?>
-          <img src="/proxy.php?url=s.pximg.net/common/images/stamp/generated-stamps/<?= $c->stampId ?>_s.jpg" alt="<?= $c->stampId ?>" />
+          <img src="<?= SITEURL ?>/proxy.php?url=s.pximg.net/common/images/stamp/generated-stamps/<?= $c->stampId ?>_s.jpg" alt="<?= $c->stampId ?>" />
 <?php
   }
 ?>
@@ -76,12 +76,12 @@
       if (is_null($r->id)) continue;
 ?>
     <div class="searchres">
-      <a href="/artworks/?id=<?= $r->id ?>">
+      <a href="<?= SITEURL ?>/artworks/?id=<?= $r->id ?>">
         <img src="<?= imgprx($r->url) ?>" alt="<?= $r->alt ?>" style="width: 260px; height: 260px;" />
         <?= $r->title ?>
       </a>
       <br />
-      <a href="/users/?id=<?= $r->userId ?>">
+      <a href="<?= SITEURL ?>/users/?id=<?= $r->userId ?>">
         <img src="<?= imgprx($r->profileImageUrl) ?>" alt="<?= $r->userName ?>" style="width: 24px; height: 24px;" />
         <?= $r->userName ?>
       </a>

+ 2 - 2
www/index.php

@@ -12,12 +12,12 @@
   foreach ($res["body"]->thumbnails->illust as $o) {
 ?>
         <div class="searchres">
-          <a href="/artworks/?id=<?= $o->id ?>">
+          <a href="<?= SITEURL ?>/artworks/?id=<?= $o->id ?>">
             <img src="<?= imgprx($o->url) ?>" alt="<?= $o->alt ?>" />
             <?= $o->title ?>
           </a>
           <br />
-          <a href="/users/?id=<?= $o->userId ?>">
+          <a href="<?= SITEURL ?>/users/?id=<?= $o->userId ?>">
             <img src="<?= imgprx($o->profileImageUrl) ?>" alt="<?= $o->userName ?>" style="width: 24px; height: 24px;" />
             <?= $o->userName ?>
           </a>

+ 2 - 2
www/rss.php

@@ -5,7 +5,7 @@
   $id = (int)$_GET["id"];
   $res = get("user/".$id."/profile/top");
   if (!isset($res->body) || $res->error) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/404.php");
     die();
   }
   $res = $res->body;
@@ -46,7 +46,7 @@
     <content type="html">
       <?= $img->body->illustComment ?><br />
 <?php for ($i = 0; $i < $img->body->pageCount; $i++) { ?>
-      <?= SITEURL.imgprx(str_replace("_p0", "_p".$i, $img->body->urls->original)) ?><br />
+      <?= imgprx(str_replace("_p0", "_p".$i, $img->body->urls->original)) ?><br />
 <?php } ?>
     </content>
   </entry>

+ 5 - 5
www/search/index.php

@@ -3,7 +3,7 @@
   require_once("../../include/lib.php");
   $q = htmlspecialchars($_GET["q"]);
   if (!isset($q) || $q == "" || is_null($q)) {
-    header("Location: /");
+    header("Location: " . SITEURL);
     die();
   }
   $cur = "/search/?q=".$q;
@@ -11,7 +11,7 @@
   if ($res->error) die();
 
   if (!isset($res->body)) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/404.php");
     die();
   }
   $res = $res->body;
@@ -22,7 +22,7 @@
 <?php
   foreach ($res->relatedTags as $t) {
 ?>
-      <a href="/search/?q=<?= $t ?>">#<?= $t ?></a>
+      <a href="?q=<?= $t ?>">#<?= $t ?></a>
 <?php
   }
 ?>
@@ -32,12 +32,12 @@
     if (is_null($r->id)) continue;
 ?>
       <div class="searchres">
-        <a href="/artworks/?id=<?= $r->id ?>">
+        <a href="<?= SITEURL ?>/artworks/?id=<?= $r->id ?>">
           <img src="<?= imgprx($r->url) ?>" alt="<?= $r->alt ?>" />
           <?= $r->title ?>
         </a>
         <br />
-        <a href="/users/?id=<?= $r->userId ?>">
+        <a href="<?= SITEURL ?>/users/?id=<?= $r->userId ?>">
           <img src="<?= imgprx($r->profileImageUrl) ?>" alt="<?= $r->userName ?>" style="width: 24px; height: 24px;" />
           <?= $r->userName ?>
         </a>

+ 5 - 5
www/users/bookmarks/index.php

@@ -1,7 +1,7 @@
 <?php
   require_once("../../../api.php");
   require_once("../../../include/lib.php");
-  if (!isset($_GET["id"])) header("Location: /404.php");
+  if (!isset($_GET["id"])) header("Location: " . SITEURL . "/404.php");
   $id = (int)$_GET["id"];
   $cur = "/users/bookmarks/?id=".$id;
   $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
@@ -10,13 +10,13 @@
   $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");
+    header("Location: " . SITEURL . "/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");
+  if (count((array)$res->works) == 0) header("Location: " . SITEURL . "/404.php");
   $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
 
   $bookmarks = count((array)$res->works);
@@ -42,12 +42,12 @@
     foreach ($res->works as $k => $v) {
 ?>
       <div class="searchres">
-        <a href="/artworks/?id=<?= $v->id ?>">
+        <a href="<?= SITEURL ?>/artworks/?id=<?= $v->id ?>">
           <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
           <?= $v->title ?>
         </a>
         <br />
-        <a href="/users/?id=<?= $v->userId ?>">
+        <a href="<?= SITEURL ?>/users/?id=<?= $v->userId ?>">
           <img src="<?= imgprx($v->profileImageUrl) ?>" alt="<?= $v->userName ?>" style="width: 24px; height: 24px;" />
           <?= $v->userName ?>
         </a>

+ 4 - 4
www/users/illusts/index.php

@@ -1,7 +1,7 @@
 <?php
   require_once("../../../api.php");
   require_once("../../../include/lib.php");
-  if (!isset($_GET["id"])) header("Location: /404.php");
+  if (!isset($_GET["id"])) header("Location: " . SITEURL . "/404.php");
   $id = (int)$_GET["id"];
   $cur = "/users/illusts/?id=".$id;
   $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
@@ -10,13 +10,13 @@
   $offset = $pagemax * ($page - 1);
   $res = get("user/".$id."/profile/all");
   if (!isset($res->body)) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/404.php");
     die();
   }
   $top = get("user/".$id."/profile/top");
   $res = $res->body;
   $top = $top->body;
-  if (count((array)$res->illusts) == 0) header("Location: /404.php");
+  if (count((array)$res->illusts) == 0) header("Location: " . SITEURL . "/404.php");
   $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
 
   $index = 0;
@@ -54,7 +54,7 @@
     foreach ($i->body->works as $k => $v) {
 ?>
       <div class="searchres">
-        <a href="/artworks/?id=<?= $v->id ?>">
+        <a href="<?= SITEURL ?>/artworks/?id=<?= $v->id ?>">
           <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
           <?= $v->title ?>
         </a>

+ 2 - 2
www/users/index.php

@@ -1,11 +1,11 @@
 <?php
   require_once("../../api.php");
-  if (!isset($_GET["id"])) header("Location: /404.php");
+  if (!isset($_GET["id"])) header("Location: " . SITEURL . "/404.php");
   $id = (int)$_GET["id"];
   $cur = "/users/?id=".$id;
   $res = get("user/".$id."/profile/all");
   if (!isset($res->body)) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/404.php");
     die();
   }
   $top = get("user/".$id."/profile/top");

+ 4 - 4
www/users/manga/index.php

@@ -1,7 +1,7 @@
 <?php
   require_once("../../../api.php");
   require_once("../../../include/lib.php");
-  if (!isset($_GET["id"])) header("Location: /404.php");
+  if (!isset($_GET["id"])) header("Location: " . SITEURL . "/404.php");
   $id = (int)$_GET["id"];
   $cur = "/users/manga/?id=".$id;
   $page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
@@ -10,13 +10,13 @@
   $offset = $pagemax * ($page - 1);
   $res = get("user/".$id."/profile/all");
   if (!isset($res->body)) {
-    header("Location: /404.php");
+    header("Location: " . SITEURL . "/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");
+  if (count((array)$res->manga) == 0) header("Location: " . SITEURL . "/404.php");
   $out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
 
   $index = 0;
@@ -54,7 +54,7 @@
     foreach ($m->body->works as $k => $v) {
 ?>
       <div class="searchres">
-        <a href="/artworks/?id=<?= $v->id ?>">
+        <a href="<?= SITEURL ?>/artworks/?id=<?= $v->id ?>">
           <img src="<?= imgprx($v->url) ?>" alt="<?= $v->alt ?>">
           <?= $v->title ?>
         </a>