mirror of
https://github.com/vrana/adminer.git
synced 2025-08-13 10:04:07 +02:00
Add support for "where" field privilege
In Elasticsearch, only indexed fields are searchable.
This commit is contained in:
@@ -11,6 +11,7 @@ parse_str($_COOKIE["adminer_import"], $adminer_import);
|
||||
|
||||
$rights = array(); // privilege => 0
|
||||
$columns = array(); // selectable columns
|
||||
$search_columns = array(); // searchable columns
|
||||
$text_length = null;
|
||||
foreach ($fields as $key => $field) {
|
||||
$name = $adminer->fieldName($field);
|
||||
@@ -20,6 +21,9 @@ foreach ($fields as $key => $field) {
|
||||
$text_length = $adminer->selectLengthProcess();
|
||||
}
|
||||
}
|
||||
if (isset($field["privileges"]["where"]) && $name != "") {
|
||||
$search_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
|
||||
}
|
||||
$rights += $field["privileges"];
|
||||
}
|
||||
|
||||
@@ -252,7 +256,7 @@ if (!$columns && support("table")) {
|
||||
echo '<input type="hidden" name="select" value="' . h($TABLE) . '">';
|
||||
echo "</div>\n";
|
||||
$adminer->selectColumnsPrint($select, $columns);
|
||||
$adminer->selectSearchPrint($where, $columns, $indexes);
|
||||
$adminer->selectSearchPrint($where, $search_columns, $indexes);
|
||||
$adminer->selectOrderPrint($order, $columns, $indexes);
|
||||
$adminer->selectLimitPrint($limit);
|
||||
$adminer->selectLengthPrint($text_length);
|
||||
@@ -343,7 +347,7 @@ if (!$columns && support("table")) {
|
||||
echo apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
|
||||
echo "<span class='column hidden'>";
|
||||
echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
|
||||
if (!$val["fun"]) {
|
||||
if (!$val["fun"] && isset($field["privileges"]["where"])) {
|
||||
echo '<a href="#fieldset-search" title="' . lang('Search') . '" class="text jsonly"> =</a>';
|
||||
echo script("qsl('a').onclick = partial(selectSearch, '" . js_escape($key) . "');");
|
||||
}
|
||||
|
Reference in New Issue
Block a user