blob: aef4ac6715fbab5a443ba5c9503dec81ad377877 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
if (!$isLoggedIn) header("Location: /-/login") and die();
header("Content-Type: application/json");
$obj = [
"raindrops" => null,
"cloudburst" => null
];
foreach (["raindrops", "cloudburst"] as $userName) {
$allowNsfw = null;
$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($userName === "raindrops" ? "gdapd" : "ynmuc") . "/fronters.json"), true);
if (count($fronters["members"]) > 0) {
$id = $fronters["members"][0]["id"];
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json")) {
$info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true);
if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 15 && $info["birth"]["age"] > 0) {
$allowNsfw = false;
} else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) {
if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01";
$age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1);
if ($age < 15) {
$allowNsfw = false;
} else {
$allowNsfw = true;
}
} else if ((!isset($info["birth"]["age"]) || $info["birth"]["age"] === 0) && (!isset($info["birth"]["year"]) || $info["birth"]["year"] > 1900)) {
$allowNsfw = false;
} else {
$allowNsfw = true;
}
}
}
$obj[$userName] = $allowNsfw;
}
die(json_encode($obj, JSON_PRETTY_PRINT));
|