From 108525534c28013cfe1897c30e4565f9893f3766 Mon Sep 17 00:00:00 2001 From: Minteck Date: Mon, 10 Oct 2022 20:51:39 +0200 Subject: Update --- pages/actions.php | 1130 ----------------------------------------------------- 1 file changed, 1130 deletions(-) delete mode 100644 pages/actions.php (limited to 'pages/actions.php') diff --git a/pages/actions.php b/pages/actions.php deleted file mode 100644 index 939ed7e..0000000 --- a/pages/actions.php +++ /dev/null @@ -1,1130 +0,0 @@ - $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; - -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"] . " · " . $title; - } -} - -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.

-
- - - - - - -
-
- - - - - - - -- cgit