From 529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 24 Aug 2021 15:38:16 +0200 Subject: Update --- Neutron-trunk/api/.htaccess | 4 + Neutron-trunk/api/admin/appearance.php | 194 +++++++++++++ Neutron-trunk/api/admin/cache_content_reset.php | 14 + Neutron-trunk/api/admin/cache_pages_update.php | 72 +++++ Neutron-trunk/api/admin/calendar_create.php | 155 +++++++++++ Neutron-trunk/api/admin/calendar_delete.php | 64 +++++ Neutron-trunk/api/admin/calendar_nextevents.php | 36 +++ Neutron-trunk/api/admin/create_page.php | 90 ++++++ Neutron-trunk/api/admin/customization_colors.php | 32 +++ Neutron-trunk/api/admin/customization_theme.php | 32 +++ Neutron-trunk/api/admin/delete_page.php | 47 ++++ Neutron-trunk/api/admin/edit_page.php | 42 +++ Neutron-trunk/api/admin/flag_disable.php | 43 +++ Neutron-trunk/api/admin/flag_enable.php | 43 +++ Neutron-trunk/api/admin/footer.php | 33 +++ Neutron-trunk/api/admin/galery_create_category.php | 47 ++++ Neutron-trunk/api/admin/galery_delete_category.php | 52 ++++ Neutron-trunk/api/admin/galery_delete_image.php | 40 +++ Neutron-trunk/api/admin/galery_label_picture.php | 38 +++ Neutron-trunk/api/admin/galery_publish_photo.php | 120 ++++++++ Neutron-trunk/api/admin/galery_toggle_state.php | 40 +++ .../api/admin/instant_language_change.php | 33 +++ Neutron-trunk/api/admin/login.php | 52 ++++ Neutron-trunk/api/admin/password.php | 73 +++++ Neutron-trunk/api/admin/rename_page.php | 75 +++++ Neutron-trunk/api/admin/reset.php | 87 ++++++ Neutron-trunk/api/admin/save_advanced.php | 46 ++++ Neutron-trunk/api/admin/widgets.php | 64 +++++ Neutron-trunk/api/bugs | 1 + Neutron-trunk/api/codename | 1 + Neutron-trunk/api/cyclic_version | 1 + Neutron-trunk/api/electrode/quit.php | 12 + Neutron-trunk/api/electrode/version | 1 + .../api/engine-cyclic/components/banner.php | 10 + .../api/engine-cyclic/components/content.php | 22 ++ .../api/engine-cyclic/components/drawer.php | 54 ++++ .../api/engine-cyclic/components/favicon.php | 88 ++++++ .../api/engine-cyclic/components/footer.php | 23 ++ .../api/engine-cyclic/components/init.php | 14 + .../api/engine-cyclic/components/menubar.php | 52 ++++ .../api/engine-cyclic/components/widgets.php | 18 ++ Neutron-trunk/api/engine-cyclic/heads.php | 40 +++ Neutron-trunk/api/engine-cyclic/homepage.php | 18 ++ Neutron-trunk/api/engine-cyclic/includes/cache.php | 70 +++++ .../api/engine-cyclic/includes/getPageContent.php | 14 + .../api/engine-cyclic/includes/getPageName.php | 18 ++ .../api/engine-cyclic/includes/includes.php | 4 + Neutron-trunk/api/engine-cyclic/pages.php | 18 ++ Neutron-trunk/api/engine-cyclic/render.php | 2 + Neutron-trunk/api/engine-cyclic/special.php | 18 ++ Neutron-trunk/api/engine-cyclic/tails.php | 4 + Neutron-trunk/api/engine-cyclic/wrapper.php | 42 +++ Neutron-trunk/api/engine-jaw/homepage.php | 297 ++++++++++++++++++++ Neutron-trunk/api/engine-jaw/init.php | 306 +++++++++++++++++++++ Neutron-trunk/api/engine-jaw/render.php | 29 ++ Neutron-trunk/api/experimental | 1 + Neutron-trunk/api/jaw_version | 1 + Neutron-trunk/api/lang/processor.php | 57 ++++ Neutron-trunk/api/lang/setup.php | 56 ++++ Neutron-trunk/api/prettyver | 1 + Neutron-trunk/api/public | 1 + Neutron-trunk/api/renderer/main.php | 24 ++ Neutron-trunk/api/renderer/render.php | 2 + Neutron-trunk/api/setup/check.php | 30 ++ Neutron-trunk/api/setup/defaultHomepage.html | 1 + Neutron-trunk/api/setup/push.php | 105 +++++++ Neutron-trunk/api/snow-bold.png | Bin 0 -> 44713 bytes Neutron-trunk/api/snow-light.png | Bin 0 -> 11973 bytes Neutron-trunk/api/snow-medium.png | Bin 0 -> 24365 bytes Neutron-trunk/api/version | 1 + 70 files changed, 3125 insertions(+) create mode 100644 Neutron-trunk/api/.htaccess create mode 100644 Neutron-trunk/api/admin/appearance.php create mode 100644 Neutron-trunk/api/admin/cache_content_reset.php create mode 100644 Neutron-trunk/api/admin/cache_pages_update.php create mode 100644 Neutron-trunk/api/admin/calendar_create.php create mode 100644 Neutron-trunk/api/admin/calendar_delete.php create mode 100644 Neutron-trunk/api/admin/calendar_nextevents.php create mode 100644 Neutron-trunk/api/admin/create_page.php create mode 100644 Neutron-trunk/api/admin/customization_colors.php create mode 100644 Neutron-trunk/api/admin/customization_theme.php create mode 100644 Neutron-trunk/api/admin/delete_page.php create mode 100644 Neutron-trunk/api/admin/edit_page.php create mode 100644 Neutron-trunk/api/admin/flag_disable.php create mode 100644 Neutron-trunk/api/admin/flag_enable.php create mode 100644 Neutron-trunk/api/admin/footer.php create mode 100644 Neutron-trunk/api/admin/galery_create_category.php create mode 100644 Neutron-trunk/api/admin/galery_delete_category.php create mode 100644 Neutron-trunk/api/admin/galery_delete_image.php create mode 100644 Neutron-trunk/api/admin/galery_label_picture.php create mode 100644 Neutron-trunk/api/admin/galery_publish_photo.php create mode 100644 Neutron-trunk/api/admin/galery_toggle_state.php create mode 100644 Neutron-trunk/api/admin/instant_language_change.php create mode 100644 Neutron-trunk/api/admin/login.php create mode 100644 Neutron-trunk/api/admin/password.php create mode 100644 Neutron-trunk/api/admin/rename_page.php create mode 100644 Neutron-trunk/api/admin/reset.php create mode 100644 Neutron-trunk/api/admin/save_advanced.php create mode 100644 Neutron-trunk/api/admin/widgets.php create mode 100644 Neutron-trunk/api/bugs create mode 100644 Neutron-trunk/api/codename create mode 100644 Neutron-trunk/api/cyclic_version create mode 100644 Neutron-trunk/api/electrode/quit.php create mode 100644 Neutron-trunk/api/electrode/version create mode 100644 Neutron-trunk/api/engine-cyclic/components/banner.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/content.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/drawer.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/favicon.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/footer.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/init.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/menubar.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/widgets.php create mode 100644 Neutron-trunk/api/engine-cyclic/heads.php create mode 100644 Neutron-trunk/api/engine-cyclic/homepage.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/cache.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/getPageContent.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/getPageName.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/includes.php create mode 100644 Neutron-trunk/api/engine-cyclic/pages.php create mode 100644 Neutron-trunk/api/engine-cyclic/render.php create mode 100644 Neutron-trunk/api/engine-cyclic/special.php create mode 100644 Neutron-trunk/api/engine-cyclic/tails.php create mode 100644 Neutron-trunk/api/engine-cyclic/wrapper.php create mode 100644 Neutron-trunk/api/engine-jaw/homepage.php create mode 100644 Neutron-trunk/api/engine-jaw/init.php create mode 100644 Neutron-trunk/api/engine-jaw/render.php create mode 100644 Neutron-trunk/api/experimental create mode 100644 Neutron-trunk/api/jaw_version create mode 100644 Neutron-trunk/api/lang/processor.php create mode 100644 Neutron-trunk/api/lang/setup.php create mode 100644 Neutron-trunk/api/prettyver create mode 100644 Neutron-trunk/api/public create mode 100644 Neutron-trunk/api/renderer/main.php create mode 100644 Neutron-trunk/api/renderer/render.php create mode 100644 Neutron-trunk/api/setup/check.php create mode 100644 Neutron-trunk/api/setup/defaultHomepage.html create mode 100644 Neutron-trunk/api/setup/push.php create mode 100644 Neutron-trunk/api/snow-bold.png create mode 100644 Neutron-trunk/api/snow-light.png create mode 100644 Neutron-trunk/api/snow-medium.png create mode 100644 Neutron-trunk/api/version (limited to 'Neutron-trunk/api') diff --git a/Neutron-trunk/api/.htaccess b/Neutron-trunk/api/.htaccess new file mode 100644 index 0000000..bc839cb --- /dev/null +++ b/Neutron-trunk/api/.htaccess @@ -0,0 +1,4 @@ +ErrorDocument 401 /cms-special/error/?id=401&description=Accès%20refusé +ErrorDocument 403 /cms-special/error/?id=403&description=Accès%20interdit +ErrorDocument 404 /cms-special/error/?id=404&description=Ressource%20introuvable +ErrorDocument 500 /cms-special/error/?id=500&description=Erreur%20interne \ No newline at end of file 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 @@ + +') !== 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 @@ +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("" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") . ""); + } + } + } + } +} +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {append("" . $lang["viewer"]["galery"] . "");} + +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 @@ + +', '>', $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 @@ + +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 @@ + + +', '>', $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", ''); +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 @@ + + + + + + + + +', '>', $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 @@ + + + + + 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 @@ + + + + 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 @@ + + 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 @@ + +', '>', $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", ''); + 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 @@ + + + +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 diff --git a/Neutron-trunk/api/bugs b/Neutron-trunk/api/bugs new file mode 100644 index 0000000..d12473d --- /dev/null +++ b/Neutron-trunk/api/bugs @@ -0,0 +1 @@ +https://jetbrains.minteck.ro.lt:1024/youtrack/newIssue?project=NEU&_dummy= \ No newline at end of file diff --git a/Neutron-trunk/api/codename b/Neutron-trunk/api/codename new file mode 100644 index 0000000..1c883f0 --- /dev/null +++ b/Neutron-trunk/api/codename @@ -0,0 +1 @@ +Fluffy Fennec \ No newline at end of file diff --git a/Neutron-trunk/api/cyclic_version b/Neutron-trunk/api/cyclic_version new file mode 100644 index 0000000..a625450 --- /dev/null +++ b/Neutron-trunk/api/cyclic_version @@ -0,0 +1 @@ +2.3.1 \ No newline at end of file diff --git a/Neutron-trunk/api/electrode/quit.php b/Neutron-trunk/api/electrode/quit.php new file mode 100644 index 0000000..6aaad20 --- /dev/null +++ b/Neutron-trunk/api/electrode/quit.php @@ -0,0 +1,12 @@ + + \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/components/content.php b/Neutron-trunk/api/engine-cyclic/components/content.php new file mode 100644 index 0000000..e3e3be5 --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/content.php @@ -0,0 +1,22 @@ +
+
+
+ +

+ +
+
+

+ +
+
+ + + + +
+

+ +
+
+
diff --git a/Neutron-trunk/api/engine-cyclic/components/drawer.php b/Neutron-trunk/api/engine-cyclic/components/drawer.php new file mode 100644 index 0000000..f0e1db7 --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/drawer.php @@ -0,0 +1,54 @@ + + + +
\ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/components/favicon.php b/Neutron-trunk/api/engine-cyclic/components/favicon.php new file mode 100644 index 0000000..3d078a1 --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/favicon.php @@ -0,0 +1,88 @@ +src_img = $img; + $this->src_w = imagesx($img); + $this->src_h = imagesy($img); + $this->dst_w = $dstWidth; + $this->dst_h = $dstHeight; + } + + public function __destruct() + { + if (is_resource($this->dst_img)) + { + imagedestroy($this->dst_img); + } + } + + public function display() + { + imagepng($this->dst_img, $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/favicon.png"); + return $this; + } + + public function reset() + { + if (is_resource(($this->dst_img))) + { + imagedestroy($this->dst_img); + } + $this->dst_img = imagecreatetruecolor($this->dst_w, $this->dst_h); + imagecopy($this->dst_img, $this->src_img, 0, 0, 0, 0, $this->dst_w, $this->dst_h); + return $this; + } + + public function size($dstWidth, $dstHeight) + { + $this->dst_w = $dstWidth; + $this->dst_h = $dstHeight; + return $this->reset(); + } + + public function crop() + { + $this->reset(); + + $mask = imagecreatetruecolor($this->dst_w, $this->dst_h); + $maskTransparent = imagecolorallocate($mask, 255, 0, 255); + imagecolortransparent($mask, $maskTransparent); + imagefilledellipse($mask, $this->dst_w / 2, $this->dst_h / 2, $this->dst_w, $this->dst_h, $maskTransparent); + + imagecopymerge($this->dst_img, $mask, 0, 0, 0, 0, $this->dst_w, $this->dst_h, 100); + + $dstTransparent = imagecolorallocate($this->dst_img, 255, 0, 255); + imagefill($this->dst_img, 0, 0, $dstTransparent); + imagefill($this->dst_img, $this->dst_w - 1, 0, $dstTransparent); + imagefill($this->dst_img, 0, $this->dst_h - 1, $dstTransparent); + imagefill($this->dst_img, $this->dst_w - 1, $this->dst_h - 1, $dstTransparent); + imagecolortransparent($this->dst_img, $dstTransparent); + + return $this; + } + + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png")) { + $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png"; + } else { + $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"; + } + + $image = imagecreatefrompng($path); + + $width = imagesx($image); + $height = imagesy($image); + $crop = new CircleCrop($image,$width,$height); + $crop->crop()->display(); \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/components/footer.php b/Neutron-trunk/api/engine-cyclic/components/footer.php new file mode 100644 index 0000000..10a89ed --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/footer.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/components/init.php b/Neutron-trunk/api/engine-cyclic/components/init.php new file mode 100644 index 0000000..d17792e --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/init.php @@ -0,0 +1,14 @@ +list; +foreach ($widgets as $widget): ?> + +class) && is_string($data->class)) { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/components/menubar.php b/Neutron-trunk/api/engine-cyclic/components/menubar.php new file mode 100644 index 0000000..b6bce59 --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/menubar.php @@ -0,0 +1,52 @@ + + +
+ +
diff --git a/Neutron-trunk/api/engine-cyclic/components/widgets.php b/Neutron-trunk/api/engine-cyclic/components/widgets.php new file mode 100644 index 0000000..c2a903c --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/components/widgets.php @@ -0,0 +1,18 @@ +list; +foreach ($widgets as $widget): ?> + +
+class) && is_string($data->class)) { + $class = $data->class; + new $class(); +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/heads.php b/Neutron-trunk/api/engine-cyclic/heads.php new file mode 100644 index 0000000..0eeba9a --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/heads.php @@ -0,0 +1,40 @@ + + +"> + + + + <?php + + rlgps("Title generator"); + if (isset($MPCMSRendererPageNameValue) && $MPCMSRendererPageNameValue == "index") { + echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename")); + } else { + echo(getPageName() . " · " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename")); + } + + ?> + + + + /resources/css/polymer/fonts.css"> + /resources/css/themes/-.css"> + /resources/css/polymer/menubar.css"> + /resources/css/polymer/content.css"> + /resources/upload/favicon.png" type="image/png"> + /resources/css/polymer/responsive.css"> + /resources/css/polymer/scrollbars.css"> + /resources/css/polymer/warnings.css"> + /resources/css/polymer/gallery.css"> + /resources/lib/pushbar.js/library.css"> + + headers");require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documenthead.php"; ?> + + + + headers");require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documentbody.php"; ?> \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/homepage.php b/Neutron-trunk/api/engine-cyclic/homepage.php new file mode 100644 index 0000000..995a76a --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/homepage.php @@ -0,0 +1,18 @@ +list; + } + + // Check if there is (at least) one widget that disables cache + foreach ($list as $widget) { + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/widgets/$widget/feature.json")); + if (json_last_error() == JSON_ERROR_NONE) { + if (isset($data->cache)) { + if (is_bool($data->cache)) { + $cache = $data->cache; + if ($data->cache == false) { + rlgps("Widget \"$widget\" prevents the use of cache"); + } + } + } + } else { + rlgps("Warning: Metadata for the widget \"$widget\" is corrupted"); + } + } + + // Check if an update has been installed + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version")) { + if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version") == file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version")) {} else { + $cache = false; + require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version")); + } + } else { + $cache = false; + require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php"; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version")); + } + + // Is there any widget that disables cache? + if ($cache) { // no + // Does the cached version exists? + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)) { // yes + header("X-FNS-NeutronCache: yes"); + echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)); // So let's output it + require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump(); // And debug if needed + return true; + } else { // no + header("X-FNS-NeutronCache: no"); + return false; // Let the engine-cyclic render the page + } + } else { // yes + header("X-FNS-NeutronCache: no"); + return false; // Let the engine-cyclic render the page + } */ + + // Cache is now completely disabled due to problems + return false; +} \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php b/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php new file mode 100644 index 0000000..31b202c --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/Neutron-trunk/api/engine-cyclic/wrapper.php b/Neutron-trunk/api/engine-cyclic/wrapper.php new file mode 100644 index 0000000..196060d --- /dev/null +++ b/Neutron-trunk/api/engine-cyclic/wrapper.php @@ -0,0 +1,42 @@ + +> 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); + return ($avg_lum / 255) * 100; + } +} + +?> +list; +foreach ($widgets as $widget): ?> + +class) && is_string($data->class)) { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + +") ?> + + + + + + + + + '); + echo(''); + echo(''); + echo(''); + } else { + echo(''); + } + + ?> + /resources/css/fonts-import.css"> + /resources/css/ui.css"> + <?php + + function asciiComp($a, $b) { + $at = iconv('UTF-8', 'ASCII//TRANSLIT', $a); + $bt = iconv('UTF-8', 'ASCII//TRANSLIT', $b); + return strcmp($at, $bt); + } + + if ($ready) { + echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename")); + } else { + echo("Neutron"); + } + + ?> + + + + location.href='{$GLOBALS["SYSTEM_ROOT"]}/cms-special/setup';"); + } + + if ($ready) { + echo(""); + } + + rlgps("Banner generation"); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg")) { + $banner = "{$GLOBALS["SYSTEM_ROOT"]}/resources/upload/banner.jpg"; + if (getAvgLuminance($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg") > 50) { + $blackBannerText = true; + } else { + $blackBannerText = false; + } + } else { + $banner = "{$GLOBALS["SYSTEM_ROOT"]}/resources/image/default.jpg"; + if (getAvgLuminance($_SERVER['DOCUMENT_ROOT'] . "/resources/image/default.jpg") > 50) { + $blackBannerText = true; + } else { + $blackBannerText = false; + } + } + rlgps("Branding"); + ?> + + + +
+ + +
+ /" title="/" class="menu-link"> + hiddenPages)) { + echo("" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") . ""); + } + } + } + } + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {echo("" . $lang["viewer"]["gallery"] . "");} + + ?> +
+ +
+
+ ]*>.*?<\/h[1-6]>#',$html_string,$results); + + $toc = implode("\n",$results[0]); + $toc = preg_replace('#

#','
  • ',$toc); + $toc = preg_replace('#<\/h2>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h3>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h4>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h5>#','
  • ',$toc); + $toc = preg_replace('#
    #','
  • ',$toc); + $toc = preg_replace('#<\/h6>#','
  • ',$toc); + + $toc = '
    +

    ' . $lang["viewer"]["toc"] . '

    +
      + '.$toc.' +
    +

    '; + + if (false) { + echo($toc); + } + + ?> + +
    + +
    + + diff --git a/Neutron-trunk/api/engine-jaw/init.php b/Neutron-trunk/api/engine-jaw/init.php new file mode 100644 index 0000000..a9da042 --- /dev/null +++ b/Neutron-trunk/api/engine-jaw/init.php @@ -0,0 +1,306 @@ + +> 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); + return ($avg_lum / 255) * 100; + } +} + +function asciiComp($a, $b) { + $at = iconv('UTF-8', 'ASCII//TRANSLIT', $a); + $bt = iconv('UTF-8', 'ASCII//TRANSLIT', $b); + return strcmp($at, $bt); +} + +?> +list; +foreach ($widgets as $widget): ?> + +class) && is_string($data->class)) { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + +") ?> +location.href = '/';"); +} + +?> + + + + + + + + '); + echo(''); + echo(''); + echo(''); + } else { + echo(''); + } + + ?> + + + <?php + + if (isset($MPCMSRendererPageMarkup)) { + echo($MPCMSRendererPageMarkupDN . " - " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename")); + } else { + echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $pagename . "/pagename") . " - " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename")); + } + + ?> + + + + \nvar pushbar = new Pushbar({\nblur:true,\noverlay:true,\n});\n"); + + + rlgps("Banner generation"); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg")) { + $banner = "/resources/upload/banner.jpg"; + if (getAvgLuminance($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg") > 50) { + $blackBannerText = true; + } else { + $blackBannerText = false; + } + } else { + $banner = "/resources/image/default.jpg"; + if (getAvgLuminance($_SERVER['DOCUMENT_ROOT'] . "/resources/image/default.jpg") > 50) { + $blackBannerText = true; + } else { + $blackBannerText = false; + } + } + rlgps("Branding"); + ?> + + + +
    + + +
    + + hiddenPages)) { + echo("" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") . ""); + } + } + } + } + } + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {echo("" . $lang["viewer"]["gallery"] . "");} + + ?> +
    + +
    +
    + ]*>.*?<\/h[1-6]>#',$html_string,$results); + + $toc = implode("\n",$results[0]); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h2>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h3>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h4>#','
  • ',$toc); + $toc = preg_replace('#

    #','
  • ',$toc); + $toc = preg_replace('#<\/h5>#','
  • ',$toc); + $toc = preg_replace('#
    #','
  • ',$toc); + $toc = preg_replace('#<\/h6>#','
  • ',$toc); + + $toc = '
    +

    ' . $lang["viewer"]["toc"] . '

    +
      + '.$toc.' +
    +

    '; + + if (false) { + echo($toc); + } + } + + ?> + +
    + +
    + + diff --git a/Neutron-trunk/api/engine-jaw/render.php b/Neutron-trunk/api/engine-jaw/render.php new file mode 100644 index 0000000..9a9efd3 --- /dev/null +++ b/Neutron-trunk/api/engine-jaw/render.php @@ -0,0 +1,29 @@ +const lang = '" . $langsel . "';"); + $lang = []; + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/" . $langsel)) { + $langprops = scandir($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/" . $langsel); + foreach ($langprops as $langprop) { + if ($langprop != "." && $langprop != "..") { + $langpieces = explode("/", implode("/", explode("\\", $langprop))); + $langitemsel = explode(".", $langpieces[count($langpieces) - 1]); + $langitem = $langitemsel[count($langitemsel) - 1]; + if ($langitemsel[count($langitemsel) - 1] != "json") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unable to load language file: " . implode(".", $langitemsel) . " is not in a valid format. Language files must be JSON."); + } else { + json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/" . $langsel . "/" . $langprop)); + if (json_last_error() == JSON_ERROR_NONE) { + $lang[$langitemsel[count($langitemsel) - 2]] = (array)json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/" . $langsel . "/" . $langprop)); + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unable to load language file: " . implode(".", $langitemsel) . " isn't a valid JSON file. Please check for syntax errors and retry."); + } + } + } + } + } else { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/fr")) { + echo("Unable to load language files: unable to find selected language files, loading fallback files"); + $langprops = scandir($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/fr"); + foreach ($langprops as $langprop) { + if ($langprop != "." && $langprop != "..") { + $langpieces = explode("/", implode("/", explode("\\", $langprop))); + $langitemsel = explode(".", $langpieces[count($langpieces) - 1]); + $langitem = $langitemsel[count($langitemsel) - 1]; + if ($langitemsel[count($langitemsel) - 1] != "json") { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unable to load language file: " . implode(".", $langitemsel) . " is not in a valid format. Language files must be JSON."); + } else { + json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/fr/" . $langprop)); + if (json_last_error() == JSON_ERROR_NONE) { + $lang[$langitemsel[count($langitemsel) - 2]] = (array)json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/fr/" . $langprop)); + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unable to load language file: " . implode(".", $langitemsel) . " isn't a valid JSON file. Please check for syntax errors and retry."); + } + } + } + } + } else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unable to load language files: unable to find selected language files, and unable to find fallback language files"); + } + } +} \ No newline at end of file diff --git a/Neutron-trunk/api/prettyver b/Neutron-trunk/api/prettyver new file mode 100644 index 0000000..0f941f3 --- /dev/null +++ b/Neutron-trunk/api/prettyver @@ -0,0 +1 @@ +21H2 \ No newline at end of file diff --git a/Neutron-trunk/api/public b/Neutron-trunk/api/public new file mode 100644 index 0000000..b502f32 --- /dev/null +++ b/Neutron-trunk/api/public @@ -0,0 +1 @@ +https://minteck.ro.lt/creations/dev/neutron \ No newline at end of file diff --git a/Neutron-trunk/api/renderer/main.php b/Neutron-trunk/api/renderer/main.php new file mode 100644 index 0000000..c873f60 --- /dev/null +++ b/Neutron-trunk/api/renderer/main.php @@ -0,0 +1,24 @@ + +GD Support enabled ') !== false || strpos($data, 'GD Support => enabled') !== false) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("The GD2 library is not installed or enabled"); +} + +if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unsupported browser, please use Chrome, Chrome-based or Firefox"); +} + +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); diff --git a/Neutron-trunk/api/setup/defaultHomepage.html b/Neutron-trunk/api/setup/defaultHomepage.html new file mode 100644 index 0000000..88da957 --- /dev/null +++ b/Neutron-trunk/api/setup/defaultHomepage.html @@ -0,0 +1 @@ +
    Neutron

    Edit the homepage to start your website...
    Modifiez la page d'accueil pour commencer votre site...
    Edite la página de inicio para iniciar su sitio web...
    Modifica la home page per avviare il tuo sito Web...
    Bearbeiten Sie die Homepage, um Ihre Website zu starten...
    Bewerk de startpagina om uw website te starten...
    Отредактируйте домашнюю страницу, чтобы начать свой сайт ...
    编辑首页以启动您的网站...
    ホームページを編集してウェブサイトを開始...

    \ No newline at end of file diff --git a/Neutron-trunk/api/setup/push.php b/Neutron-trunk/api/setup/push.php new file mode 100644 index 0000000..20d8898 --- /dev/null +++ b/Neutron-trunk/api/setup/push.php @@ -0,0 +1,105 @@ + +') !== 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("Le nom du site contient des caractères invalides"); + } + if (strlen($_POST['sitename']) > 75) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Le nom du site est trop long"); + } +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Aucun nom n'a été spécifié pour le site"); +} + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/i18n/" . $_POST['language'])) { + $lang = $_POST['language']; +} else { + $lang = "fr"; +} + +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) . " Mio"; + } else { + $maxsizestr = round($maxsize / 1000, 2) . " Kio"; + } + } else { + $maxsizestr = $maxsize . " octets"; + } + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("La taille du fichier d'icône dépasse la taille maximale imposée par le serveur ({$maxsizestr})"); + } + if ($_FILES['file']['error'] == 2) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("La taille maximale du fichier de formulaire à été dépassée"); + } + if ($_FILES['file']['error'] == 3) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Le fichier d'icône est incomplet (n'a pas été transmis entièrement)"); + } + if ($_FILES['file']['error'] == 4) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Le fichier est renseigné au serveur, mais il n'a pas été transmis"); + } + if ($_FILES['file']['error'] == 6) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Aucun dossier temporaire présent sur le serveur"); + } + if ($_FILES['file']['error'] == 7) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Impossible d'écrire sur le disque"); + } + if ($_FILES['file']['error'] == 8) { + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Un autre programme à interrompu la transmission du fichier"); + } + 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("Ce type de fichier n'est pas supporté"); + } + if ($_FILES['file']['error'] == 0) { + imagepng(imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])), $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"); + unlink($_FILES['file']['tmp_name']); + } +} else { + copy($_SERVER['DOCUMENT_ROOT'] . "/resources/image/siteicon.png", $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png"); +} + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent"); +} + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages")) { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages"); +} + +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes")) { + mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes"); +} + +$password = password_hash("MPCMS-usr-motdepasse", PASSWORD_BCRYPT, ['cost' => 12,]); + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/index", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/setup/defaultHomepage.html")); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/index", "0"); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang", $lang); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/footer", "Copyright © Votre nom ici
    Tous droits réservés"); +$sitename = str_replace('>', '>', $_POST['sitename']); +$sitename = str_replace('<', '<', $sitename); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename", $sitename); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json", "{\"list\": [\"test\"]}"); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json", "{\"events\":[{}]}"); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/password", $password); +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") . " - SETUP/" . $_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") . " - SETUP/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); +} + +require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok"); \ No newline at end of file diff --git a/Neutron-trunk/api/snow-bold.png b/Neutron-trunk/api/snow-bold.png new file mode 100644 index 0000000..0d7b2e6 Binary files /dev/null and b/Neutron-trunk/api/snow-bold.png differ diff --git a/Neutron-trunk/api/snow-light.png b/Neutron-trunk/api/snow-light.png new file mode 100644 index 0000000..20ea123 Binary files /dev/null and b/Neutron-trunk/api/snow-light.png differ diff --git a/Neutron-trunk/api/snow-medium.png b/Neutron-trunk/api/snow-medium.png new file mode 100644 index 0000000..ac11309 Binary files /dev/null and b/Neutron-trunk/api/snow-medium.png differ diff --git a/Neutron-trunk/api/version b/Neutron-trunk/api/version new file mode 100644 index 0000000..ed21ed3 --- /dev/null +++ b/Neutron-trunk/api/version @@ -0,0 +1 @@ +10.0.236.53 -- cgit