diff --git a/html/editpage.php b/html/editpage.php new file mode 100644 index 00000000..c4451f84 --- /dev/null +++ b/html/editpage.php @@ -0,0 +1,114 @@ + "article", + 1 => "page" +]; + +$repertoire = "/var/www/e59/"; + +if(isset($_SESSION['userid']) == false) { + header("Location: login.php"); + http_response_code(404); + die(); +} + +if(isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT)) { + if(file_exists($repertoire . "content/journal/" . $_GET['article'] . ".md";)){ + $fichier = $repertoire . "content/journal/" . $_GET['article'] . ".md"; + $filename = $_GET['article']; + $filetype = 0; + } +} + +if(isset($_GET['page']) && strpos($_GET['page'], "..") == false) { + if(file_exists($repertoire . "content/" . $_GET['page'] . ".md";)){ + $fichier = $repertoire . "content/" . $_GET['page'] . ".md"; + $filename = $_GET['page']; + $filetype = 1; + } +} + +if(isset($fichier)) { + if(isset($_POST['page-content'])) { + file_put_contents($fichier, nl2br($_POST['page-content'])); + } + $contenu = file_get_contents($fichier); +} + +?> + + + + + + + + <?=$title?> + + + +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
" method="post"> +
+
'; + echo '
'; + } else { + echo "
"; + $pages = scandir($repertoire . "content/"); + foreach($pages as $page) { + if($page != "." && $page != "..") { + if (is_file($repertoire . "content/")) { + echo "
" . pathinfo($page, PATHINFO_FILENAME) . "
"; + } + } + } + } + ?> +
+
+
+
+
+ + + \ No newline at end of file diff --git a/html/src/css/style.css b/html/src/css/style.css index ddd49dcc..89ef0f05 100644 --- a/html/src/css/style.css +++ b/html/src/css/style.css @@ -37,7 +37,7 @@ header, footer { justify-content: space-between; } -input { +input, textarea { background-color: var(--background); color: var(--text); padding: 0.4em 1em;