Clean the source code style.

This commit is contained in:
mdtrooper 2015-06-08 09:32:01 +02:00
parent b96fdad6d8
commit 819b1d5d77
14 changed files with 76 additions and 64 deletions

View File

@ -181,14 +181,15 @@ if ($get_module_detail) {
"modules_format_time",
"align" => "left",
"width" => "50px");
}else{
}
else {
$columns["Timestamp"] = array(
"utimestamp",
"modules_format_timestamp",
"align" => "left",
"width" => "50px");
}
if ($selection_mode == "fromnow") {
$date = get_system_time();
$period = $period;
@ -499,10 +500,10 @@ if ($list_modules) {
$status_filter_sql = 'tagente_estado.estado = ' . $status_filter_monitor;
}
if($status_module_group != -1){
if ($status_module_group != -1) {
$status_module_group_filter = 'id_module_group = ' . $status_module_group;
}
else{
else {
$status_module_group_filter = 'id_module_group >= 0';
}
@ -900,15 +901,16 @@ if ($list_modules) {
else
$salida = 'FAIL';
break;
default:
default:
$salida = format_numeric($module["datos"]);
break;
}
}else{
}
else {
$salida = format_numeric($module["datos"]);
}
// Show units ONLY in numeric data types
if (isset($module["unit"])){
if (isset($module["unit"])) {
$salida .= "&nbsp;" . '<i>'. io_safe_output($module["unit"]) . '</i>';
}
}

View File

@ -1292,14 +1292,14 @@ class Tree {
$module['serverID'] = $server['id'];
$module['serverName'] = $server['server_name'];
}
else{
else {
$module['serverName'] = false;
$module['serverID'] = false;
}
if (!isset($module['value']))
$module['value'] = modules_get_last_value($module['id']);
// Status
switch ($module['status']) {
case AGENT_MODULE_STATUS_CRITICAL_ALERT:

View File

@ -2246,7 +2246,7 @@ function print_audit_csv ($data) {
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
}
}
else{
else {
echo __('No data found to export');
}
}

View File

@ -1627,23 +1627,27 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
case 21:
case 31:
if ( $config["render_proc"] ) {
$sql = sprintf ("SELECT IF(datos >= 1, 'OK', 'FAIL') as data, utimestamp
$sql = sprintf ("
SELECT IF(datos >= 1, 'OK', 'FAIL') as data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order);
}
else {
$sql = sprintf ("
SELECT datos AS data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order);
}else{
$sql = sprintf ("SELECT datos AS data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d
ORDER BY utimestamp %s",
$id_agent_module, $datelimit, $date, $order);
}
break;
default:
$sql = sprintf ("SELECT datos AS data, utimestamp
$sql = sprintf ("
SELECT datos AS data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d

View File

@ -5292,7 +5292,8 @@ function reporting_get_stats_alerts($data, $links = false) {
__('Defined and fired alerts') .
'</legend>' .
html_print_table($table_al, true) . '</fieldset>';
}else{
}
else {
$table_al->class = "tactical_view";
$table_al->style = array();
$output = '<fieldset class="tactical_set">
@ -5391,7 +5392,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
html_print_table($table_mbs, true) .
'</fieldset>';
}
else{
else {
$table_mbs->class = "tactical_view";
$table_mbs->style=array();
$output = '

View File

@ -2600,7 +2600,7 @@ function reporting_get_agents_by_status ($data, $graph_width = 250, $graph_heigh
'</legend>' .
html_print_table($table_agent, true) . '</fieldset>';
}
else{
else {
$table_agent->style=array();
$table_agent->class = "tactical_view";
$agents_data = '<fieldset class="tactical_set">
@ -2652,7 +2652,8 @@ function reporting_get_total_servers ($num_servers) {
__('Node overview') .
'</legend>' .
html_print_table($table_node, true) . '</fieldset>';
}else{
}
else {
$table_node->style = array();
$table_node->class = "tactical_view";
$node_overview = '<fieldset class="tactical_set">
@ -2691,7 +2692,7 @@ function reporting_get_events ($data, $links = false) {
$table_events->data[0][3] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color:#FFF; font-size: 12pt; font-weight: bold;" . $style . "' href='" . $links['unknown'] . "'>" . format_numeric($data['unknown'])."</a>";
}
else{
else {
$table_events->data[0][0] = html_print_image('images/module_critical.png', true, array('title' => __('Critical events')));
$table_events->data[0][0] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color: #FC4444;" . $style . "' href='" . $links['critical'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #FC4444;'>".
@ -2717,7 +2718,7 @@ function reporting_get_events ($data, $links = false) {
'</legend>' .
html_print_table($table_events, true) . '</fieldset>';
}
else{
else {
$table_events->class="tactical_view";
$table_events->styleTable="text-align:center;";
$table_events->size[0]="10%";
@ -2915,7 +2916,7 @@ function reporting_get_event_histogram ($events) {
'</legend>' .
html_print_table($table, true) . '</fieldset>';
}
else{
else {
$table->class='tactical_view';
$event_graph = '<fieldset id="event_tactical" class="tactical_set">' .
html_print_table($table, true) . '</fieldset>';

View File

@ -299,7 +299,7 @@ function parse_oracle_dump($connection, $url, $debug = false) {
$query .= $clean_line . ' ';
$plsql_block = true;
}
else{
else {
$query .= $clean_line;
}

View File

@ -106,7 +106,7 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st
$table->rowspan[0][7] = 2;
$data = '<form style="background-color: #ECECEC;" method="post" action="'.$url.'">';
}
else{
else {
$data = '<form method="post" action="'.$url.'">';
}
$data .= html_print_table ($table, true);

View File

@ -376,7 +376,7 @@ if ($print_agent) {
if(defined('METACONSOLE')){
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Show Options'));;
}
else{
else {
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Alert control filter'), __('Toggle filter(s)'));
}
}

View File

@ -100,7 +100,8 @@ if (!defined('METACONSOLE')){
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = "databox filters";
}else{
}
else {
$filters = '<form class="filters_form" method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;ag_group=' .
$ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . '&amp;sort_field=' .
$sortField . '&amp;sort=' . $sort .'&amp;pure=' . $config['pure'] . $ag_custom_fields_params . '">';
@ -409,7 +410,7 @@ if(defined("METACONSOLE")){
$table->style[3] = 'vertical-align:middle; font-weight: bold;';
$table->style[4] = 'vertical-align:middle; font-weight: bold;';
}
else{
else {
$table->style[0] = 'font-weight: bold;';
$table->style[1] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
@ -536,7 +537,7 @@ if(defined('METACONSOLE')){
$filters .= "</form>";
ui_toggle($filters, __('Show Options'));
}
else{
else {
$table->colspan[2][0] = 7;
$table->data[2][0] = ui_toggle(html_print_table($table_custom_fields, true), __('Agent custom fields'),'',true,true);
@ -1247,7 +1248,8 @@ foreach ($result as $row) {
$salida = format_numeric($row["datos"]);
break;
}
}else{
}
else {
$salida = format_numeric($row["datos"]);
}

View File

@ -144,7 +144,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
if ($layouts === false) {
$layouts = array ();
}
else{
else {
$id = (int) get_parameter ('id', -1);
@ -416,7 +416,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]["enterprise"] = $extension['enterprise'];
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
}
else{
else {
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["text"] = __($extension_menu['name']);
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["refr"] = 0;
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["icon"] = $extension_menu['icon'];
@ -426,7 +426,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
}
}
else{
else {
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["text"] = __($extension_menu['name']);
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["refr"] = 0;
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["icon"] = $extension_menu['icon'];

View File

@ -180,7 +180,8 @@ enterprise_hook('open_meta_frame');
if (defined ('METACONSOLE')){
$class = "databox data";
}else{
}
else {
$class = "databox filters";
}

View File

@ -30,30 +30,30 @@ if ($servers === false) {
$servers = array ();
return;
}
else{
else {
$recon_task = db_get_all_rows_sql('SELECT * FROM trecon_task');
if ($recon_task === false) {
ui_print_page_header (__('Recon View'), "images/op_recon.png", false, "", false);
require_once ($config['homedir'] . "/general/firts_task/recon_view.php");
return;
}
else{
else {
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once ($config["homedir"] . '/include/functions_servers.php');
require_once ($config['homedir'] . "/include/functions_network_profiles.php");
if (check_acl ($config['id_user'], 0, "AW")) {
$options['manage']['text'] = "<a href='index.php?sec=estado&sec2=godmode/servers/manage_recontask'>" . html_print_image("images/setup.png", true, array('title' => __('Manage'))) . "</a>";
}
$options[]['text'] = "<a href='index.php?sec=estado&sec2=operation/servers/recon_view'>" . html_print_image("images/refresh_mc.png", true, array('title' => __('Refresh'))) . "</a>";
ui_print_page_header (__('Recon View'), "images/op_recon.png", false, "", false, $options);
$modules_server = 0;
$total_modules = 0;
$total_modules_data = 0;
// --------------------------------
// FORCE A RECON TASK
// --------------------------------
@ -63,17 +63,17 @@ else{
servers_force_recon_task($id);
}
}
foreach ($servers as $serverItem) {
$id_server = $serverItem["id_server"];
$server_name = servers_get_name ($id_server);
$recon_tasks = db_get_all_rows_field_filter ("trecon_task", "id_recon_server", $id_server);
// Show network tasks for Recon Server
if ($recon_tasks === false) {
$recon_tasks = array ();
}
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = "99%";
@ -81,34 +81,34 @@ else{
$table->head = array ();
$table->data = array ();
$table->align = array ();
$table->head[0] = __('Force');
$table->align[0] = "center";
$table->head[1] = __('Task name');
$table->align[1] = "center";
$table->head[2] = __('Interval');
$table->align[2] = "center";
$table->head[3] = __('Network');
$table->align[3] = "center";
$table->head[4] = __('Status');
$table->align[4] = "center";
$table->head[5] = __('Template');
$table->align[5] = "center";
$table->head[6] = __('Progress');
$table->align[6] = "center";
$table->head[7] = __('Updated at');
$table->align[7] = "center";
$table->head[8] = __('Edit');
$table->align[8] = "center";
foreach ($recon_tasks as $task) {
$data = array ();
@ -122,9 +122,9 @@ else{
}
$data[1] = '<b>'. $task["name"].'</b>';
$data[2] = human_time_description_raw ($task["interval_sweep"]);
if ($task["id_recon_script"] == 0){
$data[3] = $task["subnet"];
}
@ -138,7 +138,7 @@ else{
else {
$data[4] = __('Pending');
}
if ($task["id_recon_script"] == 0){
// Network recon task
$data[5] = html_print_image ("images/network.png", true, array ("title" => __('Network recon task')))."&nbsp;&nbsp;";
@ -149,7 +149,7 @@ else{
$data[5] = html_print_image ("images/plugin.png", true). "&nbsp;&nbsp;";
$data[5] .= db_get_sql (sprintf("SELECT name FROM trecon_script WHERE id_recon_script = %d", $task["id_recon_script"]));
}
if ($task["status"] <= 0 || $task["status"] > 100) {
$data[6] = "-";
}
@ -158,7 +158,7 @@ else{
}
$data[7] = ui_print_timestamp ($task["utimestamp"], true);
if (check_acl ($config["id_user"], $task["id_group"], "PM")) {
$data[8] = '<a href="index.php?sec=gservers&amp;sec2=godmode/servers/manage_recontask_form&amp;update='.$task["id_rt"].'">'.html_print_image ("images/wrench_orange.png", true).'</a>';
}
@ -167,7 +167,7 @@ else{
}
array_push ($table->data, $data);
}
if (empty ($table->data)) {
echo '<div class="nf">'.__("Server") . " " . $server_name . " " . __("has no recon tasks assigned").'</div>';
}

View File

@ -183,7 +183,8 @@ if (defined('METACONSOLE')) {
echo "<div class='view_tree'>";
ui_toggle($form_html, __('Show Options'));
echo "<br>";
}else{
}
else {
//echo "<br>";
ui_toggle($form_html, __('Tree search'));
}