From 529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 24 Aug 2021 15:38:16 +0200 Subject: Update --- Neutron-trunk/api/admin/calendar_create.php | 155 ++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 Neutron-trunk/api/admin/calendar_create.php (limited to 'Neutron-trunk/api/admin/calendar_create.php') diff --git a/Neutron-trunk/api/admin/calendar_create.php b/Neutron-trunk/api/admin/calendar_create.php new file mode 100644 index 0000000..eff4682 --- /dev/null +++ b/Neutron-trunk/api/admin/calendar_create.php @@ -0,0 +1,155 @@ + +', '>', $name); + $name = str_replace('<', '<', $name); + if (strlen($name) > 75) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnamelong"]); + } + if (trim($name) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnamenone"]); + } + $desc = str_replace('>', '>', $desc); + $desc = str_replace('<', '<', $desc); + if ($day == "1") { + $daystr = $lang["api"]["calordinal"]; + } else { + $daystr = $day; + } + if ($month == "01") { + $monthstr = $lang["api"]["calminmonths"][0]; + } + if ($month == "02") { + $monthstr = $lang["api"]["calminmonths"][1]; + } + if ($month == "03") { + $monthstr = $lang["api"]["calminmonths"][2]; + } + if ($month == "04") { + $monthstr = $lang["api"]["calminmonths"][3]; + } + if ($month == "05") { + $monthstr = $lang["api"]["calminmonths"][4]; + } + if ($month == "06") { + $monthstr = $lang["api"]["calminmonths"][5]; + } + if ($month == "07") { + $monthstr = $lang["api"]["calminmonths"][6]; + } + if ($month == "08") { + $monthstr = $lang["api"]["calminmonths"][7]; + } + if ($month == "09") { + $monthstr = $lang["api"]["calminmonths"][8]; + } + if ($month == "10") { + $monthstr = $lang["api"]["calminmonths"][9]; + } + if ($month == "11") { + $monthstr = $lang["api"]["calminmonths"][10]; + } + if ($month == "12") { + $monthstr = $lang["api"]["calminmonths"][11]; + } + $json = json_decode($jsonraw); + foreach($json->events as $event) { + if (isset($event->timestamp)) { + if ($event->timestamp == $year . date('m', $date) . date('d', $date)) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calsameday"]); + } + } + } + $pos = count($json->events); + $json->events[$pos] = new stdClass(); + $json->events[$pos]->timestamp = $year . date('m', $date) . date('d', $date); + $json->events[$pos]->name = $name; + $json->events[$pos]->description = $desc; + if (substr($link, 0, 4) == "http") { + $json->events[$pos]->link = $link; + } else { + $json->events[$pos]->link = "http://" . $link; + } + $json->events[$pos]->datestr = $daystr . " " . $monthstr . " " . $year; + $newjsonraw = json_encode($json, JSON_PRETTY_PRINT); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json", $newjsonraw); + require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calerror"]); +} \ No newline at end of file -- cgit