diff options
Diffstat (limited to 'Neutron-trunk/api/admin')
27 files changed, 1664 insertions, 0 deletions
diff --git a/Neutron-trunk/api/admin/appearance.php b/Neutron-trunk/api/admin/appearance.php new file mode 100644 index 0000000..28ebe74 --- /dev/null +++ b/Neutron-trunk/api/admin/appearance.php @@ -0,0 +1,194 @@ +<?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'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { +if (isset($_POST['sitename'])) { + if (trim($_POST['sitename']) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamenone"]); + } + if (strpos($_POST['sitename'], '<') !== false || strpos($_POST['sitename'], '>') !== false || strpos($_POST['sitename'], '{') !== false || strpos($_POST['sitename'], '}') !== false || strpos($_POST['sitename'], '@') !== false || strpos($_POST['sitename'], '#') !== false || strpos($_POST['sitename'], '|') !== false) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenameinvalid"]); + } + if (strlen($_POST['sitename']) > 75) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamelong"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["sitenamerecv"]); +} + +if (isset($_POST['alwaysmenu'])) { + (string)$am = $_POST['alwaysmenu']; +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["awmnone"]); +} + +if (isset($_POST['oldrenderer'])) { + (string)$or = $_POST['oldrenderer']; +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["olrnone"]); +} + +if (isset($_POST['showpages'])) { + (integer)$sp = $_POST['showpages']; +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["swpnone"]); +} + +if ($am == "true") { + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu")) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu", ""); + } +} else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu")) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/alwaysmenu"); + } +} +// var_dump($or);require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); +if ($or == "true") { + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer")) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer", ""); + } +} else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer")) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer"); + } +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagesInMenuBar", $sp); + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_FILES['icon'])) { + if ($_FILES['icon']['error'] == 1) { + $maxsize = ini_get('upload_max_filesize'); + if ($maxsize > 1000) { + if ($maxsize > 1000000) { + $maxsizestr = round($maxsize / 1000000, 2) . " " . $lang["sizes"]["mib"]; + } else { + $maxsizestr = round($maxsize / 1000, 2) . " " . $lang["sizes"]["kib"]; + } + } else { + $maxsizestr = $maxsize . " " . $lang["sizes"]["bytes"]; + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filesize"] . " ({$maxsizestr})"); + } + if ($_FILES['icon']['error'] == 2) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); + } + if ($_FILES['icon']['error'] == 3) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); + } + if ($_FILES['icon']['error'] == 4) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); + } + if ($_FILES['icon']['error'] == 6) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); + } + if ($_FILES['icon']['error'] == 7) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriterror"]); + } + if ($_FILES['icon']['error'] == 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); + } + if ($_FILES['icon']['type'] != "image/png" && $_FILES['icon']['type'] != "image/jpeg" && $_FILES['icon']['type'] != "image/gif") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filemime2"]); + } + if ($_FILES['icon']['error'] == 0) { + imagepng(imagecreatefromstring(file_get_contents($_FILES['icon']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"); + if ($_FILES['icon']['type'] == "image/png") { + copy($_FILES['icon']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png"); + } else { + copy($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png", $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png"); + } + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/favicon.php"; + unlink($_FILES['icon']['tmp_name']); + } +} + +if (isset($_FILES['banner'])) { + if ($_FILES['banner']['error'] == 1) { + $maxsize = ini_get('upload_max_filesize'); + if ($maxsize > 1000) { + if ($maxsize > 1000000) { + $maxsizestr = round($maxsize / 1000000, 2) . " " . $lang["sizes"]["mib"]; + } else { + $maxsizestr = round($maxsize / 1000, 2) . " " . $lang["sizes"]["kib"]; + } + } else { + $maxsizestr = $maxsize . " " . $lang["sizes"]["bytes"]; + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filesize"] . " ({$maxsizestr})"); + } + if ($_FILES['banner']['error'] == 2) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); + } + if ($_FILES['banner']['error'] == 3) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); + } + if ($_FILES['banner']['error'] == 4) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); + } + if ($_FILES['banner']['error'] == 6) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); + } + if ($_FILES['banner']['error'] == 7) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriterror"]); + } + if ($_FILES['banner']['error'] == 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); + } + if ($_FILES['banner']['type'] != "image/png" && $_FILES['banner']['type'] != "image/jpeg" && $_FILES['banner']['type'] != "image/gif") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filemime2"]); + } + if ($_FILES['banner']['error'] == 0) { + imagejpeg(imagecreatefromstring(file_get_contents($_FILES['banner']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg"); + $img = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg"); + $width = imagesx($img); + $height = imagesy($img); + $x_step = intval($width/$num_samples); + $y_step = intval($height/$num_samples); + $total_lum = 0; + $sample_no = 1; + for ($x=0; $x<$width; $x+=$x_step) { + for ($y=0; $y<$height; $y+=$y_step) { + $rgb = imagecolorat($img, $x, $y); + $r = ($rgb >> 16) & 0xFF; + $g = ($rgb >> 8) & 0xFF; + $b = $rgb & 0xFF; + $lum = ($r+$r+$b+$g+$g+$g)/6; + $total_lum += $lum; + $sample_no++; + } + } + $avg_lum = $total_lum / $sample_no; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/banner.mtd", ($avg_lum / 255) * 100); + unlink($_FILES['banner']['tmp_name']); + } +} + +$sitename = str_replace('>', '>', $_POST['sitename']); +$sitename = str_replace('<', '<', $sitename); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename", $sitename); +require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; +echo("ok"); +} else { + 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 { + 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"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/cache_content_reset.php b/Neutron-trunk/api/admin/cache_content_reset.php new file mode 100644 index 0000000..6e9e02b --- /dev/null +++ b/Neutron-trunk/api/admin/cache_content_reset.php @@ -0,0 +1,14 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache")) { + $dir = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache"); + foreach ($dir as $file) { + if (!($file == "." || $file == ".." || $file == ".htaccess")) { + if (substr($file, 0, 5) == "page-") { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/$file"); + } + } + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/cache_pages_update.php b/Neutron-trunk/api/admin/cache_pages_update.php new file mode 100644 index 0000000..3122731 --- /dev/null +++ b/Neutron-trunk/api/admin/cache_pages_update.php @@ -0,0 +1,72 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +$customSettings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")); +global $cache; +$cache = ""; + +function append(string $text) { + global $cache; + $cache = $cache . $text; +} + +function compareASCII($a, $b) { + $at = iconv('UTF-8', 'ASCII//TRANSLIT', $a); + $bt = iconv('UTF-8', 'ASCII//TRANSLIT', $b); + return strcmp($at, $bt); +} + +$pages = scandir($_SERVER['DOCUMENT_ROOT']); +uasort($pages, 'compareASCII'); +$index = 0; +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {$index = 1;} +append("@home|@indexHomeIcon"); +foreach ($pages as $page) { + if ((($page != ".." && $page != ".") && $index < 6) && (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) && (!in_array($page, $customSettings->hiddenPages))) { + append("\n{$page}|" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")); + $index++; + } +} +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) { + append("\n@galery|" . $lang["viewer"]["galery"]); +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd", $cache); + +$cache = ""; +$index = 0; +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {$index = 1;} +append("@home|@indexHomeIcon"); +foreach ($pages as $page) { + if ((($page != ".." && $page != ".")) && (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) && (!in_array($page, $customSettings->hiddenPages))) { + append("\n{$page}|" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")); + $index++; + } +} +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) { + append("\n@galery|" . $lang["viewer"]["galery"]); +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd", $cache); + +/* --------------------------- */ +// Backwards compatibility with the old engine-cyclic +$cache = ""; + +$pages = scandir($_SERVER['DOCUMENT_ROOT']); +uasort($pages, 'compareASCII'); +foreach ($pages as $page) { + if ($page != ".." && $page != ".") { + if (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) { + if (!in_array($page, $customSettings->hiddenPages)) { + append("<a href=\"/{$page}\" title=\"/{$page}\" class=\"menulink-desktop\">" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") . "</a>"); + } + } + } + } +} +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {append("<a href=\"/cms-special/gallery\" title=\"/cms-special/gallery\" class=\"menulink-desktop\">" . $lang["viewer"]["galery"] . "</a>");} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-old.mtd", $cache);
\ No newline at end of file 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 @@ +<?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'] != "/") { + 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 diff --git a/Neutron-trunk/api/admin/calendar_delete.php b/Neutron-trunk/api/admin/calendar_delete.php new file mode 100644 index 0000000..edeb86d --- /dev/null +++ b/Neutron-trunk/api/admin/calendar_delete.php @@ -0,0 +1,64 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['id'])) { + $id = $_POST['id']; +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenoid"]); +} + +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)) { + $json = json_decode($jsonraw); + $pos = -1; + foreach ($json->events as $stdClass) { + $pos = $pos + 1; + if (isset($stdClass->timestamp)) { + if ($stdClass->timestamp == $id) { + unset($json->events[$pos]->timestamp); + unset($json->events[$pos]->datestr); + unset($json->events[$pos]->name); + unset($json->events[$pos]->description); + } + } + } + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json", json_encode($json, JSON_PRETTY_PRINT)); + 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("CalDb1: ParseError: Unable to open database, JSON parse failed. Data might be corrupted"); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/calendar_nextevents.php b/Neutron-trunk/api/admin/calendar_nextevents.php new file mode 100644 index 0000000..6dc0cae --- /dev/null +++ b/Neutron-trunk/api/admin/calendar_nextevents.php @@ -0,0 +1,36 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['value'])) { + if (is_int((int)$_POST['value'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/calendar_events", $_POST['value']); + 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"]["valueinv"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["valuenone"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/create_page.php b/Neutron-trunk/api/admin/create_page.php new file mode 100644 index 0000000..f7d67e7 --- /dev/null +++ b/Neutron-trunk/api/admin/create_page.php @@ -0,0 +1,90 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['type'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnotype"]); +} + +if (isset($_POST['title'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnotitle"]); +} + +if (isset($_POST['content'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnocontent"]); +} + +$title = $_POST['title']; +$title = str_replace('>', '>', $title); +$title = str_replace('<', '<', $title); +if (substr($title, 0, 1) == " " || substr($title, 0, 1) == "-" || substr($title, 0, 1) == " " || substr($title, 0, 1) == "_" || substr($title, 0, 1) == "@" || substr($title, 0, 1) == "|" || substr($title, 0, 1) == "'" || substr($title, 0, 1) == "\"" || substr($title, 0, 1) == "~" || substr($title, 0, 1) == "&" || substr($title, 0, 1) == "=") { + $prefixed = true; +} else { + $prefixed = false; +} +$type = $_POST['type']; +$content = $_POST['content']; + +$slug = preg_replace("/[^0-9a-zA-Z ]/m", "", $title ); +$slug = str_replace(" ", "-", $slug); +$slug = strtolower($slug); + +if ($prefixed) { + $slug = "-" . $slug; +} + +if (trim($title) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgtitleempty"]); +} + +if ($slug == "api" || $slug == "cms-special" || $slug == "galery" || $slug == "cms-unrelated" || $slug == "vendor" || $slug == "data" || $slug == "resources" || $slug == "widgets" || $slug == "-htaccess" || $slug == "index" || $slug == "index-php") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameinternal"]); +} + +if (strlen($slug) > 70) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnamelong"]); +} + +if ($type != "0" && $type != "1") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgtypenone"]); +} + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $slug)) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameexists"]); +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $slug, $content); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $slug, $type); +mkdir($_SERVER['DOCUMENT_ROOT'] . "/" . $slug); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $slug . "/index.php", '<?php require_once "../resources/private/relative.php"; getRelativeDetails("' . $slug . '"); ?><?php require_once $_SERVER[\'DOCUMENT_ROOT\'] . "/api/engine-cyclic/render.php"; render(\'' . $slug . '\'); ?>'); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $slug . "/pagename", $title); +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php"; +require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/customization_colors.php b/Neutron-trunk/api/admin/customization_colors.php new file mode 100644 index 0000000..9e650e8 --- /dev/null +++ b/Neutron-trunk/api/admin/customization_colors.php @@ -0,0 +1,32 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['color'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color", $_POST['color']); + 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"]["nocolor"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/customization_theme.php b/Neutron-trunk/api/admin/customization_theme.php new file mode 100644 index 0000000..cc4d081 --- /dev/null +++ b/Neutron-trunk/api/admin/customization_theme.php @@ -0,0 +1,32 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['theme'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme", $_POST['theme']); + 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"]["notheme"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/delete_page.php b/Neutron-trunk/api/admin/delete_page.php new file mode 100644 index 0000000..beaf8f0 --- /dev/null +++ b/Neutron-trunk/api/admin/delete_page.php @@ -0,0 +1,47 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['page'])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $_POST['page'])) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $_POST['page'] . "/index.php"); + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $_POST['page'] . "/pagename"); + rmdir($_SERVER['DOCUMENT_ROOT'] . "/" . $_POST['page']); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $_POST['page']); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $_POST['page']); + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php"; + 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"]["pgnotfound"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pageselect"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/edit_page.php b/Neutron-trunk/api/admin/edit_page.php new file mode 100644 index 0000000..17d84bb --- /dev/null +++ b/Neutron-trunk/api/admin/edit_page.php @@ -0,0 +1,42 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} +if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { + if (isset($_POST['content'])) { + if (isset($_POST['title'])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $_POST['title'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $_POST['title'], $_POST['content']); + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php"; + 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"]["pgnotfound"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pageselect"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang['api']['inforec']); + } + } else { + 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 { + 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"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/flag_disable.php b/Neutron-trunk/api/admin/flag_disable.php new file mode 100644 index 0000000..d15b667 --- /dev/null +++ b/Neutron-trunk/api/admin/flag_disable.php @@ -0,0 +1,43 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['element'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["select"]); +} + +if (strpos($_POST['element'], ".")) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Flags Names cannot contain periods"); +} + +@unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/flag_" . $_POST['element']); + +require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/flag_enable.php b/Neutron-trunk/api/admin/flag_enable.php new file mode 100644 index 0000000..0f2a9f4 --- /dev/null +++ b/Neutron-trunk/api/admin/flag_enable.php @@ -0,0 +1,43 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['element'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["select"]); +} + +if (strpos($_POST['element'], ".")) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Flags Names cannot contain periods"); +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/flag_" . $_POST['element'], ""); + +require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/footer.php b/Neutron-trunk/api/admin/footer.php new file mode 100644 index 0000000..5422d0c --- /dev/null +++ b/Neutron-trunk/api/admin/footer.php @@ -0,0 +1,33 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} +if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { + if (isset($_POST['footer'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/footer", $_POST['footer']); + 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']['inforec']); + } + } else { + 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 { + 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"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_create_category.php b/Neutron-trunk/api/admin/galery_create_category.php new file mode 100644 index 0000000..a849d05 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_create_category.php @@ -0,0 +1,47 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['category'])) { + $category = trim($_POST['category']); + $category = str_replace('>', '>', $category); + $category = str_replace('<', '<', $category); +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["mkcatnoname"]); +} + +$slug = preg_replace("/[^0-9a-zA-Z ]/m", "", $category ); +$slug = str_replace(" ", "-", $slug); +$slug = strtolower($slug); + +if ($slug == "unclassed") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameinternal"]); +} + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $slug)) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["mkcatexists"]); +} else { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $slug, $category); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_delete_category.php b/Neutron-trunk/api/admin/galery_delete_category.php new file mode 100644 index 0000000..603a5d0 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_delete_category.php @@ -0,0 +1,52 @@ +<?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'] != "/") { + 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"); + } +} + +$slug = $_POST['id']; + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $slug)) { + $pictures = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures"); + foreach ($pictures as $picture) { + if ($picture == "." || $picture == "..") {} else { + $raw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $picture); + $args = explode('|', $raw); + if ($args == $raw) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filemdcorrupt"][0] . " ({$picture}) " . $lang["api"]["filemdcorrupt"][1]); + } + if ($args[1] == $slug) { + $args[1] = "unclassed"; + } else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $args[1]) || $args[1] == "unclassed") {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filecatnotfound"][0] . " ({$picture}) " . $lang["api"]["filecatnotfound"][1]); + } + } + $newraw = implode("|", $args); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $picture, $newraw); + } + } + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $slug); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["catinvalid"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_delete_image.php b/Neutron-trunk/api/admin/galery_delete_image.php new file mode 100644 index 0000000..88ca220 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_delete_image.php @@ -0,0 +1,40 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['id'])) { + // require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($_POST['id']); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id'])) { + $url = explode('|', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id']))[0]; + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id'])) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id']); + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . $url)) { + unlink($_SERVER['DOCUMENT_ROOT'] . $url); + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenoid"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_label_picture.php b/Neutron-trunk/api/admin/galery_label_picture.php new file mode 100644 index 0000000..07b3b59 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_label_picture.php @@ -0,0 +1,38 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['id'])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id'])) { + $args = explode('|', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id'])); + $args[2] = $_POST['label']; + $raw = implode('|', $args); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $_POST['id'], $raw); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileimgnotfound"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenoid"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_publish_photo.php b/Neutron-trunk/api/admin/galery_publish_photo.php new file mode 100644 index 0000000..a4c9628 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_publish_photo.php @@ -0,0 +1,120 @@ +<?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'] != "/") { + 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 gen_uuid() { + return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', + // 32 bits for "time_low" + mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), + + // 16 bits for "time_mid" + mt_rand( 0, 0xffff ), + + // 16 bits for "time_hi_and_version", + // four most significant bits holds version number 4 + mt_rand( 0, 0x0fff ) | 0x4000, + + // 16 bits, 8 bits for "clk_seq_hi_res", + // 8 bits for "clk_seq_low", + // two most significant bits holds zero and one for variant DCE1.1 + mt_rand( 0, 0x3fff ) | 0x8000, + + // 48 bits for "node" + mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) + ); +} + +$uuid = gen_uuid(); + +if (isset($_POST['category'])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $_POST['category'])) { + + } else { + if ($_POST['category'] != "unclassed") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["catinvalid"]); + } + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["catnone"]); +} + +if (isset($_FILES['file'])) { + if ($_FILES['file']['error'] == 1) { + $maxsize = ini_get('upload_max_filesize'); + if ($maxsize > 1000) { + if ($maxsize > 1000000) { + $maxsizestr = round($maxsize / 1000000, 2) . " " . $lang["sizes"]["mib"]; + } else { + $maxsizestr = round($maxsize / 1000, 2) . " " . $lang["sizes"]["kib"]; + } + } else { + $maxsizestr = $maxsize . " " . $lang["sizes"]["bytes"]; + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filesize"] . " ({$maxsizestr})"); + } + if ($_FILES['file']['error'] == 2) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileform"]); + } + if ($_FILES['file']['error'] == 3) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileincomplete"]); + } + if ($_FILES['file']['error'] == 4) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotfound"]); + } + if ($_FILES['file']['error'] == 6) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filenotempdir"]); + } + if ($_FILES['file']['error'] == 7) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["filewriteerror"]); + } + if ($_FILES['file']['error'] == 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fileint"]); + } + if ($_FILES['file']['type'] != "image/png" && $_FILES['file']['type'] != "image/jpeg" && $_FILES['file']['type'] != "image/gif") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($file["api"]["filemime"] . " " . strtoupper(str_ireplace("image/", "", $_FILES['file']['type'])) . "."); + } + if ($_FILES['file']['error'] == 0) { + // if (/*!*//* <-- Fonction de test, décommentez le "!" pour forcer l'affichage de ce message */file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $uuid)) { + // echo("Vous êtes tombé sur une erreur très rare, bravo à vous !\n\nPrenez rapidement ce message en capture d'écran et transmettez le aux développeurs de Neutron.\n\nVous pouvez leur donner cette adresse de galerie Neutron comme preuve :\nmpcms-gallery://" . $uuid . "@"); + // if (isset($_SERVER['HTTP_HOST'])) { + // echo($_SERVER['HTTP_HOST']); + // } else { + // if (isset($_SERVER['SERVER_NAME'])) { + // echo($_SERVER['SERVER_NAME']); + // } else { + // echo("unknown"); + // } + // } + // echo("\n\nVotre site doit être publiquement accessible et vous ne devez pas avoir modifié Neutron pour que votre trouvaille soit référencée."); + // exit; + // } + imagejpeg(imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/" . $uuid . ".jpg"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $uuid, "/resources/upload/" . $uuid . ".jpg" . "|" . $_POST['category']); + unlink($_FILES['file']['tmp_name']); + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/picdb.json")) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/picdb.json", "{\"" . $_POST['category'] . "\":[\"" . $uuid . "\"]}"); + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/galery_toggle_state.php b/Neutron-trunk/api/admin/galery_toggle_state.php new file mode 100644 index 0000000..582faa9 --- /dev/null +++ b/Neutron-trunk/api/admin/galery_toggle_state.php @@ -0,0 +1,40 @@ +<?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'] != "/") { + 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"); + } +} + +if (isset($_POST['state'])) { + $state = $_POST['state']; +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["nostate"]); +} + +if ($state == "1") { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled", ""); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +} else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled"); + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/instant_language_change.php b/Neutron-trunk/api/admin/instant_language_change.php new file mode 100644 index 0000000..c4fd575 --- /dev/null +++ b/Neutron-trunk/api/admin/instant_language_change.php @@ -0,0 +1,33 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} +if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { + if (isset($_POST['lang'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang", $_POST['lang']); + 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"]["inforec"]); + } + } else { + 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 { + 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"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/login.php b/Neutron-trunk/api/admin/login.php new file mode 100644 index 0000000..4a88f30 --- /dev/null +++ b/Neutron-trunk/api/admin/login.php @@ -0,0 +1,52 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?>
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+
+if (isset($_POST['password'])) {
+ if (isset($_POST['authkey'])) { // Use authentication key
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/authkey")) {
+ if (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/authkey")) == $_POST['password']) {
+ $token = str_ireplace("/", "-", password_hash(password_hash(rand(0, 999999) + rand(0, 999999) + rand(0, 999999) + rand(0, 999999) + rand(0, 999999), PASSWORD_BCRYPT, ['cost' => 12,]), PASSWORD_BCRYPT, ['cost' => 12,]));
+ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens")) {
+ mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens");
+ }
+ $tokens = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens");
+ foreach ($tokens as $deltoken) {
+ if ($deltoken == "." || $deltoken == "..") {} else {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $deltoken);
+ }
+ }
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $token, "");
+ header("Set-Cookie: _NEUTRON_ADMIN_TOKEN={$token}; Path=/; Http-Only; SameSite=Strict");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
+ return;
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["keyinvalid"]);
+ }
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["keynone"]);
+ }
+ } else { // Use regular password
+ if (password_verify($_POST['password'], file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/password"))) {
+ $token = str_ireplace("/", "-", password_hash(password_hash(rand(0, 999999) + rand(0, 999999) + rand(0, 999999) + rand(0, 999999) + rand(0, 999999), PASSWORD_BCRYPT, ['cost' => 12,]), PASSWORD_BCRYPT, ['cost' => 12,]));
+ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens")) {
+ mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens");
+ }
+ $tokens = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens");
+ foreach ($tokens as $atoken) {
+ if ($atoken == "." || $atoken == "..") {} else {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $atoken);
+ }
+ }
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $token, "");
+ header("Set-Cookie: _NEUTRON_ADMIN_TOKEN={$token}; Path=/; Http-Only; SameSite=Strict");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
+ return;
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["lgpassinvalid"]);
+ }
+ }
+} else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["lgpassnone"]);
+}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/password.php b/Neutron-trunk/api/admin/password.php new file mode 100644 index 0000000..a823721 --- /dev/null +++ b/Neutron-trunk/api/admin/password.php @@ -0,0 +1,73 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['oldpass'])) { + if (trim($_POST['oldpass']) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); +} + +if (isset($_POST['newpass'])) { + if (trim($_POST['newpass']) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); +} + +if (isset($_POST['newpassr'])) { + if (trim($_POST['newpassr']) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["fieldinvalid"]); +} + +if (password_verify($_POST['oldpass'], file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/password"))) { +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["passoldinvalid"]); +} + +if (strlen($_POST['newpass']) < 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["passaddmore"][0] . " " . (8 - strlen($_POST['newpass'])) . " " . $lang["api"]["passaddmore"][1]); +} + +if ($_POST['newpass'] == $_POST['newpassr']) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["passnewnomatch"]); +} + +if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { + $tokens = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens"); + foreach ($tokens as $token) { + if ($token == "." || $token == "..") {} else { + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $token); + } + } + } else { + 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 { + 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"); + } +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/password", password_hash($_POST['newpass'], PASSWORD_BCRYPT, ['cost' => 12,])); +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/rename_page.php b/Neutron-trunk/api/admin/rename_page.php new file mode 100644 index 0000000..4091940 --- /dev/null +++ b/Neutron-trunk/api/admin/rename_page.php @@ -0,0 +1,75 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['page'])) { + $oldslug = $_POST['page']; + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + if (isset($_POST['newname'])) { + $newname = $_POST['newname']; + $newname = str_replace('>', '>', $newname); + $newname = str_replace('<', '<', $newname); + if (trim($newname) == "") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameempty"]); + } + $newslug = preg_replace("/[^0-9a-zA-Z ]/m", "", $newname ); + $newslug = str_replace(" ", "-", $newslug); + $newslug = strtolower($newslug); + if ($newslug == "api" || $newslug == "cms-special" || $newslug == "galery" || $newslug == "vendor" || $newslug == "cms-unrelated" || $newslug == "data" || $newslug == "resources" || $newslug == "widgets" || $newslug == "-htaccess" || $newslug == "index" || $newslug == "index-php") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameinternal"]); + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $newslug)) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnameexists"]); + } + if (strlen($newslug) > 70) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnamelong"]); + } + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $newslug, file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $oldslug)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $newslug, file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $oldslug)); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug . "/index.php", '<?php require_once "../resources/private/relative.php"; getRelativeDetails(' . $newslug . '); ?><?php require_once $_SERVER[\'DOCUMENT_ROOT\'] . "/api/engine-cyclic/render.php"; render(\'' . $newslug . '\'); ?>'); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $newslug . "/pagename", $newname); + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug . "/index.php"); + unlink($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug . "/pagename"); + rmdir($_SERVER['DOCUMENT_ROOT'] . "/" . $oldslug); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $oldslug); + unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $oldslug); + require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php"; + 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"]["pgnamenone"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnotfound"]); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pgnone"]); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/reset.php b/Neutron-trunk/api/admin/reset.php new file mode 100644 index 0000000..7c67207 --- /dev/null +++ b/Neutron-trunk/api/admin/reset.php @@ -0,0 +1,87 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +function rrmdir($dir) { + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (is_dir($dir."/".$object)) + rrmdir($dir."/".$object); + else + unlink($dir."/".$object); + } + } + rmdir($dir); + } + } + + if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +sleep(2); + +if (isset($_POST['keep'])) { + if ($_POST['keep'] == "1") { + $keep = true; + } else { + $keep = false; + } +} else { + $keep = false; +} + +if ($keep) { + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/resources/upload"); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/resources/upload"); + copy($_SERVER['DOCUMENT_ROOT'] . "/resources/image/siteicon.png", $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json", '{"list":[],"settings":{}'); + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens"); + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache"); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens"); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/footer", "#####"); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +} else { + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent"); + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens"); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/tokens"); + $links = scandir($_SERVER['DOCUMENT_ROOT']); + foreach ($links as $link) { + if ($link != "." && $link != "..") { + if (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $link)) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $link . "/pagename")) { + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/" . $link); + } + } + } + } + rrmdir($_SERVER['DOCUMENT_ROOT'] . "/resources/upload"); + mkdir($_SERVER['DOCUMENT_ROOT'] . "/resources/upload"); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/save_advanced.php b/Neutron-trunk/api/admin/save_advanced.php new file mode 100644 index 0000000..179f22d --- /dev/null +++ b/Neutron-trunk/api/admin/save_advanced.php @@ -0,0 +1,46 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; + +function isJson($string) { + json_decode($string); + return (json_last_error() == JSON_ERROR_NONE); +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} +if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) { + if (isset($_POST['content'])) { + if (true) { + if (isJson($_POST['content'])) { + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json", $_POST['content']); + 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"]["advsyntax"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["pageselect"]); + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["inforec"]); + } + } else { + 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 { + 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"); + } +}
\ No newline at end of file diff --git a/Neutron-trunk/api/admin/widgets.php b/Neutron-trunk/api/admin/widgets.php new file mode 100644 index 0000000..231543f --- /dev/null +++ b/Neutron-trunk/api/admin/widgets.php @@ -0,0 +1,64 @@ +<?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'] != "/") { + 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"); + } +} + +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") . " - API/" . $_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") . " - API/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +if (isset($_POST['element'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["select"]); +} + +if (isset($_POST['value'])) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["value"]); +} + +if ($_POST['value'] != "true" && $_POST['value'] != "false") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["api"]["incorrect"]); +} + +$settings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json")); +$array = $settings->list; + +if ($_POST['value'] == "true") { + if (array_search($_POST['element'], $array) === false) { + array_push($array, $_POST['element']); + } +} + +if ($_POST['value'] == "false") { + if (array_search($_POST['element'], $array) !== false) { + unset($array[array_search($_POST['element'], $array)]); + sort($array); + } +} +$settings->list = $array; + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json", json_encode($settings, JSON_PRETTY_PRINT)); + +require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");
\ No newline at end of file |