aboutsummaryrefslogtreecommitdiff
path: root/admin/api/setlive.php
blob: 0ef8b94d664b832183a3040e8812197933bcc9e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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");
}