Update 2 files
- /html/src/css/style.css - /html/editpage.php
This commit is contained in:
parent
7534ebc226
commit
2928c0bf35
114
html/editpage.php
Normal file
114
html/editpage.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
require "../include/variables.php";
|
||||
require "../include/functions.php";
|
||||
|
||||
$filetypes = [
|
||||
0 => "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);
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./src/css/style.css">
|
||||
<link rel="icon" href="src/img/favicon.ico">
|
||||
<title><?=$title?></title>
|
||||
<style>
|
||||
textarea {
|
||||
width: 100%;
|
||||
min-height: 50em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="pancontent">
|
||||
<div class="athena-container">
|
||||
<a href="/">
|
||||
<img src="./src/img/athena-mono.png" class="athena">
|
||||
</a>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div>
|
||||
<div class="main-title">
|
||||
<div class="title"><?=$header_title?></div>
|
||||
<div class="subtitle"><?=$header_subtitle?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<nav>
|
||||
<div class="pancontent">
|
||||
<?php nav($nav);?>
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
<div class="content">
|
||||
<div>
|
||||
<form action="?<?php echo $filetypes[$filetype] . "=" . $filename?>" method="post">
|
||||
<div>
|
||||
<?php
|
||||
if(isset($contenu)) {
|
||||
echo '<div><textarea name="page-content">' . $contenu . '</textarea></div>';
|
||||
echo '<div><input type="submit" value="Publier"></div>';
|
||||
} else {
|
||||
echo "<div>";
|
||||
$pages = scandir($repertoire . "content/");
|
||||
foreach($pages as $page) {
|
||||
if($page != "." && $page != "..") {
|
||||
if (is_file($repertoire . "content/")) {
|
||||
echo "<a href='?page='" . pathinfo($page, PATHINFO_FILENAME) . "'><div>" . pathinfo($page, PATHINFO_FILENAME) . "</div></a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<div class="content">
|
||||
<div>
|
||||
<div><?=$copyright?></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -37,7 +37,7 @@ header, footer {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
input {
|
||||
input, textarea {
|
||||
background-color: var(--background);
|
||||
color: var(--text);
|
||||
padding: 0.4em 1em;
|
||||
|
Loading…
x
Reference in New Issue
Block a user