diff options
Diffstat (limited to 'Neutron-trunk/api/admin/calendar_create.php')
-rw-r--r-- | Neutron-trunk/api/admin/calendar_create.php | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/Neutron-trunk/api/admin/calendar_create.php b/Neutron-trunk/api/admin/calendar_create.php deleted file mode 100644 index 6384528..0000000 --- a/Neutron-trunk/api/admin/calendar_create.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; - -if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/" && strpos($_COOKIE['_NEUTRON_ADMIN_TOKEN'], "/") === false) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { - - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang['api']['token']); - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } - } -} else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang['api']['token']); - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - APIDENY/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } -} - -function isJson($string) { - json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); -} - -$jsonraw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json"); -if (isJson($jsonraw)) { - if (isset($_POST['name'])) { - $name = $_POST['name']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnodesc"]); - } - if (isset($_POST['desc'])) { - $desc = $_POST['desc']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnodesc"]); - } - if (isset($_POST['link'])) { - $link = $_POST['link']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnolink"]); - } - if (isset($_POST['day'])) { - $day = $_POST['day']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnoday"]); - } - if (isset($_POST['month'])) { - $month = $_POST['month']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnomonth"]); - } - if (isset($_POST['year'])) { - $year = $_POST['year']; - } else { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calnoyear"]); - } - $date = strtotime($year . "-" . $month . "-" . $day); - if (($month == "4" || $month == "6" || $month == "9" || $month == "11") && ($day == "31")) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calinvalidday"]); - } - if (($month == "2") && ($day == "30" || $day == "31" || ((bool)date('L', strtotime("$year-01-01")) === false && $day == "29"))) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calinvalidday"]); - } - if ((int)date('Y', $date) < (int)date('Y')) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calpast"]); - } - if (((int)date('m', $date) < (int)date('m')) && ((int)date('Y', $date) == (int)date('Y'))) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calpast"]); - } - if (((int)date('d', $date) < (int)date('d')) && ((int)date('m', $date) == (int)date('m'))) { - require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["calpast"]); - } - $name = str_replace('>', '>', $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 |