diff options
Diffstat (limited to 'includes/edit.php')
-rw-r--r-- | includes/edit.php | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/includes/edit.php b/includes/edit.php index 85382a0..5bbd38a 100644 --- a/includes/edit.php +++ b/includes/edit.php @@ -1,36 +1,9 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " (public page) · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; -function timeAgo($time): string { - if (!is_numeric($time)) { - $time = strtotime($time); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json")) { + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); } -$metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); - ?> <br> @@ -42,8 +15,8 @@ $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT' <script src="/app/banner.js"></script><script>refreshBanner()</script> <br> - <p class="text-muted"> - <span id="editor-save-status">Saved</span> · <span id="editor-size"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-disclaimers.html") ? strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-disclaimers.html")) : "0" ?></span> bytes + <p class="text-muted" id="page-content"> + <span id="editor-save-status" class="text-muted">Saved</span> · <span id="editor-size"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html") ? strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html")) : "0" ?></span> bytes · <a href="/<?= $memberData["name"] ?>">View page</a> </p> <!--suppress HtmlFormInputWithoutLabel --> @@ -166,10 +139,6 @@ $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT' } } else { timeSinceLastModified = 0; - document.getElementById("editor-save-status").innerHTML = "Saved"; - document.getElementById("editor-save-status").classList.add("text-muted"); - document.getElementById("editor-save-status").classList.remove("text-warning"); - document.getElementById("editor-save-status").classList.remove("text-primary"); } }, 100) </script> |