2012-07-26 Miguel de Dios <miguel.dedios@artica.es>

* operation/users/user_edit.php,
	operation/events/events_validate.php, operation/search_graphs.php,
	godmode/events/event_filter.php, godmode/events/custom_events.php,
	godmode/massive/massive_standby_alerts.php,
	godmode/massive/massive_copy_modules.php, godmode/tag/tag.php,
	godmode/netflow/nf_report.php, godmode/agentes/configure_field.php,
	godmode/agentes/agent_manager.php,
	godmode/agentes/agent_template.php,
	godmode/agentes/fields_manager.php,
	godmode/servers/recon_script.php, godmode/servers/plugin.php,
	include/functions_modules.php: improved the source structure.
	
	* operation/search_modules.php: fixed the search when the modules
	haven't inicialiced.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6814 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-26 11:05:05 +00:00
parent bf7356ecb3
commit 915065cbcb
18 changed files with 261 additions and 210 deletions

View File

@ -1,3 +1,20 @@
2012-07-26 Miguel de Dios <miguel.dedios@artica.es>
* operation/users/user_edit.php,
operation/events/events_validate.php, operation/search_graphs.php,
godmode/events/event_filter.php, godmode/events/custom_events.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_copy_modules.php, godmode/tag/tag.php,
godmode/netflow/nf_report.php, godmode/agentes/configure_field.php,
godmode/agentes/agent_manager.php,
godmode/agentes/agent_template.php,
godmode/agentes/fields_manager.php,
godmode/servers/recon_script.php, godmode/servers/plugin.php,
include/functions_modules.php: improved the source structure.
* operation/search_modules.php: fixed the search when the modules
haven't inicialiced.
2012-07-26 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php: Change the sort function

View File

@ -185,7 +185,6 @@ $table->data[0][0] = __('Agent name') .
$table->data[0][1] = html_print_input_text ('agente', $nombre_agente, '', 50, 100,true);
if ($id_agente) {
$table->data[0][1] .= "&nbsp;<b>".__("ID")."</b>&nbsp; $id_agente &nbsp;";
$table->data[0][1] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">';
$table->data[0][1] .= html_print_image ("images/lupa.png", true, array ("border" => 0, "title" => __('Agent detail')));

View File

@ -40,7 +40,8 @@ if (isset ($_POST["template_id"])) {
$os_version = $row["os_version"];
$agent_version = $row["agent_version"];
$disabled= $row["disabled"];
} else {
}
else {
return;
}
@ -142,14 +143,20 @@ echo '</form>';
// ==========================
// MODULE VISUALIZATION TABLE
// ==========================
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = sprintf ("SELECT * FROM tagente_modulo WHERE id_agente = %d AND delete_pending = false ORDER BY id_module_group, nombre", $id_agente);
$sql = sprintf ("SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND delete_pending = false
ORDER BY id_module_group, nombre", $id_agente);
break;
case "oracle":
$sql = sprintf ("SELECT * FROM tagente_modulo WHERE id_agente = %d AND (delete_pending <> 1 AND delete_pending IS NOT NULL) ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)", $id_agente);
$sql = sprintf ("SELECT *
FROM tagente_modulo
WHERE id_agente = %d
AND (delete_pending <> 1 AND delete_pending IS NOT NULL)
ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)", $id_agente);
break;
}
$result = db_get_all_rows_sql ($sql);
@ -179,7 +186,8 @@ foreach ($result as $row) {
$data[0] = '<span style="font-size: 7.2pt">' . $row["nombre"];
if ($row["id_tipo_modulo"] > 0) {
$data[1] = html_print_image("images/" . modules_show_icon_type ($row["id_tipo_modulo"]), true, array("border" => "0"));
} else {
}
else {
$data[1] = '';
}
$data[2] = mb_substr ($row["descripcion"], 0, 60);
@ -194,8 +202,8 @@ foreach ($result as $row) {
if (!empty ($table->data)) {
html_print_table ($table);
unset ($table);
} else {
}
else {
echo '<div class="nf">No modules</div>';
}
?>

View File

@ -34,7 +34,8 @@ if ($id_field) {
$name = $field['name'];
$display_on_front = $field['display_on_front'];
ui_print_page_header (__("Update agent custom field"), "images/note.png", false, "", true, "");
} else {
}
else {
ui_print_page_header (__("Create agent custom field"), "images/note.png", false, "", true, "");
}
@ -54,7 +55,8 @@ if ($id_field) {
html_print_input_hidden ('update_field', 1);
html_print_input_hidden ('id_field', $id_field);
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
} else {
}
else {
html_print_input_hidden ('create_field', 1);
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
}

View File

@ -42,9 +42,11 @@ if ($create_field) {
/*Check if name field is empty*/
if ($name == ""){
echo "<h3 class='error'>".__('The name must not be empty')."</h3>";
} else if ($name == db_get_value ('name', 'tagent_custom_fields', 'name', $name)) {
}
else if ($name == db_get_value ('name', 'tagent_custom_fields', 'name', $name)) {
echo "<h3 class='error'>".__('The name must be unique')."</h3>";
} else {
}
else {
$result = db_process_sql_insert('tagent_custom_fields', array('name' => $name, 'display_on_front' => $display_on_front));
echo "<h3 class='suc'>".__('Field successfully created')."</h3>";
}

View File

@ -35,13 +35,15 @@ $fields_selected = explode (',', $config['event_fields']);
if ($default != 0) {
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
$fields_selected = explode (',', $event_fields);
} else if ($update != '') {
}
else if ($update != '') {
$fields_selected = (array)get_parameter('fields_selected');
if ($fields_selected[0] == '') {
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
$fields_selected = explode (',', $event_fields);
} else {
}
else {
$event_fields = implode (',', $fields_selected);
}
@ -201,6 +203,4 @@ $(document).ready (function () {
});
});
});
</script>

View File

@ -61,7 +61,8 @@ if ($delete){
if ($result !== false) {
$result = true;
} else {
}
else {
$result = false;
}

View File

@ -265,7 +265,8 @@ $(document).ready (function () {
module_alerts = Array ();
if (! data) {
no_alerts = true;
} else {
}
else {
jQuery.each (data, function (i, val) {
module_name = $("<em></em>").append (val["module_name"]);
option = $("<option></option>")
@ -287,12 +288,14 @@ $(document).ready (function () {
$("span.without_modules, span.without_alerts").show ();
$("span.with_modules, span.with_alerts, #target_table-operations").hide ();
} else {
}
else {
if (no_modules) {
$("span.without_modules").show ();
$("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck ();
} else {
}
else {
$("span.without_modules").hide ();
$("span.with_modules").show ();
$("#checkbox-copy_modules").check ();
@ -302,7 +305,8 @@ $(document).ready (function () {
$("span.without_alerts").show ();
$("span.with_alerts").hide ();
$("#checkbox-copy_alerts").uncheck ();
} else {
}
else {
$("span.without_alerts").hide ();
$("span.with_alerts").show ();
$("#checkbox-copy_alerts").check ();

View File

@ -207,7 +207,8 @@ $(document).ready (function () {
if (this.value != 0) {
$("#id_not_standby_alerts").enable ();
$("#id_standby_alerts").enable ();
} else {
}
else {
$("#id_group, #id_not_standby_alerts").disable ();
$("#id_group, #id_standby_alerts").disable ();
}

View File

@ -119,7 +119,6 @@ $total_reports = $total_reports[0]['total'];
//ui_pagination ($total_reports, $url);
foreach ($reports as $report) {
$data = array ();
$data[0] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_form&id='.$report['id_report'].'">'.$report['id_name'].'</a>';
@ -146,7 +145,8 @@ if(isset($data)) {
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}else {
}
else {
echo "<div class='nf'>".__('There are no defined reports')."</div>";
}
@ -159,7 +159,6 @@ echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_rep
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
@ -168,5 +167,4 @@ function check_all_checkboxes() {
$(".check_delete").attr('checked', false);
}
}
</script>

View File

@ -86,38 +86,38 @@ if (($create != "") OR ($view != "")){
echo '<table width="98%" cellspacing="4" cellpadding="4" class="databox_color">';
echo '<tr><td class="datos">'.__('Name');
echo '<tr><td class="datos">'.__('Name') . '</td>';
echo '<td class="datos">';
echo '<input type="text" name="form_name" size=100 value="'.$form_name.'"></td>';
echo '<tr><td class="datos2">'.__('Plugin command');
echo '<tr><td class="datos2">'.__('Plugin command') . '</td>';
echo '<td class="datos2">';
echo '<input type="text" name="form_execute" size=45 value="'.$form_execute.'"></td>';
echo '<tr><td class="datos2">'.__('Plugin type');
echo '<tr><td class="datos2">'.__('Plugin type') . '</td>';
echo '<td class="datos2">';
$fields[0]= __("Standard");
$fields[1]= __("Nagios");
html_print_select ($fields, "form_plugin_type", $form_plugin_type);
echo '<tr><td class="datos">'.__('Max. timeout');
echo '<tr><td class="datos">'.__('Max. timeout') . '</td>';
echo '<td class="datos">';
echo '<input type="text" name="form_max_timeout" size=5 value="'.$form_max_timeout.'"></td>';
echo '<tr><td class="datos2">'.__('IP address option');
echo '<tr><td class="datos2">'.__('IP address option') . '</td>';
echo '<td class="datos2">';
echo '<input type="text" name="form_net_dst_opt" size=15 value="'.$form_net_dst_opt.'"></td>';
echo '<tr><td class="datos">'.__('Port option');
echo '<tr><td class="datos">'.__('Port option') . '</td>';
echo '<td class="datos">';
echo '<input type="text" name="form_net_port_opt" size=5 value="'.$form_net_port_opt.'"></td>';
echo '<tr><td class="datos2">'.__('User option');
echo '<tr><td class="datos2">'.__('User option') . '</td>';
echo '<td class="datos2">';
echo '<input type="text" name="form_user_opt" size=15 value="'.$form_user_opt.'"></td>';
echo '<tr><td class="datos">'.__('Password option');
echo '<tr><td class="datos">'.__('Password option') . '</td>';
echo '<td class="datos">';
echo '<input type="text" name="form_pass_opt" size=15 value="'.$form_pass_opt.'"></td>';
@ -131,13 +131,15 @@ if (($create != "") OR ($view != "")){
echo '<tr><td align="right">';
if ($create != ""){
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
} else {
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
echo "<input name='crtbutton' type='submit' class='sub wand' value='" .
__('Create') . "'>";
}
else {
echo "<input name='uptbutton' type='submit' class='sub upd' value='" .
__('Update') . "'>";
}
echo '</form></table>';
}
else {
ui_print_page_header (__('Plugins registered in Pandora FMS'), "", false, "", true);

View File

@ -18,7 +18,8 @@ if (is_ajax ()) {
$get_reconscript_description = get_parameter('get_reconscript_description');
$id_reconscript = get_parameter('id_reconscript');
$description = db_get_value_filter('description', 'trecon_script', array('id_recon_script' => $id_reconscript));
$description = db_get_value_filter('description', 'trecon_script',
array('id_recon_script' => $id_reconscript));
echo htmlentities (io_safe_output($description), ENT_QUOTES, "UTF-8", true);
return;
@ -64,9 +65,11 @@ if ($create != ""){
if (($create != "") OR ($view != "")){
if ($create != "")
ui_print_page_header (__('Recon script creation') . ui_print_help_icon("reconscript_definition", true), "", false, "", true);
ui_print_page_header (__('Recon script creation') .
ui_print_help_icon("reconscript_definition", true), "", false, "", true);
else {
ui_print_page_header (__('Recon script update') . ui_print_help_icon("reconscript_definition", true), "", false, "", true);
ui_print_page_header (__('Recon script update') .
ui_print_help_icon("reconscript_definition", true), "", false, "", true);
$id_recon_script = get_parameter ("view","");
}
@ -78,11 +81,11 @@ if (($create != "") OR ($view != "")){
echo '<table width="98%" cellspacing="4" cellpadding="4" class="databox_color">';
echo '<tr><td class="datos">'.__('Name');
echo '<tr><td class="datos">' . __('Name') . '</td>';
echo '<td class="datos">';
echo '<input type="text" name="form_name" size=30 value="'.$form_name.'"></td>';
echo '<tr><td class="datos2">'.__('Script fullpath');
echo '<tr><td class="datos2">' . __('Script fullpath') . '</td>';
echo '<td class="datos2">';
echo '<input type="text" name="form_script" size=70 value="'.$form_script.'"></td>';
@ -123,7 +126,8 @@ else {
$result = db_process_sql ($sql_update);
if (! $result) {
echo "<h3 class='error'>" . __('Problem updating') . "</h3>";
} else {
}
else {
echo "<h3 class='suc'>" . __('Updated successfully') . "</h3>";
}
}
@ -203,7 +207,8 @@ else {
echo "</table>";
}
else {
echo '<div class="nf">'. __('There are no recon scripts in the system') . '</div>';
echo '<div class="nf">'.
__('There are no recon scripts in the system') . '</div>';
echo "<br>";
}
echo "<table width=98%>";
@ -212,5 +217,4 @@ else {
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
echo "</td></tr></table>";
}
?>

View File

@ -76,7 +76,8 @@ if ($delete != 0) {
if ($return_delete === false) {
db_pandora_audit("Tag management", "Fail try to delete tag #$delete");
echo '<h3 class="error">'.__('Error deleting tag').'</h3>';
} else {
}
else {
db_pandora_audit("Tag management", "Delete tag #$delete");
echo '<h3 class="suc">'.__('Successfully deleted tag').'</h3>';
}
@ -103,6 +104,7 @@ echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
echo "<tr>";
echo "<td>";
echo '<b>' . __("Name") . "/" . __("Description") . '</b>';
echo "</td>";
echo "<td align=center>";
echo '<form method=post action="index.php?sec=gmodules&sec2=godmode/tag/tag&delete_tag=0">';
html_print_input_hidden ("search_tag", "1");
@ -110,11 +112,14 @@ echo "<td align=center>";
echo "&nbsp;&nbsp;&nbsp;";
html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"');
echo "</form>";
echo "</td>";
echo "<td align=right>";
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/tag/edit_tag&action=new">';
html_print_input_hidden ("create_tag", "1", true);
html_print_submit_button (__('Create tag'), 'create_button', false, 'class="sub next"');
echo "</form>";
echo "</td>";
echo "</tr>";
echo "</table>";
// Prepare pagination

View File

@ -101,7 +101,8 @@ $string .= '<td align="left" width="200px">';
$string .= '<div style="text-align:center;">';
if ($event["estado"] == 0 ) {
$string .= html_print_select(array('1' => __('Validate'), '2' => __('Set in process'), '3' => __('Add comment')), 'select_validate', '', '', '', 0, true, false, false, 'select_validate').'<br><br>';
} else if ($event["estado"] == 2 ) {
}
else if ($event["estado"] == 2 ) {
$string .= html_print_select(array('1' => __('Validate'), '3' => __('Add comment')), 'select_validate', '', '', '', 0, true, false, false, 'select_validate').'<br><br>';
}

View File

@ -30,7 +30,8 @@ if ($searchGraphs) {
if(!$usergraphs_id){
$graphs_condition = " AND 1<>1";
}else {
}
else {
$graphs_condition = " AND id_graph IN (".implode(',',$usergraphs_id).")";
}

View File

@ -202,7 +202,11 @@ else {
$intervalCell = modules_get_interval ($module['id_agente_modulo']);
if($module['utimestamp'] == 0 && (($module['module_type'] < 21 || $module['module_type'] > 23) && $module['module_type'] != 100)){
if ($module['utimestamp'] == 0 &&
(
($module['id_tipo_modulo'] < 21 || $module['id_tipo_modulo'] > 23) &&
$module['id_tipo_modulo'] != 100)
) {
$statusCell = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
}
elseif ($module["estado"] == 0) {

View File

@ -102,9 +102,11 @@ if (isset ($_GET["modified"]) && !$view_mode) {
$section = io_safe_output($upd_info["section"]);
if (($section == 'Event list') || ($section == 'Group view') || ($section == 'Alert detail') || ($section == 'Tactical view') || ($section == 'Default')) {
$upd_info["data_section"] = '';
} else if ($section == 'Dashboard') {
}
else if ($section == 'Dashboard') {
$upd_info["data_section"] = $dashboard;
} else if ($section == 'Visual console') {
}
else if ($section == 'Visual console') {
$upd_info["data_section"] = $visual_console;
}