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 <?php
error_reporting(E_ALL); error_reporting(E_ALL);
date_default_timezone_set('Europe/Paris');
require 'settings.php'; require 'settings.php';
function cleanstring($string) function cleanstring($string)
@ -124,7 +125,7 @@
session_start(); session_start();
if (!isset($_SESSION['index']) || isset($_GET['reindex']) || empty($_SESSION['index'])) if (!isset($_SESSION['index']) || isset($_GET['reindex']) || empty($_SESSION['index']))
{ {
$files = glob($dir . '/*'); $files = glob($dir . '/*.md');
usort($files, function($a, $b) usort($files, function($a, $b)
{ {
return filemtime($b) - filemtime($a); return filemtime($b) - filemtime($a);

View File

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