";
}
if (isset($metadata["sleep_plush"]) && $metadata["sleep_plush"] && !$isLowerLoggedIn) {
return "";
}
return "";
}
foreach ($cloudburst as $id => $day) {
foreach ($day as $index => $fronter) {
if (is_string($fronter)) {
$cloudburst[$id][$index] = [$fronter];
} else if (is_array($fronter)) {
if (count($fronter) < 2) {
if (!isset($cloudburst[$id][$index][0])) $cloudburst[$id][$index][0] = null;
$cloudburst[$id][$index][1] = null;
} else if (count($fronter) > 2) {
$array = [];
if (isset($cloudburst[$id][$index][0])) {
$array[0] = $cloudburst[$id][$index][0];
} else {
$array[0] = null;
}
if (isset($cloudburst[$id][$index][1])) {
$array[1] = $cloudburst[$id][$index][1];
} else {
$array[1] = null;
}
$cloudburst[$id][$index] = $array;
}
}
}
}
foreach ($raindrops as $id => $day) {
foreach ($day as $index => $fronter) {
if (is_string($fronter)) {
$raindrops[$id][$index] = [$fronter];
} else if (is_array($fronter)) {
if (count($fronter) < 2) {
if (!isset($raindrops[$id][$index][0])) $raindrops[$id][$index][0] = null;
$raindrops[$id][$index][1] = null;
} else if (count($fronter) > 2) {
$array = [];
if (isset($raindrops[$id][$index][0])) {
$array[0] = $raindrops[$id][$index][0];
} else {
$array[0] = null;
}
if (isset($raindrops[$id][$index][1])) {
$array[1] = $raindrops[$id][$index][1];
} else {
$array[1] = null;
}
$raindrops[$id][$index] = $array;
}
}
}
}
$school = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json"), true);
function formatTime($time) {
if ($time === "0:00") return "midnight";
if ($time === "12:00") return "noon";
$parts = explode(":", $time);
$hours = (int)$parts[0];
$ampm = "";
if ($hours === 0 || $hours === 12) {
$ampm = ($hours === 0 ? "am" : "pm");
$hours = 12;
} else {
if ($hours > 12) {
$ampm = "pm";
$hours = $hours - 12;
} else {
$ampm = "am";
}
}
if ((int)$parts[1] > 0) {
return $hours . ":" . $parts[1] . $ampm;
} else {
return $hours . $ampm;
}
}
function school($time, $first = false) {
global $school;
global $_PROFILE;
global $isLowerLoggedIn;
$day = date('Y-m-d', $time);
$parts = [];
if (isset($school[$day])) {
if (isset($school[$day]["wakeUp"]["timestamp"])) {
$parts[] = "waking up at " . formatTime($school[$day]["wakeUp"][$_PROFILE["login"]]);
}
if (isset($school[$day]["sleep"]["timestamp"])) {
$parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]);
}
}
if ($isLowerLoggedIn) $parts = [];
if (count($parts) > 0) {
if ($first) {
return ucfirst(implode(", ", $parts));
} else {
return "
" . ucfirst(implode(", ", $parts));
}
} else {
if ($first) {
return "-";
} else {
return "";
}
}
}
function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; global $isLowerLoggedIn; ?>