mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Added disable agents in policy when js is crazy
This commit is contained in:
parent
581b6cbae2
commit
bc077c8a7d
@ -35,6 +35,7 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
$get_group_json = (bool) get_parameter ('get_group_json');
|
$get_group_json = (bool) get_parameter ('get_group_json');
|
||||||
$get_group_agents = (bool) get_parameter ('get_group_agents');
|
$get_group_agents = (bool) get_parameter ('get_group_agents');
|
||||||
|
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
|
||||||
|
|
||||||
if ($get_group_json) {
|
if ($get_group_json) {
|
||||||
$id_group = (int) get_parameter ('id_group');
|
$id_group = (int) get_parameter ('id_group');
|
||||||
@ -70,6 +71,7 @@ if (is_ajax ()) {
|
|||||||
$search = (string) get_parameter ('search', '');
|
$search = (string) get_parameter ('search', '');
|
||||||
$recursion = (int) get_parameter ('recursion', 0);
|
$recursion = (int) get_parameter ('recursion', 0);
|
||||||
$privilege = (string) get_parameter ('privilege', '');
|
$privilege = (string) get_parameter ('privilege', '');
|
||||||
|
$all_agents = (int) get_parameter ('all_agents', 0);
|
||||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||||
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
||||||
@ -96,7 +98,12 @@ if (is_ajax ()) {
|
|||||||
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
|
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($all_agents) {
|
||||||
|
$filter['all_agents'] = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
$filter['disabled'] = $disabled;
|
$filter['disabled'] = $disabled;
|
||||||
|
}
|
||||||
|
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
$filter['string'] = $search;
|
$filter['string'] = $search;
|
||||||
@ -126,18 +133,43 @@ if (is_ajax ()) {
|
|||||||
false, $recursion, false, '|', $add_alert_bulk_op);
|
false, $recursion, false, '|', $add_alert_bulk_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$agents_disabled = array();
|
||||||
// Add keys prefix
|
// Add keys prefix
|
||||||
if ($keys_prefix !== "") {
|
if ($keys_prefix !== "") {
|
||||||
foreach($agents as $k => $v) {
|
foreach($agents as $k => $v) {
|
||||||
$agents[$keys_prefix . $k] = $v;
|
$agents[$keys_prefix . $k] = $v;
|
||||||
unset($agents[$k]);
|
unset($agents[$k]);
|
||||||
|
if ($all_agents) {
|
||||||
|
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
|
||||||
|
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($all_agents) {
|
||||||
|
$all_agents_array = array();
|
||||||
|
$all_agents_array['agents'] = $agents;
|
||||||
|
$all_agents_array['agents_disabled'] = $agents_disabled;
|
||||||
|
|
||||||
|
$agents = $all_agents_array;
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode ($agents);
|
echo json_encode ($agents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($get_is_disabled) {
|
||||||
|
$index = get_parameter('id_agent');
|
||||||
|
|
||||||
|
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $index));
|
||||||
|
|
||||||
|
$return['disabled'] = $agent_disabled;
|
||||||
|
$return['id_agent'] = $index;
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user