change merge filter and search
This commit is contained in:
parent
cc57cbfab1
commit
d31f834a1d
1
home.php
1
home.php
|
@ -2,7 +2,6 @@
|
|||
<div>
|
||||
<input type="submit" name="home" value="home" accesskey="h">
|
||||
<input type="submit" name="open" value="open">
|
||||
<input type="submit" name="filter" value="filter">
|
||||
<input type="submit" name="search" value="search">
|
||||
<input type="submit" name="tags" value="tags">
|
||||
<input type="submit" name="clip" value="clip">
|
||||
|
|
14
index.php
14
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 '</span>';
|
||||
}
|
||||
}
|
||||
else if ($action == 'search')
|
||||
else if ($action == 'search' && str_contains(strtolower($content), strtolower($param)))
|
||||
{
|
||||
$pos = strpos(strtolower($content), strtolower($param));
|
||||
echo '<span class="grey"> <b>' . $param . '</b>' . substr($content, $pos + strlen($param), 42) . '</span>';
|
||||
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
||||
}
|
||||
echo'</div>';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue