diff options
Diffstat (limited to 'admin/api/setlive.php')
-rw-r--r-- | admin/api/setlive.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/admin/api/setlive.php b/admin/api/setlive.php new file mode 100644 index 0000000..0ef8b94 --- /dev/null +++ b/admin/api/setlive.php @@ -0,0 +1,33 @@ +<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
+
+if (isset($_POST['document']) && strpos($_POST['document'], "/") === false) {
+ $doc = $_POST['document'];
+} else {
+ die();
+}
+
+if ($doc === "conduct.fr") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/fr.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html"));
+}
+
+if ($doc === "conduct.en") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/en.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html"));
+}
+
+if ($doc === "blog.en") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.html"));
+}
+
+if ($doc === "blog.fr") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.fr.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.fr.html"));
+}
+
+if ($doc === "blog.en") {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.html");
+} else if ($doc === "blog.fr") {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.fr.html");
+} else {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html");
+}
\ No newline at end of file |