diff --git a/home.php b/home.php
index 0bc30cc..348ad44 100644
--- a/home.php
+++ b/home.php
@@ -10,58 +10,3 @@
-
-
-
' . $name .'';
- if ($action == 'tags')
- {
- $tags = array();
- $hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
- if ($hastags)
- {
- $tagslist = explode(',', $tags[0][1]);
- echo '
';
- foreach ($tagslist as $tag)
- {
- $tag = trim($tag);
- echo('' . $tag . ' ');
- }
- echo '';
- }
- }
- else if ($action == 'search')
- {
- $pos = strpos(strtolower($content), strtolower($param));
- echo '
' . $param . '' . substr($content, $pos + strlen($param), 42) . '';
- }
- echo'
';
- }
-}
-
-?>
-
-
diff --git a/index.php b/index.php
index ccb2eb1..60580b1 100644
--- a/index.php
+++ b/index.php
@@ -127,7 +127,40 @@
{
$content = file_get_contents($dir . '/' . $title);
}
+
+ $lines = substr_count($content, "\r\n") + 1;
+ $words = $lines + substr_count($content, " ");
+ $rows = max(20, $lines) * 2;
+ $length = strlen($content);
+
require('note.php');
+
+ $links = array();
+ if (preg_match_all('/\[\[(.*)\]\]/', $content, $links, PREG_SET_ORDER))
+ {
+ echo '';
+ $files = glob($dir . '/*');
+ usort($files, function($a, $b)
+ {
+ return filemtime($b) - filemtime($a);
+ });
+
+ foreach($files as $path)
+ {
+ $tags = '';
+ $name = basename($path);
+ if (!str_ends_with($name, '.del') && ($action != 'filter' || str_contains(strtolower($name), strtolower($param))))
+ {
+ if ($action == 'search' || $action == 'tags')
+ {
+ $content = file_get_contents($path);
+
+ if (($action == 'search' && !str_contains(strtolower($content), strtolower($param))) ||
+ ($action == 'tags' && !preg_match('/tags:.*' . $param . '/i', $content)))
+ {
+ continue;
+ }
+ }
+ echo '
' . $name .'';
+ if ($action == 'tags')
+ {
+ $tags = array();
+ $hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
+ if ($hastags)
+ {
+ $tagslist = explode(',', $tags[0][1]);
+ echo '
';
+ foreach ($tagslist as $tag)
+ {
+ $tag = trim($tag);
+ echo('' . $tag . ' ');
+ }
+ echo '';
+ }
+ }
+ else if ($action == 'search')
+ {
+ $pos = strpos(strtolower($content), strtolower($param));
+ echo '
' . $param . '' . substr($content, $pos + strlen($param), 42) . '';
+ }
+ echo'
';
+ }
+ }
+
+ echo '
';
}
?>