change layout

This commit is contained in:
quenousimporte 2024-02-14 14:23:00 +01:00
parent b35c6dfe51
commit 32bd95e372
1 changed files with 20 additions and 14 deletions

View File

@ -44,12 +44,6 @@
exit;
}
echo '<form action="index.php" method="GET">
<a accesskey="h" href="index.php">Home</a>&nbsp;
<input name="open" value="' . time() . '.md">&nbsp;
<input accesskey="n" type="submit" value="Create new">
</form>';
if (isset($_POST['savebutton']))
{
$title = $_POST['title'];
@ -77,23 +71,34 @@
$content = file_get_contents($dir . '/' . $title);
}
$nblines = substr_count($content, "\r\n");
$nblines = max(20, substr_count($content, "\r\n") + 1);
echo '<form action="index.php" method="POST">
<br><div><input class="title" name="title" value="' . $title . '"></div><br>
<div>
<input accesskey="h" type="submit" name="homebutton" value="home">
<input type="submit" name="savebutton" value="save" accesskey="s">
<input accesskey="d" type="submit" name="deletebutton" value="delete">
</div>
<br>
<div><input class="title" name="title" value="' . $title . '"></div><br>
<div>
<textarea rows="' . $nblines. '" autofocus name="content" spellcheck="false">' . $content . '</textarea>
</div>
<input type="submit" name="savebutton" value="save" accesskey="s">
<input accesskey="d" type="submit" name="deletebutton" value="delete">
</form>';
}
else
{
echo '<br><br>';
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (str_ends_with($file, '.md'))
echo '<form action="index.php" method="GET">
<input accesskey="n" type="submit" value="create new">
<input name="open" value="' . time() . '">
</form>';
echo '<br>';
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if (!str_ends_with($file, '.del') && $file != '.' && $file != '..')
{
$mod = date("F d Y H:i:s", filemtime($dir . '/' . $file));
echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($file) . '>' . $file .'</a></div>';
@ -101,6 +106,7 @@
}
closedir($dh);
}
echo '<br>';
}
?>