mirror of
https://github.com/saintly2k/FoOlSlideX.git
synced 2025-02-20 11:13:13 +08:00
commit
27f7bf662a
@ -29,7 +29,7 @@ switch ($action) {
|
||||
$md5Hash = md5_file($_FILES["cover"]["tmp_name"]);
|
||||
$imageFileType = strtolower(pathinfo($_FILES["cover"]["name"], PATHINFO_EXTENSION));
|
||||
$target_file = $tmpPath . $md5Hash . "." . $imageFileType;
|
||||
$frontend_file = "assets/tmp/" . $md5Hash . "." . $imageFileType;
|
||||
$frontend_file = "api/image/" . $md5Hash . "." . $imageFileType . "/tmp";
|
||||
$output_file = $md5Hash . "." . $imageFileType;
|
||||
|
||||
// Check if image file is a actual image or fake image
|
||||
|
@ -12,18 +12,28 @@ if ($logged && $user["level"] == 99) {
|
||||
die(json_encode(["done" => false, "msg" => "You're banned, baka!"]));
|
||||
}
|
||||
|
||||
if (!in_array($type, ["title", "chapter", "user"])) {
|
||||
if (!in_array($type, ["title", "chapter", "user", "error", "tmp"])) {
|
||||
die(json_encode(["done" => false, "msg" => "Invalid type."]));
|
||||
}
|
||||
|
||||
if ($type == "title") {
|
||||
$image = ROOT . "assets/covers/{$file}";
|
||||
if (!file_exists($image)) {
|
||||
die(json_encode(["done" => false, "msg" => "Cover does not exist."]));
|
||||
}
|
||||
switch ($type) {
|
||||
case "title":
|
||||
$image = ROOT . "assets/covers/{$file}";
|
||||
break;
|
||||
case "tmp":
|
||||
$image = ROOT . "assets/tmp/{$file}";
|
||||
break;
|
||||
case "error":
|
||||
default:
|
||||
$image = ROOT . "assets/no-cover.jpg";
|
||||
break;
|
||||
}
|
||||
|
||||
// $type = "image/jpeg";
|
||||
|
||||
if (!file_exists($image)) {
|
||||
die(json_encode(["done" => false, "msg" => "Cover does not exist."]));
|
||||
}
|
||||
header("Content-Type: image/jpeg");
|
||||
header("Content-Length: " . filesize($image));
|
||||
readfile($image);
|
||||
|
@ -78,25 +78,32 @@ switch ($action) {
|
||||
}
|
||||
|
||||
// Ensure the covers directory exists
|
||||
$coversDirectory = ps(__DIR__ . "/../assets/covers");
|
||||
$coversDirectory = ROOT . "assets/covers";
|
||||
if (!file_exists($coversDirectory)) {
|
||||
mkdir($coversDirectory, 0777, true);
|
||||
}
|
||||
|
||||
// Process cover file, if provided
|
||||
if (!empty($cover)) {
|
||||
$oldFilePath = ps(__DIR__ . "/../assets/tmp/{$cover}");
|
||||
$oldFilePath = ROOT . "assets/tmp/{$cover}";
|
||||
if (file_exists($oldFilePath)) {
|
||||
$coverHash = md5_file($oldFilePath);
|
||||
$ext = pathinfo($oldFilePath, PATHINFO_EXTENSION);
|
||||
$cover = $coverHash . "." . $ext;
|
||||
$newFilePath = ps($coversDirectory . "/{$cover}");
|
||||
$newFilePath = ROOT . "assets/covers/{$cover}";
|
||||
rename($oldFilePath, $newFilePath);
|
||||
}
|
||||
}
|
||||
if (!empty($cover)) {
|
||||
$finalCover = $cover;
|
||||
} elseif (!empty($check)) {
|
||||
$finalCover = $check["cover"];
|
||||
} else {
|
||||
$finalCover = "";
|
||||
}
|
||||
|
||||
$data = [
|
||||
"cover" => (!empty($cover) ? $cover : (!empty($check) ? $check["cover"] : "")),
|
||||
"cover" => $finalCover,
|
||||
"title" => $title,
|
||||
"alts" => $alts,
|
||||
"authors" => $authors,
|
||||
|
@ -26,7 +26,7 @@ if (isset($tags) && !empty($tags) && !is_numeric($tags)) {
|
||||
if (count($items) > 0) {
|
||||
foreach ($items as $item) {
|
||||
if (!empty($item)) {
|
||||
if (is_numeric($tags)) {
|
||||
if (isset($tags) && is_numeric($tags) && !empty($tags)) {
|
||||
$output[$item] = valCustomTags($item, $tags);
|
||||
} else {
|
||||
$output[$item] = valCustomTags($item);
|
||||
|
@ -35,6 +35,7 @@ for ($i = 0; $i < $totalPages; $i++) {
|
||||
|
||||
$resp["done"] = true;
|
||||
$resp["msg"] = $titles;
|
||||
$resp["totalpages"] = $totalPages;
|
||||
$resp["pagination"] = $pagis;
|
||||
|
||||
die(json_encode($resp));
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
$customRoutes = [
|
||||
// Main
|
||||
["get", "/", "views/index.php"],
|
||||
["get", "/index", "views/index.php"],
|
||||
["get", "/other", "views/other"],
|
||||
["get", "/", "views/releases.php"],
|
||||
["get", "/index", "views/releases.php"],
|
||||
["get", '/index/$page', "views/releases.php"],
|
||||
["get", "/releases", "views/releases.php"],
|
||||
["get", '/releases/$page', "views/releases.php"],
|
||||
|
||||
// Projects
|
||||
["get", "/projects", "views/projects.php"],
|
||||
|
@ -58,6 +58,141 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
{if $tab == "info"}
|
||||
<div class="grid grid-cols-6 gap-x-2 mb-2">
|
||||
{if !empty($project.cover)}
|
||||
<div class="col-span-1">
|
||||
<img src="{$config.url}api/image/{$project.cover}/title" class="w-full">
|
||||
</div>
|
||||
{/if}
|
||||
<div class="{if !empty($project.cover)}col-span-5{else}col-span-6{/if} w-full">
|
||||
<div class="w-full">
|
||||
{if !empty($project.summary)}
|
||||
<div id="summary">
|
||||
{$parsedown->text($project.summary)}
|
||||
</div>
|
||||
<hr class="h-px my-1 bg-gray-200 dark:bg-gray-700">
|
||||
{/if}
|
||||
{if !empty($project.alts)}
|
||||
<div>
|
||||
<b>Alternative Titles:</b> {$project.alts}
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.authors) || !empty($project.artists)}
|
||||
<div class="grid grid-cols-2 gap-x-2">
|
||||
{if !empty($project.authors)}
|
||||
<div class="col-span-1">
|
||||
<b>Author/s:</b> {$project.authors}
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.artists)}
|
||||
<div class="col-span-1">
|
||||
<b>Artist/s:</b> {$project.artists}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="grid grid-cols-3 gap-x-2">
|
||||
<div class="col-span-1">
|
||||
<b>Original Language:</b> {$project.lang}
|
||||
</div>
|
||||
<div class="col-span-1">
|
||||
<b>Original Status:</b>
|
||||
{if $project.status.original == 1}
|
||||
Announced
|
||||
{elseif $project.status.original == 2}
|
||||
Releasing
|
||||
{elseif $project.status.original == 3}
|
||||
Hiatus
|
||||
{elseif $project.status.original == 4}
|
||||
Completed
|
||||
{else}
|
||||
Cancelled
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-span-1">
|
||||
<b>Upload Status:</b>
|
||||
{if $project.status.upload == 1}
|
||||
Planned
|
||||
{elseif $project.status.upload == 2}
|
||||
Ongoing
|
||||
{elseif $project.status.upload == 3}
|
||||
Hiatus
|
||||
{elseif $project.status.upload == 4}
|
||||
Completed
|
||||
{else}
|
||||
Cancelled
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{if !empty($project.years)}
|
||||
<div class="grid grid-cols-2 gap-x-2">
|
||||
{if !empty($project.years.release)}
|
||||
<div class="col-span-1">
|
||||
<b>Released:</b> {$project.years.release}
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.years.completion)}
|
||||
<div class="col-span-1">
|
||||
<b>Completed:</b> {$project.years.completion}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.tags.format) || !empty($project.tags.genre) || !empty($project.tags.theme) || !empty($project.tags.warnings)}
|
||||
<div class="grid grid-cols-2 gap-x-2 mt-2" id="tags">
|
||||
{if !empty($project.tags.format)}
|
||||
<div class="col-span-1">
|
||||
<b>Formats:</b>
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.tags.genre)}
|
||||
<div class="col-span-1">
|
||||
<b>Genres:</b>
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.tags.theme)}
|
||||
<div class="col-span-1">
|
||||
<b>Themes:</b>
|
||||
</div>
|
||||
{/if}
|
||||
{if !empty($project.tags.warnings)}
|
||||
<div class="col-span-1">
|
||||
<b>Warnings:</b>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function addClassesToLinks(clss, blnk) {
|
||||
var summaryDiv = document.getElementById(clss);
|
||||
if (summaryDiv) {
|
||||
var links = summaryDiv.getElementsByTagName('a');
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
links[i].classList.add('text-blue-500', 'dark:text-blue-600', 'hover:underline');
|
||||
if (blnk)
|
||||
links[i].setAttribute("target", "_blank");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{if !empty($project.summary)}
|
||||
addClassesToLinks("summary", true);
|
||||
{/if}
|
||||
{if !empty($project.tags.format) || !empty($project.tags.genre) || !empty($project.tags.theme) || !empty($project.tags.warnings)}
|
||||
addClassesToLinks("tags", false);
|
||||
{/if}
|
||||
</script>
|
||||
{elseif $tab == "chapters"}
|
||||
|
||||
{else}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav class="flex px-2 py-1 text-gray-700 bg-gray-50 dark:bg-gray-800 my-4" aria-label="Breadcrumb">
|
||||
|
@ -32,18 +32,7 @@
|
||||
{/if}
|
||||
</p>
|
||||
<div class="grid grid-cols-6 gap-2 my-2" id="titlesDiv">
|
||||
{foreach from=$projects item=item key=key name=name}
|
||||
<div class="col-span-1">
|
||||
<a href="{$config.url}project/{$item.uid}/info">
|
||||
<div>
|
||||
{if $item.cover}
|
||||
<img src="{$config.url}api/image/{$item.cover}/title" alt="Cover Image">
|
||||
{/if}
|
||||
</div>
|
||||
<span class="text-blue-500 hover:underline dark:text-blue-600">{$item.title}</span>
|
||||
</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="col-span-6" id="loadingTagsText">Loading titles... <a href="#" class="text-blue-500 hover:underline dark:text-blue-600" onclick="getTitles()">Try again!</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -63,22 +52,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop through each array in the data and create checkboxes
|
||||
Object.keys(data.msg).forEach(key => {
|
||||
const itemsArray = data[key] || [];
|
||||
|
||||
// Create a container div for each array
|
||||
if (document.getElementById(key + "Div")) {
|
||||
$("#titlesDiv").empty();
|
||||
const containerDiv = document.getElementById("titlesDiv");
|
||||
if (containerDiv) {
|
||||
// Create checkboxes for each item in the array
|
||||
itemsArray.forEach(item => {
|
||||
containerDiv.appendChild(div);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// Create a container div for each array
|
||||
$("#titlesDiv").empty();
|
||||
const containerDiv = document.getElementById("titlesDiv");
|
||||
if (containerDiv) {
|
||||
// Create checkboxes for each item in the array
|
||||
data.msg.forEach(item => {
|
||||
const card = createDynamicCard(item);
|
||||
containerDiv.appendChild(card);
|
||||
});
|
||||
}
|
||||
|
||||
$("#loadingTagsText").addClass("hidden");
|
||||
},
|
||||
@ -89,6 +72,65 @@
|
||||
}
|
||||
|
||||
getTitles();
|
||||
|
||||
function createDynamicCard(item) {
|
||||
const cardDiv = document.createElement('div');
|
||||
cardDiv.className = 'col-span-1 relative aspect-[5/7]';
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = `{$config.url}project/` + item.uid + `/info`;
|
||||
link.className = 'block h-full relative';
|
||||
|
||||
const imageDiv = document.createElement('div');
|
||||
imageDiv.className = 'h-full w-full overflow-hidden';
|
||||
|
||||
const img = document.createElement('img');
|
||||
if (item.cover) {
|
||||
img.src = `{$config.url}api/image/` + item.cover + `/title`;
|
||||
} else {
|
||||
img.src = `{$config.url}api/image/no-cover.jpg/error`;
|
||||
}
|
||||
img.alt = 'Cover Image';
|
||||
img.className = 'w-full h-full object-cover';
|
||||
|
||||
imageDiv.appendChild(img);
|
||||
|
||||
let statusClasses = '';
|
||||
let statusText = '';
|
||||
|
||||
switch (item.status.upload) {
|
||||
case 1:
|
||||
statusClasses = 'text-white bg-blue-500 dark:text-blue-800 dark:bg-blue-200';
|
||||
statusText = 'Planned';
|
||||
break;
|
||||
case 2:
|
||||
statusClasses = 'text-white bg-orange-500 dark:text-orange-800 dark:bg-orange-200';
|
||||
statusText = 'Ongoing';
|
||||
break;
|
||||
// Add cases for other statuses...
|
||||
default:
|
||||
statusClasses = 'text-white bg-red-500 dark:text-red-800 dark:bg-red-200';
|
||||
statusText = 'Cancelled';
|
||||
break;
|
||||
}
|
||||
|
||||
const statusSpan = document.createElement('span');
|
||||
statusSpan.className = `absolute top-0 left-0 px-2 py-1 ` + statusClasses +
|
||||
` text-sm bg-opacity-75 dark:bg-opacity-90`;
|
||||
statusSpan.textContent = statusText;
|
||||
|
||||
const titleSpan = document.createElement('span');
|
||||
titleSpan.className =
|
||||
'absolute bottom-0 left-0 right-0 px-2 py-1 text-blue-500 hover:underline dark:text-blue-600 bg-white bg-opacity-75 dark:bg-black dark:bg-opacity-75';
|
||||
titleSpan.textContent = item.title;
|
||||
|
||||
link.appendChild(imageDiv);
|
||||
link.appendChild(statusSpan);
|
||||
link.appendChild(titleSpan);
|
||||
cardDiv.appendChild(link);
|
||||
|
||||
return cardDiv;
|
||||
}
|
||||
</script>
|
||||
|
||||
<nav class="flex px-2 py-1 text-gray-700 bg-gray-50 dark:bg-gray-800 my-4" aria-label="Breadcrumb">
|
||||
|
@ -50,9 +50,9 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
<img class="w-full" id="coverPreview" {if isset($res)}src="{$config.url}api/image/{$res.cover}/title"
|
||||
<img class="w-full" id="coverPreview" {if isset($res) && !empty($res.cover)}src="{$config.url}api/image/{$res.cover}/title"
|
||||
{/if}>
|
||||
<input type="text" name="cover" class="hidden" readonly>
|
||||
<input type="text" name="cover" class="hidden">
|
||||
</div>
|
||||
<div class="col-span-4"></div>
|
||||
<div class="col-span-5">
|
||||
@ -83,22 +83,22 @@
|
||||
<select name="originalStatus"
|
||||
class="select w-full text-sm text-gray-900 border border-gray-300 bg-gray-50 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white">
|
||||
<option disabled selected>Select original work status...</option>
|
||||
<option value="1">Announced</option>
|
||||
<option value="2">Releasing</option>
|
||||
<option value="3">Hiatus</option>
|
||||
<option value="4">Completed</option>
|
||||
<option value="5">Cancelled</option>
|
||||
<option value="1" {if isset($res) && $res.status.original == 1}selected{/if}>Announced</option>
|
||||
<option value="2" {if isset($res) && $res.status.original == 2}selected{/if}>Releasing</option>
|
||||
<option value="3" {if isset($res) && $res.status.original == 3}selected{/if}>Hiatus</option>
|
||||
<option value="4" {if isset($res) && $res.status.original == 4}selected{/if}>Completed</option>
|
||||
<option value="5" {if isset($res) && $res.status.original == 5}selected{/if}>Cancelled</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-span-3">
|
||||
<select name="uploadStatus"
|
||||
class="select w-full text-sm text-gray-900 border border-gray-300 bg-gray-50 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white">
|
||||
<option disabled selected>Select scanlation status...</option>
|
||||
<option value="1">Planned</option>
|
||||
<option value="2">Ongoing</option>
|
||||
<option value="3">Hiatus</option>
|
||||
<option value="4">Completed</option>
|
||||
<option value="5">Cancelled</option>
|
||||
<option value="1" {if isset($res) && $res.status.upload == 1}selected{/if}>Planned</option>
|
||||
<option value="2" {if isset($res) && $res.status.upload == 2}selected{/if}>Ongoing</option>
|
||||
<option value="3" {if isset($res) && $res.status.upload == 3}selected{/if}>Hiatus</option>
|
||||
<option value="4" {if isset($res) && $res.status.upload == 4}selected{/if}>Completed</option>
|
||||
<option value="5" {if isset($res) && $res.status.upload == 5}selected{/if}>Cancelled</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
@ -114,7 +114,7 @@
|
||||
<div class="col-span-10">
|
||||
<textarea name="summary"
|
||||
class="textarea w-full h-[250px] text-sm text-gray-900 border border-gray-300 bg-gray-50 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white"
|
||||
placeholder="Summary (Supports BBCode)">{if isset($res)}{$res.summary}{/if}</textarea>
|
||||
placeholder="Summary (Supports MarkDown)">{if isset($res)}{$res.summary}{/if}</textarea>
|
||||
</div>
|
||||
<div class="col-span-10">
|
||||
<p class="text-xl mb-2">
|
||||
@ -250,6 +250,7 @@
|
||||
$("#coverPreview").removeClass("hidden");
|
||||
$("#coverPreview").attr("src", "{$config.url}" + data.public);
|
||||
$("input[name='cover']").val(data.image);
|
||||
// alert(data.image);
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
|
41
themes/fsx/pages/releases.tpl
Normal file
41
themes/fsx/pages/releases.tpl
Normal file
@ -0,0 +1,41 @@
|
||||
<nav class="flex px-2 py-1 text-gray-700 bg-gray-50 dark:bg-gray-800 mb-4" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<a href="{$config.url}"
|
||||
class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
{$config.title}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<span class="text-gray-400 cursor-default">»</span>
|
||||
<span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400">Releases</span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="px-2 xl:px-0">
|
||||
Releases
|
||||
</div>
|
||||
|
||||
<nav class="flex px-2 py-1 text-gray-700 bg-gray-50 dark:bg-gray-800 my-4" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<a href="{$config.url}"
|
||||
class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
{$config.title}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<span class="text-gray-400 cursor-default">»</span>
|
||||
<span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400">Releases</span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
@ -6,7 +6,7 @@
|
||||
data-instant-track>
|
||||
</script>
|
||||
<script>
|
||||
InstantClick.init('load');
|
||||
InstantClick.init('mouseover');
|
||||
|
||||
var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
|
||||
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
|
||||
|
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
||||
1.0.0
|
@ -19,7 +19,7 @@ if (empty($title)) {
|
||||
$smarty->assign("project", $title);
|
||||
$smarty->assign("uid", $uid);
|
||||
$smarty->assign("tab", $tab);
|
||||
$smarty->assign("pageTitle", titlify("Project", $config["divider"], $config["title"]));
|
||||
$smarty->assign("pageTitle", titlify("Projects - " . $title["title"], $config["divider"], $config["title"]));
|
||||
|
||||
$smarty->display("parts/head.tpl");
|
||||
$smarty->display("parts/header.tpl");
|
||||
|
@ -27,7 +27,7 @@ $totalPages = $db["projects"]->count() / $perpage;
|
||||
for ($i = 0; $i < $totalPages; $i++) {
|
||||
array_push($pagis, $i + 1);
|
||||
}
|
||||
$smarty->assign("projects", $titles);
|
||||
// $smarty->assign("projects", $titles);
|
||||
$smarty->assign("pagination", $pagis);
|
||||
/**/
|
||||
|
||||
|
16
views/releases.php
Normal file
16
views/releases.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
require_once ROOT . "autoload.php";
|
||||
if (!isset($page) || !is_numeric($page) || $page < 1) {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
$smarty->assign("pageTitle", titlify("Releases - Page {$page}", $config["divider"], $config["title"]));
|
||||
|
||||
$smarty->display("parts/head.tpl");
|
||||
$smarty->display("parts/header.tpl");
|
||||
|
||||
$smarty->display("pages/releases.tpl");
|
||||
|
||||
$smarty->display("parts/footer.tpl");
|
||||
$smarty->display("parts/foot.tpl");
|
Loading…
x
Reference in New Issue
Block a user