aboutsummaryrefslogtreecommitdiff
path: root/admin/api/autosave.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/api/autosave.php')
-rw-r--r--admin/api/autosave.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/admin/api/autosave.php b/admin/api/autosave.php
new file mode 100644
index 0000000..67943cb
--- /dev/null
+++ b/admin/api/autosave.php
@@ -0,0 +1,31 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
+
+if (isset($_POST['document']) && strpos($_POST['document'], "/") === false) {
+ $doc = $_POST['document'];
+} else {
+ echo("E_ABORT: document");
+ die();
+}
+
+if (isset($_POST['article']) && strpos($_POST['article'], "/") === false) {
+ $blog = $_POST['article'];
+}
+
+if (isset($_POST['content'])) {
+ $data = $_POST['content'];
+} else {
+ echo("E_ABORT: content");
+ die();
+}
+
+echo("STEP");
+if ($_POST["document"] === "blog.en") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-" . $blog . ".json.html", $data);
+} else if ($_POST["document"] === "blog.fr") {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-" . $blog . ".json.fr.html", $data);
+} else {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html", $data);
+}
+echo("SUCCESS"); \ No newline at end of file