Compare commits

...

3 Commits

Author SHA1 Message Date
quenousimporte 0ba895aad6 add version, fix .del in index 2024-10-10 10:22:32 +02:00
quenousimporte 1baf2f76c9 limit to .md files 2024-10-08 17:52:30 +02:00
quenousimporte feb3fad070 fix php tags 2024-10-08 17:52:02 +02:00
2 changed files with 16 additions and 15 deletions

View File

@ -1,5 +1,6 @@
<?php
error_reporting(E_ALL);
date_default_timezone_set('Europe/Paris');
require 'settings.php';
function cleanstring($string)
@ -124,11 +125,11 @@
session_start();
if (!isset($_SESSION['index']) || isset($_GET['reindex']) || empty($_SESSION['index']))
{
$files = glob($dir . '/*');
$files = glob($dir . '/*.md');
usort($files, function($a, $b)
{
return filemtime($b) - filemtime($a);
});
$_SESSION['index'] = array_map(fn($value): string => str_replace('.md', '', $value), $files);
}
?>
?>

View File

@ -79,7 +79,7 @@
<!DOCTYPE html>
<html>
<head>
<title><? echo $title; ?></title>
<title><?php echo $title; ?></title>
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="white" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
@ -88,7 +88,7 @@
</head>
<body>
<!-- editor -->
<div <? if(isset($_GET['preview'])) echo 'hidden'; ?>>
<div <?php if(isset($_GET['preview'])) echo 'hidden'; ?>>
<form action="note.php" method="POST">
<div>
<input type="submit" name="home" value="home" accesskey="h">
@ -96,24 +96,24 @@
<input type="submit" name="preview" value="preview" accesskey="p">
<input type="submit" name="download" value="download" accesskey="d">
<input type="submit" name="delete" value="delete">
<input hidden name="lastchanged" value="<? echo $lastchanged; ?>">
<div><input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"></div>
<input hidden name="lastchanged" value="<?php echo $lastchanged; ?>">
<div><input autocomplete="off" class="title" name="title" value="<?php echo $title; ?>"></div>
</div>
<div class="editor">
<textarea rows="<? echo $rows; ?>" autofocus name="content" spellcheck="false"><? echo $content; ?></textarea>
<textarea rows="<?php echo $rows; ?>" autofocus name="content" spellcheck="false"><?php echo $content; ?></textarea>
</div>
<input hidden name="previoustitle" value="<? echo $title; ?>">
<?php
echo '<div class="grey">' . $lines . '&nbsp;' . $words . '&nbsp;' . $chars . '&nbsp;' . $title . '.md</div>';
echo linksdiv($content);
?>
<input hidden name="previoustitle" value="<?php echo $title; ?>">
<div class="grey">
<?php echo '' . $lines . '&nbsp;' . $words . '&nbsp;' . $chars . '&nbsp;' . $title . '.md&nbsp;' . date('Y-m-d H.i.s', $lastchanged); ?>
</div>
<?php echo linksdiv($content); ?>
</form>
</div>
<!-- preview -->
<div <? if(!isset($_GET['preview'])) echo 'hidden'; ?>>
<div><a class="grey" href="note.php?title=<? echo $title; ?>">back</a></div>
<?
<div <?php if(!isset($_GET['preview'])) echo 'hidden'; ?>>
<div><a class="grey" href="note.php?title=<?php echo $title; ?>">back</a></div>
<?php
echo computepreview($title, $content);
?>
</div>