Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(ui): saving configuration > meta services filters
Browse files Browse the repository at this point in the history
  • Loading branch information
sc979 committed Apr 1, 2019
1 parent 65fed65 commit 214d142
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,26 @@

include "./include/common/autoNumLimit.php";

$search = null;
if (isset($_POST['searchMS'])) {
$search = $_POST['searchMS'];
$centreon->historySearch[$url] = $search;
} elseif (isset($_GET['searchMS'])) {
$search = $_GET['searchMS'];
$centreon->historySearch[$url] = $search;
} elseif (isset($centreon->historySearch[$url])) {
$search = $centreon->historySearch[$url];
$search = filter_var(
$_POST['searchMS'] ?? $_GET['searchMS'] ?? null,
FILTER_SANITIZE_STRING
);

if (isset($_POST['searchMS']) || isset($_GET['searchMS'])) {
//initializing filters values
$centreon->historySearch[$url] = array();
$centreon->historySearch[$url]["searchMS"] = $search;
} else {
//restoring saved values
$search = $centreon->historySearch[$url]["searchMS"] ?? null;
}

/*
* Meta Service list
*/
$rq = "SELECT SQL_CALC_FOUND_ROWS * FROM meta_service ";
if ($search) {
$rq .= "WHERE meta_name LIKE '%" . htmlentities($search, ENT_QUOTES, "UTF-8") . "%' " .
$rq .= "WHERE meta_name LIKE '%" . $search . "%' " .
$acl->queryBuilder("AND", "meta_id", $metaStr);
} else {
$rq .= $acl->queryBuilder("WHERE", "meta_id", $metaStr);
Expand Down Expand Up @@ -96,7 +99,7 @@
*/
if ($search) {
$rq = "SELECT * FROM meta_service " .
"WHERE meta_name LIKE '%" . htmlentities($search, ENT_QUOTES, "UTF-8") . "%' " .
"WHERE meta_name LIKE '%" . $search . "%' " .
$acl->queryBuilder("AND", "meta_id", $metaStr) .
" ORDER BY meta_name LIMIT " . $num * $limit . ", " . $limit;
} else {
Expand Down

0 comments on commit 214d142

Please sign in to comment.