Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Possibility to negates value in search #87

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions htdocs/advancedsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@
} else {
$value = '*' . ldap_escape($value, "", LDAP_ESCAPE_FILTER) . '*';
}
if (isset($_POST[$item."negates"]) and ($_POST[$item."negates"] == 'true')) {
$ldap_filter .= "(!";
}
$ldap_filter .= "($attribute=$value)";
if (isset($_POST[$item."negates"]) and ($_POST[$item."negates"] == 'true')) {
$ldap_filter .= ")";
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions lang/en.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$messages['logout'] = "Logout";
$messages['noentriesfound'] = "No entries found";
$messages['notdefined'] = "Not defined";
$messages['negates'] = "Check to negates this value";
$messages['search'] = "Search";
$messages['search_object'] = "Objects to search";
$messages['searchrequired'] = "Please enter your search";
Expand Down
1 change: 1 addition & 0 deletions lang/fr.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$messages['logout'] = "Déconnexion";
$messages['noentriesfound'] = "Aucune entrée trouvée";
$messages['notdefined'] = "Non renseigné";
$messages['negates'] = "Cocher la case pour nier la valeur";
$messages['search'] = "Rechercher";
$messages['search_object'] = "Objets à rechercher";
$messages['searchrequired'] = "Veuillez saisir votre recherche";
Expand Down
1 change: 1 addition & 0 deletions lang/it.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$messages['logout'] = "Esci";
$messages['noentriesfound'] = "Nessun record trovato";
$messages['notdefined'] = "Non definito";
$messages['negates'] = "Check to negates this value";
$messages['search'] = "Cerca";
$messages['search_object'] = "Oggetti da cercare";
$messages['searchrequired'] = "Inserisci il termine di ricerca";
Expand Down
10 changes: 8 additions & 2 deletions templates/search_displayer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@
<input type="text" class="form-control" id="{$item}to" name="{$item}to" data-provide="datepicker" data-date-language="{$lang}">
{elseif $type eq 'guid' or $type eq 'dn_link' or $type eq 'group_dn_link' or $type eq 'usergroup_dn_link' }
<input type="text" class="form-control" id="{$item}" name="{$item}" placeholder="{$label}">
<span class="input-group-addon btn-info"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-danger"><input type="checkbox" name="{$item}negates" value="true" data-toggle="popover" data-content="{$msg_negates}"></span>
{elseif $type eq 'list'}
<select class="form-control" id="{$item}" name="{$item}" placeholder="{$label}">
<option></option>
{foreach $list as $value}
<option value="{$value@key}">{$value}</option>
{/foreach}
</select>
<span class="input-group-addon"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-info"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-danger"><input type="checkbox" name="{$item}negates" value="true" data-toggle="popover" data-content="{$msg_negates}"></span>
{elseif $type eq 'bytes'}
<input type="number" class="form-control" id="{$item}" name="{$item}" placeholder="{$label}">
<span class="input-group-addon btn-info"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-danger"><input type="checkbox" name="{$item}negates" value="true" data-toggle="popover" data-content="{$msg_negates}"></span>
{else}
<input type="text" class="form-control" id="{$item}" name="{$item}" placeholder="{$label}">
<span class="input-group-addon"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-info"><input type="checkbox" name="{$item}match" value="exact" data-toggle="popover" data-content="{$msg_exactmatch}"></span>
<span class="input-group-addon btn-danger"><input type="checkbox" name="{$item}negates" value="true" data-toggle="popover" data-content="{$msg_negates}"></span>
{/if}
</div>
</div>
Expand Down