summaryrefslogtreecommitdiff
path: root/includes/system/subsystem.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/system/subsystem.php')
-rw-r--r--includes/system/subsystem.php32
1 files changed, 3 insertions, 29 deletions
diff --git a/includes/system/subsystem.php b/includes/system/subsystem.php
index 14d1b2a..372ad08 100644
--- a/includes/system/subsystem.php
+++ b/includes/system/subsystem.php
@@ -73,38 +73,12 @@ function getSubsystemByID(string $id) {
return $subsystem;
}
-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 (getSubsystemByID($subsystemID) === null) header("Location: /?error=Invalid subsystem ID") and die();
$subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystemID.json"), true);
+global $subsystem;
+$subsystem = getSubsystemByID($subsystemID);
+
$title = $subsystemData["name"] . " ยท " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
?>