Skip to content
Permalink
Browse files

fixes #1 ability to limit search on specific fields

  • Loading branch information...
plegall committed Oct 18, 2019
1 parent 8cf3cb2 commit 092d79b6b495c24c15520ff7aa84bf340d19cba6
Showing with 25 additions and 1 deletion.
  1. +25 −1 main.inc.php
@@ -88,7 +88,31 @@ function search_links_init_fake_search()
if (isset($_GET['word']))
{
$_POST['search_allwords'] = $_GET['word'];
$_POST['fields'] = array('file', 'name', 'comment');
// on which fields?
$basic_fields = array('file', 'name', 'comment');
$_POST['fields'] = array();
if (isset($_GET['fields']))
{
$user_fields = array();
foreach (explode(',', $_GET['fields']) as $field)
{
$field = trim($field);
if (in_array($field, $basic_fields))
{
$_POST['fields'][] = $field;
}
}
if (count($_POST['fields']) == 0)
{
die("invalid fields");
}
}
else
{
$_POST['fields'] = $basic_fields;
}
$is_search_link = true;
}

0 comments on commit 092d79b

Please sign in to comment.
You can’t perform that action at this time.