bbn/index.php

70 lines
1.8 KiB
PHP
Raw Normal View History

2024-09-30 10:09:49 +02:00
<?php
2024-10-07 16:06:35 +02:00
require('common.php');
2024-09-30 10:09:49 +02:00
if (isset($_GET['download']))
{
2024-10-02 11:49:15 +02:00
downloadall();
2024-09-30 10:09:49 +02:00
}
2024-10-01 10:51:28 +02:00
2024-10-07 16:06:35 +02:00
$filter = '';
if (isset($_GET['filter']))
2024-10-01 10:51:28 +02:00
{
2024-10-07 16:06:35 +02:00
$filter = $_GET['filter'];
2024-10-07 09:08:38 +02:00
}
2024-09-30 10:09:49 +02:00
?>
<!DOCTYPE html>
<html>
<head>
2024-10-07 16:06:35 +02:00
<title>bbn</title>
2024-09-30 10:09:49 +02:00
<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">
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
2024-10-07 16:06:35 +02:00
<form action="index.php" method="GET" id="home">
<input hidden type="submit" accesskey="h">
</form>
<form action="note.php" method="GET" id="note"></form>
<div>
<input type="submit" name="new" value="new" accesskey="o" form="note">
<input type="submit" name="download" value="download" accesskey="d" form="home">
<br>
<input placeholder="search..." autofocus autocomplete="off" class="title" name="filter" value="<?php echo $filter; ?>" form="home">
</div>
<div>
2024-09-30 10:09:49 +02:00
<?php
2024-10-07 16:06:35 +02:00
foreach($_SESSION['index'] as $path)
{
2024-10-07 16:06:35 +02:00
$name = basename($path);
if (str_ends_with($name, '.del'))
2024-02-14 14:23:00 +01:00
{
2024-10-07 16:06:35 +02:00
continue;
2024-02-14 14:23:25 +01:00
}
2024-10-07 16:06:35 +02:00
if ($filter)
2024-03-06 11:53:57 +01:00
{
2024-10-07 16:06:35 +02:00
$content = file_get_contents($path . '.md');
if (!str_contains(cleanstring($content), cleanstring($filter)) && !str_contains(cleanstring($name), cleanstring($filter)))
2024-03-06 11:53:57 +01:00
{
2024-10-07 16:06:35 +02:00
continue;
2024-03-06 11:53:57 +01:00
}
}
2024-10-07 16:06:35 +02:00
echo '<div><a href=note.php?title=' . urlencode($name) . '>' . $name .'</a>';
if ($filter && str_contains(cleanstring($content), cleanstring($filter)))
{
$pos = strpos(cleanstring($content), cleanstring($$filter));
echo '<span class="grey"> ' . $filter . substr($content, $pos + strlen($filter), 42) . '</span>';
}
echo'</div>';
2024-02-14 14:23:25 +01:00
}
?>
2024-10-07 16:06:35 +02:00
</div>
2024-02-14 14:23:25 +01:00
</body>
2024-02-13 22:57:28 +01:00
</html>