From b5f589c323f415bb42ea7069cb4d1a8a2233dd69 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 31 Aug 2022 22:03:07 +0200 Subject: Update I guess - Stuffie --- pages/actions.php | 1132 ++++++++++++++++++++++++++++++++++++++++++++++++++ pages/bitset.php | 32 +- pages/dashboard.php | 299 +++++++++++++ pages/debug.php | 91 ++++ pages/edit.php | 2 +- pages/emergency.php | 2 +- pages/fronting.php | 2 +- pages/nicknames.php | 117 ++++++ pages/parser.php | 2 +- pages/pleasure.php | 2 +- pages/prefix.php | 2 +- pages/rules.php | 254 +++++++++++ pages/score.php | 4 +- pages/splitting.php | 2 +- pages/together.php | 2 +- pages/toys.php | 915 ++++++++++++++++++++++++++++++++++++++++ pages/travelling.php | 4 +- 17 files changed, 2846 insertions(+), 18 deletions(-) create mode 100644 pages/actions.php create mode 100644 pages/dashboard.php create mode 100644 pages/debug.php create mode 100644 pages/nicknames.php create mode 100644 pages/rules.php create mode 100644 pages/toys.php (limited to 'pages') diff --git a/pages/actions.php b/pages/actions.php new file mode 100644 index 0000000..1fa998a --- /dev/null +++ b/pages/actions.php @@ -0,0 +1,1132 @@ + $item) { + if ($item["id"] === $id) { + $selectedIndex = $index; + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/actions"); + die(); + } + + unset($data[$selectedIndex]); + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + header("Location: /-/actions/?d&id=" . $id); + die(); +} + +if (isset($_POST['updateAction'])) { + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + + $selected = null; + $selectedIndex = -1; + $id = $_POST['action']; + + foreach ($data as $index => $item) { + if ($item["id"] === $id) { + $selectedIndex = $index; + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/actions"); + die(); + } + + if (isset($_POST["consent"])) { + $selected["consent"] = true; + } else { + $selected["consent"] = false; + } + + if (isset($_POST["name"])) $selected["name"] = strip_tags(trim($_POST["name"])); + if (isset($_POST["example"])) $selected["example"] = strip_tags(trim($_POST["example"])); + if (isset($_POST["irl"])) $selected["irl"] = strip_tags(trim($_POST["irl"])); + if (isset($_POST["keywords"])) $selected["keywords"] = array_map(function ($i) { + return trim($i); + }, explode(",", strip_tags(trim($_POST["keywords"])))); + if (isset($_POST["description"])) $selected["description"] = strip_tags(trim($_POST["description"])); + if (isset($_POST["type"])) $selected["type"] = match ($_POST["type"]) { + "0" => "affectionate", + "1" => "sexual", + "2" => "mixed" + }; + + if (isset($_POST["relations"])) { + $ponies = []; + + foreach ($_POST["relations"] as $relation => $d) { + $ponies[] = [ + "members" => explode("-", $relation), + "deprecated" => isset($d["deprecated"]), + "sexual" => isset($d["sexual"]) + ]; + } + + $selected["ponies"] = $ponies; + } + + global $_PROFILE; + if ($_PROFILE['login'] === "raindrops" && isset($_POST["verified"])) { + $selected["verified"] = true; + } else { + unset($selected["verified"]); + } + + if (isset($_POST["untested"])) { + $selected["untested"] = true; + } else { + unset($selected["untested"]); + } + + $data[$selectedIndex] = $selected; + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + + header("Location: /-/actions/" . $id); + die(); +} + +if (isset($_POST['createAction'])) { + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + + if (!isset($_POST["name"]) || !isset($_POST["type"])) { + header("Location: /-/actions"); + die(); + } + if (trim($_POST["name"]) === "" || !is_numeric($_POST["type"])) { + header("Location: /-/actions"); + die(); + } + + $type = match ($_POST["type"]) { + "0" => "affectionate", + "1" => "sexual", + "2" => "mixed" + }; + $name = strip_tags(trim($_POST["name"])); + $id = random(); + + $ponies = []; + + if (isset($_POST["relations"])) { + foreach ($_POST["relations"] as $relation => $_) { + $ponies[] = [ + "members" => explode("-", $relation), + "deprecated" => false, + "sexual" => false + ]; + } + } + + if (isset($_POST["consent"])) { + $consent = true; + } else { + $consent = false; + } + + $data[] = [ + "id" => $id, + "name" => $name, + "type" => $type, + "description" => null, + "ponies" => $ponies, + "example" => null, + "irl" => null, + "keywords" => [], + "consent" => $consent + ]; + + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + header("Location: /-/actions/" . $id); + die(); +} + +global $pagename; +$parts = explode("/", $pagename); +$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); +$toys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + +$selected = null; +$title = "Actions database"; + +if (isset($parts[1])) { + $id = $parts[1]; + + foreach ($data as $item) { + if ($item["id"] === $id) { + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/actions/?nf&id=" . $id); + die(); + } else { + $title = $selected["name"] . " · Actions database"; + } +} + +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.php'; + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", "[]"); + +global $_PROFILE; + +?> + + + +
+
+
"> + +
+ + Error: The requested action () was not found, it may have been deleted or has never existed. +
+ + + +
+ + Success: The action with ID has been successfully deleted. +
+ + + + +

+ + Back +

+

+ Edit · + + Affectionate + + + Sexual + + + Affectionate Sexual + + Unverified + Untested +

+ +
+ +
+ This action requires consent. Since this action constitues a sexual act, verbal consent from both parties is absolutely required. Both parties must be in a mental state where they are able to consent. Furthermore, if one of the parties involved wishes to stop, the request must be immediately honoured. +
+ +
+ This action is better with consent. This action is extremely personal to all parties involved, and it is best to ask if they wish to do this. If they ask to stop the action, you must stop immediately and reverse any potential effects. +
+ + + + ", strip_tags($selected["description"]))); ?> + +

No description provided for this action. Enter edit mode to add a description to this action.

+ + + +
+

Available toys:

+ + + +
+ Can be done by: + + +
    +
  • + Affectionately: +
      + +
    • + .png"> + .png"> + + and +
    • + + +
    • + + .png"> + .png"> + + and + + Deprecated +
    • + +
    +
  • +
  • + Sexually: +
      + +
    • + .png"> + .png"> + + and +
    • + + +
    • + + .png"> + .png"> + + and + + Deprecated +
    • + +
    +
  • +
+ +
    + +
  • + .png"> + .png"> + + and +
  • + + +
  • + + .png"> + .png"> + + and + + Deprecated +
  • + +
+ + +
+ + 1; ?> + Example:
+ + +
    + +
  • + +
+ + + + +

No example provided for this action. Enter edit mode to add an example to this action.

+ + +
+ + Steps to reproduce in real life:
+ + + +

This action is not reproducible in real life.

+ + +
+ +

Similar actions

+
+ $action["id"], + "type" => $action["type"], + "ponies" => $action["ponies"] + ]; + } + + foreach ($names as $name => $data) { + if ($data["type"] === $selected["type"] || $selected["type"] !== "affectionate") { + $namesByDistance[] = [ + "name" => $name, + "distance" => levenshtein($currentName, $name) + ((int)($data["type"] !== $selected["type"]) * 2), + "id" => $data["id"], + "type" => $data["type"], + "ponies" => $data["ponies"] + ]; + } + } + + uasort($namesByDistance, function ($a, $b) use ($selected) { + return $a["distance"] - $b["distance"]; + }); + + foreach ($namesByDistance as $item) { + echo(""); + } + + $index = 0; + foreach ($namesByDistance as $item): if ($index < 3): + ?> + + +
+ + + + + +

Actions database

+

actions ( affectionate, sexual, untested, incomplete)

+ +

TODO: add ponies for all actions (+ keywords)

+ + + + + +
+ +
+
+

Not finding what you are looking for? Create an action.

+
+ + + + + + +
+
+ + + + + + + diff --git a/pages/bitset.php b/pages/bitset.php index 11031e2..8c63bc5 100644 --- a/pages/bitset.php +++ b/pages/bitset.php @@ -1,7 +1,7 @@
-

Bitset Calculator

+

Bitset calculator

0
@@ -27,8 +27,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include
0
0
0
-
0
-
0
+
0
+
0
0
0
0
@@ -108,6 +108,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let magic = parseInt(binString.substring(2 + 16, 5 + 16), 2); let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); let ageSpells = binString.substring(31 + 16, 32 + 16) !== "0"; + let nonverbal = binString.substring(15, 16) !== "0"; + let lessFrequent = binString.substring(14, 15) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -125,6 +127,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include document.getElementById("value-13").value = sensitivity; document.getElementById("value-14").value = species3; document.getElementById("value-15").checked = ageSpells; + document.getElementById("value-16").checked = nonverbal; + document.getElementById("value-17").checked = lessFrequent; } } @@ -171,6 +175,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let species2 = binString.substring(21 + 16, 25 + 16); let species3 = binString.substring(25 + 16, 29 + 16); let food = parseInt(binString.substring(16, 2 + 16), 2); + let nonverbal = binString.substring(15, 16) !== "0"; + let lessFrequent = binString.substring(14, 15) !== "0"; let magic = parseInt(binString.substring(2 + 16, 5 + 16), 2); let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); @@ -190,6 +196,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include document.getElementById("value-10").checked = plush; document.getElementById("value-14").value = species3; document.getElementById("value-15").checked = ageSpells; + document.getElementById("value-16").checked = nonverbal; + document.getElementById("value-17").checked = lessFrequent; calculateOutput(); @@ -213,6 +221,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val13 = document.getElementById("value-13").value; let val14 = document.getElementById("value-14").value; let val15 = document.getElementById("value-15").checked; + let val16 = document.getElementById("value-16").checked; + let val17 = document.getElementById("value-17").checked; let val0bin = parseInt(val0).toString(2); val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin; @@ -241,8 +251,10 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val9bin = val9 ? "1" : "0"; let val10bin = val10 ? "1" : "0"; let val15bin = val15 ? "1" : "0"; + let val16bin = val16 ? "1" : "0"; + let val17bin = val17 ? "1" : "0"; - let bin = "0000000000000000" + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; + let bin = "00000000000000" + val17bin + val16bin + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; console.log(bin, parseInt(bin, 2)); @@ -364,7 +376,15 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include +
+
+

diff --git a/pages/dashboard.php b/pages/dashboard.php new file mode 100644 index 0000000..622cd20 --- /dev/null +++ b/pages/dashboard.php @@ -0,0 +1,299 @@ + + +
+
+
+

Date

+ + + + +
+

Next fronters (edit)

+ + +
Fronters today
+
    + $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id); ?> +
  • + .png" style="width:24px; height: 24px; vertical-align: middle;"> + with .png" style="width:24px; height: 24px; vertical-align: middle;"> +
  • + +
+ +
Fronters tomorrow
+
    + $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id); ?> +
  • + .png" style="width:24px; height: 24px; vertical-align: middle;"> + with .png" style="width:24px; height: 24px; vertical-align: middle;"> +
  • + +
+ +
+

Next events

+ parseFile($_SERVER['DOCUMENT_ROOT'] . "/includes/data/calendar.ics"); + $events = []; + + foreach ($cal->getEvents()->sorted() as $event) { + $events[] = [ + "id" => $event['UID'], + "date" => [ + "created" => $event['CREATED']->format('c'), + "modified" => $event['LAST-MODIFIED']->format('c'), + "start" => $event['DTSTART']->format('c'), + "end" => $event['DTEND']->format('c'), + "duration" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')), + "full_day" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400, + "days" => ( + strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400 ? + round((strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c'))) / 86400) : + null + ) + ], + "name" => $event['SUMMARY'], + "description" => $event['DESCRIPTION'], + ]; + } + + $events = array_values(array_filter($events, function ($i) { + return ( + strtotime($i["date"]["end"]) > time() && + strtotime($i["date"]["start"]) < time() + 2629800 + ); + })); + + ?> +
    + +
  • + + + + Started , ends + + + + · + + + + + · + + + for + · + +
  • + +
+
+
+ + + + diff --git a/pages/debug.php b/pages/debug.php new file mode 100644 index 0000000..338a896 --- /dev/null +++ b/pages/debug.php @@ -0,0 +1,91 @@ + "General info about $systemName", + "members" => "Members in the $systemName", + "fronters" => "Current fronter(s) in the $systemName", + "switches" => "Switch history from the $systemName", + default => "$type in $systemName", + }; + } + + if (str_starts_with($item, "images-")) { + $system = explode("-", $item)[1]; + $id = explode("-", $item)[2]; + $systemName = $system === "gdapd" ? "Raindrops" : "Cloudburst"; + $member = getSystemMember($system, $id) ?? [ "name" => $id, "display_name" => $id, "id" => $id ]; + + if ($member["name"] === "unknown") { + return "Unknown (" . $systemName . ")'s images"; + } else { + return getMiniName($member["display_name"] ?? $member["name"]) . "'s images"; + } + } + + return "$item"; +} + +?> + +
+
+ + +
+

Data updater debugging

+

This page provides debugging information to troubleshoot unexpectedly long update times or reported failures.

+ +

General information

+
    +
  • Update date: format("l j F Y, G:i:s.u T")); ?>
  • +
  • Total duration: ms
  • +
  • Longest operation: ( ms, %)
  • +
+ +

Processing times

+
+ $time): ?>%"> +
+
    + $time): ?> +
  • : ms
  • + +
+ +

Reported failures

+ +

The data updater has not reported any update failure in the last run.

+ +

The following files have failed to update:

+
    + +
  • + +
+ +
+
+ + + + diff --git a/pages/edit.php b/pages/edit.php index 74105e2..ae007be 100644 --- a/pages/edit.php +++ b/pages/edit.php @@ -14,7 +14,7 @@ function getSubsystemByID(string $id) { } require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /login") and die(); +if (!$isLoggedIn) header("Location: /-/login") and die(); if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); diff --git a/pages/emergency.php b/pages/emergency.php index 0405bca..ba2a35e 100644 --- a/pages/emergency.php +++ b/pages/emergency.php @@ -1,7 +1,7 @@ +
diff --git a/pages/nicknames.php b/pages/nicknames.php new file mode 100644 index 0000000..050c275 --- /dev/null +++ b/pages/nicknames.php @@ -0,0 +1,117 @@ + $i + ]; + $r["type"] = "marefriends"; + return $r; + }, $member["_metadata"]["marefriends"] ?? []), + ...array_map(function ($i) { + $r = [ + "name" => $i + ]; + $r["type"] = "sisters"; + return $r; + }, $member["_metadata"]["sisters"] ?? []), + ...array_map(function ($i) { + $r = [ + "name" => $i + ]; + $r["type"] = "caretaking"; + return $r; + }, $member["_metadata"]["caretakers"] ?? []) + ] as $rel) { + $id = $rel["name"]; + $otherMember = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); + + $parts = [ + $member["id"], + $otherMember["id"] + ]; + + asort($parts); + + $relations[implode("-", $parts)] = [ + "id" => implode("", $parts), + "name" => getMiniName($member["display_name"] ?? $member["name"]) . " and " . getMiniName($otherMember["display_name"] ?? $otherMember["name"]), + "type" => $rel["type"], + "images" => [ + file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-$member[name].png") ? "/assets/uploads/pt-$member[name].png" : "/assets/uploads/pt.png", + file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-$otherMember[name].png") ? "/assets/uploads/pt-$otherMember[name].png" : "/assets/uploads/pt.png", + ] + ]; + } +} + +$nicknames = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/nicknames.json"), true); + +?> + +
+ + + + + diff --git a/pages/parser.php b/pages/parser.php index cb07179..b49fd00 100644 --- a/pages/parser.php +++ b/pages/parser.php @@ -3,7 +3,7 @@
-

Message Parser

+

Message parser

Enter a message here, and we will tell you which system member this message came from.

diff --git a/pages/pleasure.php b/pages/pleasure.php index db63f5a..295e597 100644 --- a/pages/pleasure.php +++ b/pages/pleasure.php @@ -1,7 +1,7 @@
-

Prefix Generator

+

Prefix generator

This prefix generator will take into account the prefixes from the existing members to try to generate new original prefixes for a potential new member.

diff --git a/pages/rules.php b/pages/rules.php new file mode 100644 index 0000000..b1759dc --- /dev/null +++ b/pages/rules.php @@ -0,0 +1,254 @@ + $rule) { + if (!isset($rule["name"]) || !isset($rule["content"]) && !is_numeric($index)) { + header("Location: /-/rules"); + die(); + } + + if (trim($rule["name"]) === "") { + unset($_POST["payload"][$index]); + continue; + } + + if (!isset($rule["approved"])) $rule["approved"] = []; + if (isset($rule["approved"][0])) $rule["approved"][0] = true; else $rule["approved"][0] = false; + if (isset($rule["approved"][1])) $rule["approved"][1] = true; else $rule["approved"][1] = false; + + $_POST["payload"][$index] = $rule; + } + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules.json", utf8_encode(json_encode($_POST["payload"]))); + + header("Location: /-/rules"); + die(); +} + +$title = "Systems rules"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> + +
+
+
+

Systems rules

+

Click on a rule to view additional details. Edit rules

+ + + +
    + +
  • +
    + + . + + Unapproved + + + +
    + This rule has not yet been approved. All rules need to be approved by the protectors from both systems. This rule is still missing approval from . +
    + +
    class="list-group-item"> + +
    +
    +
  • + +
+
+
+ + + + + + + + diff --git a/pages/score.php b/pages/score.php index 96a9d17..043a695 100644 --- a/pages/score.php +++ b/pages/score.php @@ -1,7 +1,7 @@
-

Score System Testing

+

Score system testing

Raindrops System ( $item) { + if ($item["id"] === $id) { + $selectedIndex = $index; + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/toys"); + die(); + } + + unset($data[$selectedIndex]); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + header("Location: /-/toys/?d&id=" . $id); + die(); +} + +if (isset($_POST['updateAction'])) { + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + + $selected = null; + $selectedIndex = -1; + $id = $_POST['action']; + + foreach ($data as $index => $item) { + if ($item["id"] === $id) { + $selectedIndex = $index; + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/toys"); + die(); + } + + if (isset($_POST["sexual"])) { + $selected["sexual"] = true; + } else { + $selected["sexual"] = false; + } + + if (isset($_POST["name"])) $selected["name"] = strip_tags(trim($_POST["name"])); + if (isset($_POST["usage"])) $selected["usage"] = strip_tags(trim($_POST["usage"])); + if (isset($_POST["irl"])) $selected["irl"] = strip_tags(trim($_POST["irl"])); + if (isset($_POST["keywords"])) $selected["keywords"] = array_map(function ($i) { + return trim($i); + }, explode(",", strip_tags(trim($_POST["keywords"])))); + if (isset($_POST["description"])) $selected["description"] = strip_tags(trim($_POST["description"])); + if (isset($_POST["water"])) $selected["water"] = match ($_POST["water"]) { + "0" => "out", + "1" => "in", + "2" => "both", + "3" => "playground" + }; + + if (isset($_POST["relations"])) { + $ponies = []; + + foreach ($_POST["relations"] as $relation => $d) { + $ponies[] = [ + "members" => explode("-", $relation), + "deprecated" => isset($d["deprecated"]), + "sexual" => isset($d["sexual"]) + ]; + } + + $selected["ponies"] = $ponies; + } + + global $_PROFILE; + if ($_PROFILE['login'] === "raindrops" && isset($_POST["verified"])) { + $selected["verified"] = true; + } else { + unset($selected["verified"]); + } + + if (isset($_POST["untested"])) { + $selected["untested"] = true; + } else { + unset($selected["untested"]); + } + + $data[$selectedIndex] = $selected; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + + header("Location: /-/toys/" . $id); + die(); +} + +if (isset($_POST['createAction'])) { + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + + if (!isset($_POST["name"]) || !isset($_POST["water"])) { + header("Location: /-/toys"); + die(); + } + if (trim($_POST["name"]) === "" || !is_numeric($_POST["water"])) { + header("Location: /-/toys"); + die(); + } + + $water = match ($_POST["water"]) { + "0" => "out", + "1" => "in", + "2" => "both", + "3" => "playground" + }; + $name = strip_tags(trim($_POST["name"])); + $id = random(); + + $ponies = []; + + if (isset($_POST["relations"])) { + foreach ($_POST["relations"] as $relation => $_) { + $ponies[] = [ + "members" => explode("-", $relation), + "deprecated" => false + ]; + } + } + + if (isset($_POST["sexual"])) { + $sexual = true; + } else { + $sexual = false; + } + + $data[] = [ + "id" => $id, + "name" => $name, + "water" => $water, + "description" => null, + "ponies" => $ponies, + "usage" => null, + "irl" => null, + "keywords" => [], + "sexual" => $sexual + ]; + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + header("Location: /-/toys/" . $id); + die(); +} + +global $pagename; +$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]; + + foreach ($data as $item) { + if ($item["id"] === $id) { + $selected = $item; + break; + } + } + + if ($selected === null) { + header("Location: /-/toys/?nf&id=" . $id); + die(); + } else { + $title = $selected["name"] . " · Toys database"; + } +} + +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.php'; + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", "[]"); + +global $_PROFILE; + +?> + + + +
+
+
"> + +
+ + Error: The requested toy () was not found, it may have been deleted or has never existed. +
+ + + +
+ + Success: The toy with ID has been successfully deleted. +
+ + + + +

+ + Back +

+

+ Edit · + + Sexual + + Pleasurable + + Unverified + Untested + + Underwater + + Outside of water + + In playground + + Underwater + Outside of water + +

+ + + ", strip_tags($selected["description"]))); ?> + +

No description provided for this toy. Enter edit mode to add a description to this toy.

+ + +
+ Can be used by: + +
    + +
  • + .png"> + .png"> + + and +
  • + + +
  • + + .png"> + .png"> + + and + + Deprecated +
  • + +
+ +
+ + Usage:
+ + 1) echo("
    "); + + foreach ($lines as $line) { + if (count($lines) > 1) echo("
  • "); + + $parts = explode(":", $line); + + if (count($parts) > 1 && strlen($parts[0]) < 30) { + $p0 = $parts[0]; array_shift($parts); + echo(replaceKeyWords("" . $p0 . ":" . implode(":", $parts))); + } else { + echo(replaceKeyWords(implode(":", $parts))); + } + + if (count($lines) > 1) echo("
  • "); + } + + if (count($lines) > 1) echo("
"); + + ?> + +

No usage provided for this toy. Enter edit mode to add usage information to this toy.

+ + +
+ + Instructions to craft in real life:
+ + + +

This toy is not craftable in real life.

+ + +
+ +

Similar toys

+
+ $action["id"], + "water" => $action["water"], + "ponies" => $action["ponies"] + ]; + } + + foreach ($names as $name => $data) { + $namesByDistance[] = [ + "name" => $name, + "distance" => levenshtein($currentName, $name) + ((int)($data["type"] !== $selected["type"]) * 2), + "id" => $data["id"], + "water" => $data["water"], + "ponies" => $data["ponies"] + ]; + } + + uasort($namesByDistance, function ($a, $b) use ($selected) { + return $a["distance"] - $b["distance"]; + }); + + foreach ($namesByDistance as $item) { + echo(""); + } + + $index = 0; + foreach ($namesByDistance as $item): if ($index < 3): + ?> + + +
+ + + + + +

Toys database

+

toys ( non-sexual, sexual, untested, incomplete)

+ + + + + +
+ +
+
+

Not finding what you are looking for? Add a toy.

+
+ + + + + + +
+
+ + + + + + + diff --git a/pages/travelling.php b/pages/travelling.php index affe92e..c40ebab 100644 --- a/pages/travelling.php +++ b/pages/travelling.php @@ -1,7 +1,7 @@
-

System Travelling

+

System travelling