mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
2013-02-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_treeview.php: fixed the cleaned source code. * operation/agentes/networkmap.php: fixed double messages when delete a networkmap. Fixes: #3553703 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7662 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9bcd52d6ee
commit
a208e250ad
@ -1,3 +1,12 @@
|
|||||||
|
2013-02-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_treeview.php: fixed the cleaned source code.
|
||||||
|
|
||||||
|
* operation/agentes/networkmap.php: fixed double messages when
|
||||||
|
delete a networkmap.
|
||||||
|
|
||||||
|
Fixes: #3553703
|
||||||
|
|
||||||
2013-02-15 Miguel de Dios <miguel.dedios@artica.es>
|
2013-02-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/modules/manage_network_components.php,
|
* godmode/modules/manage_network_components.php,
|
||||||
|
@ -54,7 +54,7 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||||||
require_once ("general/noaccess.php");
|
require_once ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="id_div3" width="100%">';
|
echo '<div id="id_div3" width="100%">';
|
||||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%">';
|
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%">';
|
||||||
//Agent name
|
//Agent name
|
||||||
@ -64,14 +64,14 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||||||
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
||||||
else
|
else
|
||||||
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
||||||
|
|
||||||
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
||||||
|
|
||||||
// Parent
|
// Parent
|
||||||
echo '<tr><td class="datos2"><b>'.__('Module group').'</b></td>';
|
echo '<tr><td class="datos2"><b>'.__('Module group').'</b></td>';
|
||||||
echo '<td class="datos2" colspan="2">';
|
echo '<td class="datos2" colspan="2">';
|
||||||
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
||||||
|
|
||||||
if ($module_group === false)
|
if ($module_group === false)
|
||||||
echo __('Not assigned');
|
echo __('Not assigned');
|
||||||
else
|
else
|
||||||
@ -81,12 +81,12 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||||||
echo '<tr><td class="datos2"><b>'.__('Module type').'</b></td>';
|
echo '<tr><td class="datos2"><b>'.__('Module type').'</b></td>';
|
||||||
echo '<td class="datos2" colspan="2">';
|
echo '<td class="datos2" colspan="2">';
|
||||||
echo servers_show_type ($module['id_modulo']);
|
echo servers_show_type ($module['id_modulo']);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Group icon
|
// Group icon
|
||||||
echo '<tr><td class="datos"><b>'.__('Description').'</b></td>';
|
echo '<tr><td class="datos"><b>'.__('Description').'</b></td>';
|
||||||
echo '<td class="datos" colspan="2">'. ui_print_truncate_text ($module['descripcion'], GENERIC_SIZE_TEXT, true, true, true, '[…]') .'</td></tr>';
|
echo '<td class="datos" colspan="2">'. ui_print_truncate_text ($module['descripcion'], GENERIC_SIZE_TEXT, true, true, true, '[…]') .'</td></tr>';
|
||||||
|
|
||||||
//End of table
|
//End of table
|
||||||
echo '</table></div>';
|
echo '</table></div>';
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
@ -97,18 +97,18 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||||||
|
|
||||||
// Actions table
|
// Actions table
|
||||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%; text-align: center;">';
|
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%; text-align: center;">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td><form id="module_detail" method="post" action="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $module['id_agente'] . '&tab=data' . $url_hash . '">';
|
echo '<td><form id="module_detail" method="post" action="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $module['id_agente'] . '&tab=data' . $url_hash . '">';
|
||||||
html_print_submit_button (__('Go to modules detail'), 'upd_button', false, 'class="sub search"');
|
html_print_submit_button (__('Go to modules detail'), 'upd_button', false, 'class="sub search"');
|
||||||
echo '</form></td></tr>';
|
echo '</form></td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function treeview_printAlertsTable($id_module, $server_data = array()) {
|
function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(empty($server_data)) {
|
if(empty($server_data)) {
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = '';
|
$server_id = '';
|
||||||
@ -137,7 +137,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
|||||||
|
|
||||||
echo '<tr><th class="datos"><b>'.__('Template').'</b></th>';
|
echo '<tr><th class="datos"><b>'.__('Template').'</b></th>';
|
||||||
echo '<th class="datos"><b>'.__('Actions').'</b></th>';
|
echo '<th class="datos"><b>'.__('Actions').'</b></th>';
|
||||||
|
|
||||||
foreach($module_alerts as $module_alert) {
|
foreach($module_alerts as $module_alert) {
|
||||||
//Template name
|
//Template name
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
@ -163,9 +163,9 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
|||||||
|
|
||||||
// Actions table
|
// Actions table
|
||||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%; text-align: center;">';
|
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:100%; text-align: center;">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td><form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $agent_id . $url_hash . '&tab=alert" target="_blank">';
|
echo '<td><form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $agent_id . $url_hash . '&tab=alert" target="_blank">';
|
||||||
html_print_submit_button (__('Go to alerts detail'), 'upd_button', false, 'class="sub search"');
|
html_print_submit_button (__('Go to alerts detail'), 'upd_button', false, 'class="sub search"');
|
||||||
echo '</form></td></tr>';
|
echo '</form></td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||||||
$console_url = $server_data['server_url'] . '/';
|
$console_url = $server_data['server_url'] . '/';
|
||||||
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ("include/functions_agents.php");
|
require_once ("include/functions_agents.php");
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
include_graphs_dependencies();
|
include_graphs_dependencies();
|
||||||
@ -789,7 +789,7 @@ function treeview_getData ($type) {
|
|||||||
$sql_search .= " AND estado = " . $select_status . " ";
|
$sql_search .= " AND estado = " . $select_status . " ";
|
||||||
|
|
||||||
$sql_search .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1');
|
$sql_search .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 't1');
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
@ -847,15 +847,15 @@ function treeview_getData ($type) {
|
|||||||
AND ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo" .
|
AND ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo" .
|
||||||
$search_sql .
|
$search_sql .
|
||||||
$user_tags_sql;
|
$user_tags_sql;
|
||||||
|
|
||||||
$list = db_get_all_rows_sql($sql);
|
$list = db_get_all_rows_sql($sql);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($list == false) {
|
if($list == false) {
|
||||||
$list = array();
|
$list = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list as $key => $item) {
|
foreach ($list as $key => $item) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'os':
|
case 'os':
|
||||||
@ -921,22 +921,22 @@ function treeview_getData ($type) {
|
|||||||
$list[$key]['_num_unknown_'] = tags_agent_unknown($id);
|
$list[$key]['_num_unknown_'] = tags_agent_unknown($id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined ('METACONSOLE')) {
|
if (defined ('METACONSOLE')) {
|
||||||
$list[$key]['_id_'] = $list[$key]['_name_'];
|
$list[$key]['_id_'] = $list[$key]['_name_'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get SQL for the first tree branch
|
// Get SQL for the first tree branch
|
||||||
function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel, $search_free) {
|
function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel, $search_free) {
|
||||||
|
|
||||||
if (empty($avariableGroupsIds)) {
|
if (empty($avariableGroupsIds)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO CHANGE POLICY ACL FOR TAG ACL
|
//TODO CHANGE POLICY ACL FOR TAG ACL
|
||||||
$extra_sql = '';
|
$extra_sql = '';
|
||||||
if($extra_sql != '') {
|
if($extra_sql != '') {
|
||||||
@ -950,7 +950,7 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
else {
|
else {
|
||||||
$search_sql = '';
|
$search_sql = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Extract all rows of data for each type
|
//Extract all rows of data for each type
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'group':
|
case 'group':
|
||||||
@ -984,7 +984,7 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
case 'module_group':
|
case 'module_group':
|
||||||
|
|
||||||
$sql = agents_get_agents(array (
|
$sql = agents_get_agents(array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'status' => $statusSel,
|
'status' => $statusSel,
|
||||||
@ -999,9 +999,9 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
(SELECT DISTINCT (id_agente)
|
(SELECT DISTINCT (id_agente)
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_module_group = ' . $id . ')';
|
WHERE id_module_group = ' . $id . ')';
|
||||||
|
|
||||||
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'policies':
|
case 'policies':
|
||||||
|
|
||||||
@ -1038,9 +1038,9 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
AND tagente.id_agente NOT IN (SELECT tagente_estado.id_agente
|
AND tagente.id_agente NOT IN (SELECT tagente_estado.id_agente
|
||||||
FROM tagente_estado)";
|
FROM tagente_estado)";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'module':
|
case 'module':
|
||||||
//Replace separator token "articapandora_32_pandoraartica_" for " "
|
//Replace separator token "articapandora_32_pandoraartica_" for " "
|
||||||
@ -1048,9 +1048,9 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
//"Load_articapandora_32_pandoraartica_Average"
|
//"Load_articapandora_32_pandoraartica_Average"
|
||||||
//result -> "Load Average"
|
//result -> "Load Average"
|
||||||
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id);
|
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id);
|
||||||
|
|
||||||
$name = io_safe_input(io_safe_output($name));
|
$name = io_safe_input(io_safe_output($name));
|
||||||
|
|
||||||
$sql = agents_get_agents(array (
|
$sql = agents_get_agents(array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'status' => $statusSel,
|
'status' => $statusSel,
|
||||||
@ -1066,9 +1066,9 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
WHERE nombre = \'%s\' AND disabled = 0
|
WHERE nombre = \'%s\' AND disabled = 0
|
||||||
)
|
)
|
||||||
', $name);
|
', $name);
|
||||||
|
|
||||||
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
$sql .= 'ORDER BY nombre COLLATE utf8_general_ci ASC';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'tag':
|
case 'tag':
|
||||||
if (defined ('METACONSOLE')) {
|
if (defined ('METACONSOLE')) {
|
||||||
@ -1090,14 +1090,14 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT tagente.*
|
$sql = "SELECT tagente.*
|
||||||
FROM tagente, tagente_modulo, ttag_module
|
FROM tagente, tagente_modulo, ttag_module
|
||||||
WHERE tagente.id_agente = tagente_modulo.id_agente
|
WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||||
AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
|
AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
|
||||||
AND ttag_module.id_tag = " . $id . $groups_condition;
|
AND ttag_module.id_tag = " . $id . $groups_condition;
|
||||||
$sql .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 'tagente_modulo');
|
$sql .= tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 'tagente_modulo');
|
||||||
|
|
||||||
$sql .= ' AND tagente.disabled = 0'. $search_sql;
|
$sql .= ' AND tagente.disabled = 0'. $search_sql;
|
||||||
|
|
||||||
$sql .= ' ORDER BY tagente.nombre COLLATE utf8_general_ci ASC';
|
$sql .= ' ORDER BY tagente.nombre COLLATE utf8_general_ci ASC';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1163,8 +1163,10 @@ function treeview_getSecondBranchSQL ($fatherType, $id, $id_father) {
|
|||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM tagente_modulo AS t1
|
FROM tagente_modulo AS t1
|
||||||
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
INNER JOIN tagente_estado AS t2
|
||||||
WHERE t1.id_agente = ' . $id . ' AND nombre = \'' . io_safe_input($name) . '\'';
|
ON t1.id_agente_modulo = t2.id_agente_modulo
|
||||||
|
WHERE t1.id_agente = ' . $id . '
|
||||||
|
AND nombre = \'' . io_safe_input($name) . '\'';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1179,16 +1181,17 @@ function treeview_getSecondBranchSQL ($fatherType, $id, $id_father) {
|
|||||||
if ($id_father === false) {
|
if ($id_father === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$sql = 'SELECT * FROM tagente_modulo, tagente_estado, ttag_module
|
$sql = 'SELECT *
|
||||||
WHERE tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
|
FROM tagente_modulo, tagente_estado, ttag_module
|
||||||
|
WHERE tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
|
||||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
AND tagente_modulo.id_agente=' . $id . ' AND ttag_module.id_tag = ' . $id_father;
|
AND tagente_modulo.id_agente=' . $id . '
|
||||||
|
AND ttag_module.id_tag = ' . $id_father;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This line checks for initializated modules or (non-initialized) asyncronous modules
|
// This line checks for initializated modules or (non-initialized) asyncronous modules
|
||||||
$sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23))';
|
$sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23))';
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -44,8 +44,6 @@ if ($delete_networkmap) {
|
|||||||
$message = ui_print_result_message ($result,
|
$message = ui_print_result_message ($result,
|
||||||
__('Network map deleted successfully'),
|
__('Network map deleted successfully'),
|
||||||
__('Could not delete network map'), '', true);
|
__('Could not delete network map'), '', true);
|
||||||
|
|
||||||
echo $message;
|
|
||||||
|
|
||||||
$id_networkmap = 0;
|
$id_networkmap = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user