diff options
author | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
commit | e95b208af90cc386a7d8d1bcab426727cf4f0121 (patch) | |
tree | b293e0c644513fbeb6e9ad29be97fa6347a55e9f /pages/toys.php | |
parent | b5f589c323f415bb42ea7069cb4d1a8a2233dd69 (diff) | |
download | pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.gz pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.bz2 pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.zip |
Update time
Diffstat (limited to 'pages/toys.php')
-rw-r--r-- | pages/toys.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/pages/toys.php b/pages/toys.php index e4e5def..e0fb1fe 100644 --- a/pages/toys.php +++ b/pages/toys.php @@ -1,7 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; if (isset($_POST['deleteAction'])) { $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); @@ -164,7 +163,6 @@ $parts = explode("/", $pagename); $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); $selected = null; -$title = "Toys database"; if (isset($parts[1])) { $id = $parts[1]; @@ -180,7 +178,7 @@ if (isset($parts[1])) { header("Location: /-/toys/?nf&id=" . $id); die(); } else { - $title = $selected["name"] . " · Toys database"; + $title = $selected["name"] . " · " . $title; } } @@ -220,18 +218,18 @@ global $_PROFILE; </h2> <p> <a onclick="event.target.blur();" data-bs-toggle="modal" data-bs-target="#editor" href="#">Edit</a> · - <?php if ($item["sexual"]): ?> + <?php if ($selected["sexual"]): ?> <span style="" class="badge rounded-pill bg-danger">Sexual</span> <?php else: ?> <span style="" class="badge rounded-pill bg-success">Pleasurable</span> <?php endif; ?> - <?php if (!isset($item["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> - <?php if (isset($item["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> - <?php if ($item["water"] === "in"): ?> + <?php if (!isset($selected["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> + <?php if (isset($selected["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> + <?php if ($selected["water"] === "in"): ?> <span style="" class="badge rounded-pill bg-primary">Underwater</span> - <?php elseif ($item["water"] === "out"): ?> + <?php elseif ($selected["water"] === "out"): ?> <span style="background-color:#d63384;" class="badge rounded-pill">Outside of water</span> - <?php elseif ($item["water"] === "playground"): ?> + <?php elseif ($selected["water"] === "playground"): ?> <span class="badge rounded-pill" style="background-color:#20c997;">In playground</span> <?php else: ?> <span style="" class="badge rounded-pill bg-primary">Underwater</span> @@ -356,17 +354,19 @@ global $_PROFILE; if ($action["name"] !== $currentName) $names[$action["name"]] = [ "id" => $action["id"], "water" => $action["water"], - "ponies" => $action["ponies"] + "ponies" => $action["ponies"], + "sexual" => $action["sexual"] ]; } foreach ($names as $name => $data) { $namesByDistance[] = [ "name" => $name, - "distance" => levenshtein($currentName, $name) + ((int)($data["type"] !== $selected["type"]) * 2), + "distance" => levenshtein($currentName, $name) + ((int)($data["water"] !== $selected["water"]) * 2), "id" => $data["id"], "water" => $data["water"], - "ponies" => $data["ponies"] + "ponies" => $data["ponies"], + "sexual" => $data["sexual"] ]; } @@ -382,7 +382,7 @@ global $_PROFILE; foreach ($namesByDistance as $item): if ($index < 3): ?> <div class="col-md-4" style="margin-bottom:20px;"> - <a class="linked-card" href="/-/actions/<?= $item["id"] ?>"><div class="card"> + <a class="linked-card" href="/-/toys/<?= $item["id"] ?>"><div class="card"> <div class="card-body"> <h4 class="card-title"><?= $item["name"] ?></h4> <p class="card-text"> @@ -522,7 +522,7 @@ global $_PROFILE; foreach ($relations as $id => $relation): ?> - <label style="display:block;" class="creator-relation <?= $selected["type"] === "mixed" ? "mixed" : "" ?> <?= in_array($id, $inFileRelations) ? "checked" : "" ?>"> + <label style="display:block;" class="creator-relation <?= in_array($id, $inFileRelations) ? "checked" : "" ?>"> <input <?= in_array($id, $inFileRelations) ? "checked" : "" ?> name="relations[<?= $id ?>][member]" style="display:none;" type="checkbox" class="checkbox-input"> <img style="vertical-align: middle;width:24px;height:24px;" src="<?= $relation["images"][0] ?>"> |