Compare commits
No commits in common. "84baa60a2b30cd2715a2db023f2b5414e77c3f53" and "084c27653b8ea6af9c6f4973c967206e3a422744" have entirely different histories.
84baa60a2b
...
084c27653b
4
home.php
4
home.php
|
@ -1,7 +1,9 @@
|
||||||
<form action="index.php" method="GET">
|
<form action="index.php" method="GET">
|
||||||
<div>
|
<div>
|
||||||
<input hidden type="submit" name="search" value="search" accesskey="s">
|
<input hidden type="submit" name="search" value="search" accesskey="s">
|
||||||
<input type="submit" name="new" value="new" accesskey="o">
|
<input type="submit" name="open" value="open" accesskey="o">
|
||||||
|
<input type="submit" name="tags" value="tags" accesskey="t">
|
||||||
|
<input type="submit" name="clip" value="clip" accesskey="c">
|
||||||
<input type="submit" name="download" value="download" accesskey="d">
|
<input type="submit" name="download" value="download" accesskey="d">
|
||||||
<br>
|
<br>
|
||||||
<input placeholder="search..." autofocus autocomplete="off" class="title" name="param" value="<?php if (!isset($_GET['home']) && !isset($_POST['home'])) echo $param; ?>">
|
<input placeholder="search..." autofocus autocomplete="off" class="title" name="param" value="<?php if (!isset($_GET['home']) && !isset($_POST['home'])) echo $param; ?>">
|
||||||
|
|
47
index.php
47
index.php
|
@ -80,7 +80,7 @@
|
||||||
$path = $dir . '/' . $title;
|
$path = $dir . '/' . $title;
|
||||||
$lastchanged = filemtime($path);
|
$lastchanged = filemtime($path);
|
||||||
$previous = $_POST['lastchanged'];
|
$previous = $_POST['lastchanged'];
|
||||||
if ((int)$lastchanged > (int)$previous)
|
if (!isset($_GET['clip']) && (int)$lastchanged > (int)$previous)
|
||||||
{
|
{
|
||||||
$tempcontent = file_get_contents($path . '.md');
|
$tempcontent = file_get_contents($path . '.md');
|
||||||
if ($tempcontent != $content)
|
if ($tempcontent != $content)
|
||||||
|
@ -130,7 +130,13 @@
|
||||||
{
|
{
|
||||||
downloadall();
|
downloadall();
|
||||||
}
|
}
|
||||||
else if (isset($_POST['save']) || isset($_POST['home']) || isset($_POST['download']))
|
else if (isset($_GET['clip']) && $_GET['param'])
|
||||||
|
{
|
||||||
|
$content = $_GET['param'] . "\r\n" . file_get_contents($dir . '/todo.md');
|
||||||
|
savenote('todo', $content);
|
||||||
|
$_GET['param'] = '';
|
||||||
|
}
|
||||||
|
else if (isset($_POST['save']) || isset($_POST['home']) || isset($_POST['links']) || isset($_POST['stats']) || isset($_POST['download']))
|
||||||
{
|
{
|
||||||
$title = $_POST['title'];
|
$title = $_POST['title'];
|
||||||
$content = $_POST['content'];
|
$content = $_POST['content'];
|
||||||
|
@ -178,10 +184,6 @@
|
||||||
$nextpage = 'note';
|
$nextpage = 'note';
|
||||||
$title = $_GET['param'];
|
$title = $_GET['param'];
|
||||||
}
|
}
|
||||||
else if (isset($_GET['new']))
|
|
||||||
{
|
|
||||||
$nextpage = 'note';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -253,19 +255,46 @@
|
||||||
|
|
||||||
foreach($_SESSION['index'] as $path)
|
foreach($_SESSION['index'] as $path)
|
||||||
{
|
{
|
||||||
|
$tags = '';
|
||||||
$name = basename($path);
|
$name = basename($path);
|
||||||
if (!str_ends_with($name, '.del'))
|
if (!str_ends_with($name, '.del'))
|
||||||
{
|
{
|
||||||
if (($_GET['param'] && isset($_GET['search'])))
|
if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags']))
|
||||||
{
|
{
|
||||||
$content = file_get_contents($path . '.md');
|
$content = file_get_contents($path . '.md');
|
||||||
if (isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param)))
|
if (
|
||||||
|
// param does not match content or title
|
||||||
|
(isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param))) ||
|
||||||
|
// param does not match tags
|
||||||
|
(isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (isset($_GET['search']) && $param == $name)
|
||||||
|
{
|
||||||
|
header('Location: index.php?open=true¶m=' . urlencode($name));
|
||||||
|
die();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
||||||
if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
if (isset($content) && isset($_GET['tags']))
|
||||||
|
{
|
||||||
|
$tags = array();
|
||||||
|
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
|
||||||
|
if ($hastags)
|
||||||
|
{
|
||||||
|
$tagslist = explode(',', $tags[0][1]);
|
||||||
|
echo '<span class="grey"> ';
|
||||||
|
foreach ($tagslist as $tag)
|
||||||
|
{
|
||||||
|
$tag = trim($tag);
|
||||||
|
echo('<a class="grey" href="index.php?tags=true¶m=' . $tag . '">' . $tag . '</a> ');
|
||||||
|
}
|
||||||
|
echo '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
||||||
{
|
{
|
||||||
$pos = strpos(cleanstring($content), cleanstring($param));
|
$pos = strpos(cleanstring($content), cleanstring($param));
|
||||||
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
||||||
|
|
15
note.php
15
note.php
|
@ -3,17 +3,24 @@
|
||||||
<input type="submit" name="home" value="home" accesskey="h">
|
<input type="submit" name="home" value="home" accesskey="h">
|
||||||
<input type="submit" name="save" value="save" accesskey="s">
|
<input type="submit" name="save" value="save" accesskey="s">
|
||||||
<input type="submit" name="preview" value="preview" accesskey="p" formtarget="_blank">
|
<input type="submit" name="preview" value="preview" accesskey="p" formtarget="_blank">
|
||||||
|
<input type="submit" name="links" value="links" accesskey="l">
|
||||||
|
<input type="submit" name="stats" value="stats" accesskey="i">
|
||||||
<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="<? echo $lastchanged; ?>">
|
||||||
|
<?php
|
||||||
|
if (isset($_POST['stats']))
|
||||||
|
{
|
||||||
|
echo '<div class="grey">' . $lines . ' ' . $words . ' ' . $chars . ' ' . $title . '.md</div>';
|
||||||
|
}
|
||||||
|
else if (isset($_POST['links']))
|
||||||
|
{
|
||||||
|
echo linksdiv($content);
|
||||||
|
}?>
|
||||||
<div><input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"></div>
|
<div><input autocomplete="off" class="title" name="title" value="<? 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="<? echo $rows; ?>" autofocus name="content" spellcheck="false"><? echo $content; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
<input hidden name="previoustitle" value="<? echo $title; ?>">
|
<input hidden name="previoustitle" value="<? echo $title; ?>">
|
||||||
<?php
|
|
||||||
echo '<div class="grey">' . $lines . ' ' . $words . ' ' . $chars . ' ' . $title . '.md</div>';
|
|
||||||
echo linksdiv($content);
|
|
||||||
?>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
10
readme.md
10
readme.md
|
@ -14,6 +14,8 @@ No javascript.
|
||||||
|------------------------|----------------------------------|-------------------------------|--------|
|
|------------------------|----------------------------------|-------------------------------|--------|
|
||||||
| search (default action)| full text search | reload home | alt-s |
|
| search (default action)| full text search | reload home | alt-s |
|
||||||
| open | open if exists, or create | create with timestamp as title| alt-o |
|
| open | open if exists, or create | create with timestamp as title| alt-o |
|
||||||
|
| tag | filter list by tag | show all tags in list | alt-t |
|
||||||
|
| clip | insert in todo | | alt-c |
|
||||||
| download | download all notes in a zip file | | alt-d |
|
| download | download all notes in a zip file | | alt-d |
|
||||||
|
|
||||||
| Note page | action with param | hotkey |
|
| Note page | action with param | hotkey |
|
||||||
|
@ -21,10 +23,18 @@ No javascript.
|
||||||
| home (default action) | save and back to home | alt-h |
|
| home (default action) | save and back to home | alt-h |
|
||||||
| save | save | alt-s |
|
| save | save | alt-s |
|
||||||
| preview | save and show markdown preview | alt-p |
|
| preview | save and show markdown preview | alt-p |
|
||||||
|
| links | save and show links | alt-l |
|
||||||
|
| stats | save and show stats | alt-i |
|
||||||
| delete | delete (rename as .del) | alt-d |
|
| delete | delete (rename as .del) | alt-d |
|
||||||
|
|
||||||
|
| On list | action |
|
||||||
|
|------------------------|--------------------------|
|
||||||
|
| clic on tag | filter list by tag (home with tags+param) |
|
||||||
|
|
||||||
| Url params | action |
|
| Url params | action |
|
||||||
|------------------------|--------------------------|
|
|------------------------|--------------------------|
|
||||||
| reindex | force notes reindex |
|
| reindex | force notes reindex |
|
||||||
|
| clip+param | same as button |
|
||||||
| open+param | same as button |
|
| open+param | same as button |
|
||||||
|
| tags+param | same as button |
|
||||||
| search+param | same as button |
|
| search+param | same as button |
|
Loading…
Reference in New Issue