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 dfca96e341
commit a0026ced53
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,16 +143,22 @@ echo '</form>';
// ==========================
// MODULE VISUALIZATION TABLE
// ==========================
switch ($config["dbtype"]) {
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);
if ($result === false) {
$result = array ();
@ -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>";
}
@ -82,7 +84,7 @@ if ($delete_field) {
$fields = db_get_all_fields_in_table('tagent_custom_fields');
$table->width = '98%';
$table->width = '98%';
if ($fields) {
$table->head = array ();
$table->head[0] = __('Field');

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);
}
@ -196,11 +198,9 @@ $(document).ready (function () {
});
$("#submit-upd_button").click(function () {
$('#fields_selected option').map(function(){
$('#fields_selected option').map(function() {
$(this).attr('selected','selected');
});
});
});
</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

@ -118,8 +118,7 @@ $total_reports = $total_reports[0]['total'];
//ui_pagination ($total_reports, $url);
foreach ($reports as $report) {
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>';
@ -138,7 +137,7 @@ $total_reports = $total_reports[0]['total'];
array_push ($table->data, $data);
}
if(isset($data)) {
if (isset($data)) {
echo "<form method='post' action='index.php?sec=netf&sec2=godmode/netflow/nf_report'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table ($table);
@ -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

@ -41,7 +41,7 @@ if (! check_acl ($config['id_user'], 0, "LM")) {
$view = get_parameter ("view", "");
$create = get_parameter ("create", "");
if ($view != ""){
if ($view != "") {
$form_id = $view;
$plugin = db_get_row ("tplugin", "id", $form_id);
$form_name = $plugin["name"];
@ -54,7 +54,7 @@ if ($view != ""){
$form_pass_opt = $plugin ["pass_opt"];
$form_plugin_type = $plugin ["plugin_type"];
}
if ($create != ""){
if ($create != "") {
$form_name = "";
$form_description = "";
$form_max_timeout = "";
@ -69,7 +69,7 @@ if ($create != ""){
// SHOW THE FORM
// =================================================================
if (($create != "") OR ($view != "")){
if (($create != "") OR ($view != "")) {
if ($create != "")
ui_print_page_header (__('Plugin creation') . ui_print_help_icon("plugin_definition", true), "", false, "", true);
@ -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;
@ -45,14 +46,14 @@ if (!check_refererer()) {
$view = get_parameter ("view", "");
$create = get_parameter ("create", "");
if ($view != ""){
if ($view != "") {
$form_id = $view;
$reconscript = db_get_row ("trecon_script", "id_recon_script", $form_id);
$form_name = $reconscript["name"];
$form_description = $reconscript["description"];
$form_script = $reconscript ["script"];
}
if ($create != ""){
if ($create != "") {
$form_name = "";
$form_description = "";
$form_script = "";
@ -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,15 +81,15 @@ 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>';
echo '<tr><td class="datos2">'.__('Description').'</td>';
echo '<tr><td class="datos2">' . __('Description') . '</td>';
echo '<td class="datos2"><textarea name="form_description" cols="50" rows="4">';
echo $form_description;
echo '</textarea></td></tr>';
@ -122,9 +125,10 @@ else {
if ($reconscript_name != '' && $reconscript_script != '')
$result = db_process_sql ($sql_update);
if (! $result) {
echo "<h3 class='error'>".__('Problem updating')."</h3>";
} else {
echo "<h3 class='suc'>".__('Updated successfully')."</h3>";
echo "<h3 class='error'>" . __('Problem updating') . "</h3>";
}
else {
echo "<h3 class='suc'>" . __('Updated successfully') . "</h3>";
}
}
@ -141,25 +145,25 @@ else {
$result = false;
if ($values['name'] != '' && $values['script'] != '')
$result = db_process_sql_insert('trecon_script', $values);
if (! $result){
echo "<h3 class='error'>".__('Problem creating')."</h3>";
if (! $result) {
echo "<h3 class='error'>" . __('Problem creating') . "</h3>";
}
else {
echo "<h3 class='suc'>".__('Created successfully')."</h3>";
echo "<h3 class='suc'>" . __('Created successfully') . "</h3>";
}
}
if (isset($_GET["kill_reconscript"])){ // if delete alert
if (isset($_GET["kill_reconscript"])) { // if delete alert
$reconscript_id = get_parameter ("kill_reconscript", 0);
$result = db_process_sql_delete('trecon_script',
array('id_recon_script' => $reconscript_id));
if (! $result){
echo "<h3 class='error'>".__('Problem deleting reconscript')."</h3>";
if (! $result) {
echo "<h3 class='error'>" . __('Problem deleting reconscript') . "</h3>";
}
else {
echo "<h3 class='suc'>".__('reconscript deleted successfully')."</h3>";
echo "<h3 class='suc'>" . __('reconscript deleted successfully') . "</h3>";
}
if ($reconscript_id != 0){
$result = db_process_sql_delete('trecon_task',
@ -173,13 +177,13 @@ else {
if ($rows !== false) {
echo '<table width="98%" cellspacing="4" cellpadding="4" class="databox">';
echo "<th>".__('Name')."</th>";
echo "<th>".__('Command')."</th>";
echo "<th>".__('Description')."</th>";
echo "<th>".__('Delete')."</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Command') . "</th>";
echo "<th>" . __('Description') . "</th>";
echo "<th>" . __('Delete') . "</th>";
$color = 0;
foreach ($rows as $row) {
if ($color == 1){
if ($color == 1) {
$tdcolor = "datos";
$color = 0;
}
@ -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>';
}
@ -94,7 +95,7 @@ $result = false;
if ($search != 0) {
$result = tags_search_tag($tag_name, $filter);
}
else{
else {
$result = tags_search_tag(false, $filter);
}
@ -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
@ -124,7 +129,7 @@ ui_pagination ($total_tags, $url);
$rowPair = true;
$iterator = 0;
if (!empty($result)){
if (!empty($result)) {
$table->width = '98%';
$table->data = array ();

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) {
@ -230,7 +234,7 @@ else {
}
$graphCell = "";
if ($module['history_data'] == 1){
if ($module['history_data'] == 1) {
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
@ -250,7 +254,7 @@ else {
else
$dataCell = "<span title='".$module['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($module["datos"]),0,12)."</span>";
if ($module['estado'] == 3){
if ($module['estado'] == 3) {
$option = array ("html_attr" => 'class="redb"');
}
else {

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;
}