', '>', $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"]); }