"Untitled document ($id)", "category" => null, "contents" => "
This is a new document you just created.
", "last" => [ "author" => $_PROFILE["login"], "date" => time() ] ])); header("Location: /-/docs/$id"); die(); } elseif (isset($select)) { if (ctype_alnum($select) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json")) { $id = $select; $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json"), true); $titleBase = " · " . $title . " · Cold Haze"; $title = $data["name"] . " · " . $title; } else { header("Location: /-/docs"); die(); } } require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?>

Back

Category:

Last modified never Last modified "> by · Saved

Documents

substr($i, 0, -5), ...(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $i), true) ?? []) ]; }, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs"), function ($i) { return !str_starts_with($i, ".") && str_ends_with($i, ".json"); })); $deletable = array_values(array_filter($documents, function ($i) { return strip_tags($i["contents"]) === "/delete"; })); $unsorted_pre = array_values(array_filter($documents, function ($i) { return strip_tags($i["contents"]) !== "/delete"; })); $unsorted = []; $categories = []; foreach ($unsorted_pre as $item) { if (isset($item["category"])) { $existing_categories = array_keys($categories); $matched_category = null; foreach ($existing_categories as $existing_category) { if (levenshtein($item["category"], $existing_category) < 3) { $matched_category = $existing_category; } } $selected_category = $matched_category ?? $item["category"]; if (!isset($categories[$selected_category])) $categories[$selected_category] = []; $categories[$selected_category][] = $item; } else { $unsorted[] = $item; } } uasort($unsorted, function ($a, $b) { return $b["last"]["date"] - $a["last"]["date"]; }); uasort($deletable, function ($a, $b) { return $b["last"]["date"] - $a["last"]["date"]; }); ?> $items): ?>


Unsorted


Marked for deletion