mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-24 06:15:16 +02:00
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/messages/message_edit.php, operation/reporting/reporting_xml.php, operation/reporting/graph_viewer.php, operation/agentes/exportdata.php, operation/agentes/group_view.php, operation/agentes/status_monitor.php, godmode/agentes/configurar_agente.php, include/functions_agents.php: cleaned source code style. * godmode/agentes/module_manager.php: fixed the messages for to delete multiple modules. Fixes: #3543532 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6807 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b11e18e18d
commit
e6ae8a76e0
@ -1,3 +1,18 @@
|
||||
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/messages/message_edit.php,
|
||||
operation/reporting/reporting_xml.php,
|
||||
operation/reporting/graph_viewer.php,
|
||||
operation/agentes/exportdata.php, operation/agentes/group_view.php,
|
||||
operation/agentes/status_monitor.php,
|
||||
godmode/agentes/configurar_agente.php, include/functions_agents.php:
|
||||
cleaned source code style.
|
||||
|
||||
* godmode/agentes/module_manager.php: fixed the messages for to
|
||||
delete multiple modules.
|
||||
|
||||
Fixes: #3543532
|
||||
|
||||
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/setup/file_manager.php, godmode/setup/news.php,
|
||||
|
@ -31,7 +31,8 @@ $search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", "
|
||||
echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
echo '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >';
|
||||
echo "<tr><td class='datos' style='width:25%'>";
|
||||
echo __('Search').' '.html_print_input_text ('search_string', $search_string, '', 15, 255, true);
|
||||
echo __('Search') . ' ' .
|
||||
html_print_input_text ('search_string', $search_string, '', 15, 255, true);
|
||||
echo "</td>";
|
||||
echo "<td class='datos' style='width:25%'>";
|
||||
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
|
||||
@ -99,6 +100,7 @@ $multiple_delete = (bool) get_parameter('multiple_delete');
|
||||
if ($multiple_delete) {
|
||||
$id_agent_modules_delete = (array)get_parameter('id_delete');
|
||||
|
||||
$count_correct_delete_modules = 0;
|
||||
foreach($id_agent_modules_delete as $id_agent_module_del) {
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
|
||||
@ -112,7 +114,7 @@ if ($multiple_delete) {
|
||||
if ($id_agent_module_del < 1) {
|
||||
db_pandora_audit("HACK Attempt",
|
||||
"Expected variable from form is not correct");
|
||||
die ("Nice try buddy");
|
||||
die (__("Nice try buddy"));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -150,7 +152,6 @@ if ($multiple_delete) {
|
||||
if ($result === false)
|
||||
$error++;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||
@ -188,11 +189,27 @@ if ($multiple_delete) {
|
||||
//Check for errors
|
||||
if ($error != 0) {
|
||||
db_process_sql_rollback ();
|
||||
ui_print_error_message (__('There was a problem deleting the module'));
|
||||
}
|
||||
else {
|
||||
db_process_sql_commit ();
|
||||
ui_print_success_message (__('Module deleted succesfully'));
|
||||
$count_correct_delete_modules++;
|
||||
}
|
||||
}
|
||||
|
||||
$count_modules_to_delete = count($id_agent_modules_delete);
|
||||
if ($count_correct_delete_modules == 0) {
|
||||
ui_print_error_message(
|
||||
sprintf(__('There was a problem deleting %s modules, none deleted.'),
|
||||
$count_modules_to_delete));
|
||||
}
|
||||
else {
|
||||
if ($count_correct_delete_modules == $count_modules_to_delete) {
|
||||
ui_print_success_message (__('All Modules deleted succesfully'));
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(
|
||||
sprintf(__('There was a problem only deleted %s modules of %s total.'),
|
||||
count_correct_delete_modules, $count_modules_to_delete));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,10 +343,11 @@ foreach($order as $ord) {
|
||||
$limit = (int) $config["block_size"];
|
||||
$offset = (int) get_parameter ('offset');
|
||||
|
||||
$params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'nombre',
|
||||
'max', 'min', 'module_interval', 'id_modulo', 'id_module_group',
|
||||
'disabled','max_warning', 'min_warning', 'str_warning',
|
||||
'max_critical', 'min_critical', 'str_critical'));
|
||||
$params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo',
|
||||
'descripcion', 'nombre', 'max', 'min', 'module_interval',
|
||||
'id_modulo', 'id_module_group', 'disabled','max_warning',
|
||||
'min_warning', 'str_warning', 'max_critical', 'min_critical',
|
||||
'str_critical'));
|
||||
|
||||
$where = sprintf("delete_pending = 0 AND id_agente = %s", $id_agente);
|
||||
|
||||
@ -344,7 +362,9 @@ switch ($config["dbtype"]) {
|
||||
if(!isset($limit_sql)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
$sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s %s",
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo
|
||||
WHERE %s (%s %s) %s %s",
|
||||
$params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql);
|
||||
|
||||
$modules = db_get_all_rows_sql($sql);
|
||||
@ -353,13 +373,17 @@ switch ($config["dbtype"]) {
|
||||
$set = array();
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s",
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo
|
||||
WHERE %s (%s %s) %s",
|
||||
$params, $basic_where, $extra_sql, $where, $order_sql);
|
||||
$modules = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo WHERE %s (%s %s)", $basic_where, $extra_sql, $where);
|
||||
$sql_total_modules = sprintf("SELECT count(*)
|
||||
FROM tagente_modulo
|
||||
WHERE %s (%s %s)", $basic_where, $extra_sql, $where);
|
||||
|
||||
$total_modules = db_get_value_sql($sql_total_modules);
|
||||
|
||||
|
@ -1702,7 +1702,6 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
||||
else {
|
||||
return AGENT_MODULE_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1948,7 +1947,6 @@ function agents_monitor_unknown ($id_agent, $filter="") {
|
||||
}
|
||||
|
||||
// Get ok monitors by using the status code in modules.
|
||||
|
||||
function agents_monitor_ok ($id_agent, $filter="") {
|
||||
|
||||
if ($filter) {
|
||||
|
@ -307,7 +307,8 @@ if (empty($export_btn)) {
|
||||
|
||||
if ($group > 0) {
|
||||
$filter['id_grupo'] = (array) $group;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter['id_grupo'] = array_keys ($groups);
|
||||
}
|
||||
|
||||
@ -331,7 +332,8 @@ if (empty($export_btn)) {
|
||||
|
||||
if ($agent > 0) {
|
||||
$modules = agents_get_modules ($agent);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$modules = array ();
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,8 @@ foreach($groups_full as $group) {
|
||||
|
||||
if ($config["realtimestats"] == 0){
|
||||
$updated_time = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$updated_time = __("Updated at realtime");
|
||||
}
|
||||
|
||||
@ -81,9 +82,7 @@ $counter = 1;
|
||||
$agents = agents_get_group_agents(array_keys($groups));
|
||||
|
||||
if (count($agents) > 0) {
|
||||
|
||||
echo '<table cellpadding="0" style="margin-top:10px" cellspacing="0" border="0" width="98%">';
|
||||
|
||||
echo "<tr>";
|
||||
echo "<th width='25%'>".__("Group")."</th>";
|
||||
echo "<th>";
|
||||
@ -104,9 +103,10 @@ foreach ($groups as $id_group => $group) {
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
} else {
|
||||
echo "<div class='nf'>".__('There are no defined agents')."</div>";
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>" . __('There are no defined agents') .
|
||||
"</div>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -671,7 +671,8 @@ foreach ($result as $row) {
|
||||
|
||||
if ($row['estado'] == 3){
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$option = array ();
|
||||
}
|
||||
$data[9] = ui_print_timestamp ($row["utimestamp"], true, $option);
|
||||
@ -680,8 +681,11 @@ foreach ($result as $row) {
|
||||
}
|
||||
if (!empty ($table->data)) {
|
||||
html_print_table ($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('This group doesn\'t have any monitor').'</div>';
|
||||
}
|
||||
else {
|
||||
echo '<div class="nf">' .
|
||||
__('This group doesn\'t have any monitor') .
|
||||
'</div>';
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -156,7 +156,8 @@ $table->data[0][0] = __('Sender');
|
||||
|
||||
if (!empty($own_info['fullname'])) {
|
||||
$table->data[0][1] = $own_info['fullname'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$table->data[0][1] = $config['id_user'];
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,8 @@ if ($view_graph) {
|
||||
$report["datetime"] = $datetime;
|
||||
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
||||
echo '<h3 class="error">' . __('Invalid date selected') .
|
||||
'</h3>';
|
||||
return;
|
||||
}
|
||||
return;
|
||||
@ -226,8 +227,8 @@ if (! empty ($graphs)) {
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
html_print_table ($table);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined reportings')."</div>";
|
||||
}
|
||||
|
||||
?>
|
@ -22,13 +22,15 @@ function xml_array ($array) {
|
||||
if (is_int ($name)) {
|
||||
echo "<object id=\"".$name."\">";
|
||||
$name = "object";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<".$name.">";
|
||||
}
|
||||
|
||||
if (is_array ($value)) {
|
||||
xml_array ($value);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo $value;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user