From d31f834a1d2a06901835f447d81e5b4eab714edc Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Wed, 6 Mar 2024 12:14:08 +0100 Subject: [PATCH] change merge filter and search --- home.php | 1 - index.php | 14 +++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/home.php b/home.php index 348ad44..521e325 100644 --- a/home.php +++ b/home.php @@ -2,7 +2,6 @@
- diff --git a/index.php b/index.php index 60580b1..b866826 100644 --- a/index.php +++ b/index.php @@ -25,10 +25,6 @@ { $action = 'open'; } - else if (isset($_GET['filter'])) - { - $action = 'filter'; - } else if (isset($_GET['search'])) { $action = 'search'; @@ -181,14 +177,14 @@ { $tags = ''; $name = basename($path); - if (!str_ends_with($name, '.del') && ($action != 'filter' || str_contains(strtolower($name), strtolower($param)))) + if (!str_ends_with($name, '.del')) { 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))) + if (($action == 'search' && !str_contains(strtolower($content), strtolower($param)) && !str_contains(strtolower($name), strtolower($param))) + || ($action == 'tags' && !preg_match('/tags:.*' . $param . '/i', $content))) { continue; } @@ -210,10 +206,10 @@ echo ''; } } - else if ($action == 'search') + else if ($action == 'search' && str_contains(strtolower($content), strtolower($param))) { $pos = strpos(strtolower($content), strtolower($param)); - echo ' ' . $param . '' . substr($content, $pos + strlen($param), 42) . ''; + echo ' ' . $param . substr($content, $pos + strlen($param), 42) . ''; } echo'
'; }