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

* godmode/servers/manage_recontask_form.php,
	godmode/alerts/configure_alert_compound.php,
	godmode/modules/manage_network_components.php,
	include/functions_ui.php, include/functions_incidents.php,
	include/functions_agents.php, include/functions_alerts.php,
	include/functions_messages.php, include/db/mysql.php,
	include/functions_reporting.php, include/functions_filemanager.php,
	include/auth/ldap.php, operation/events/events.php,
	operation/incidents/incident_detail.php, operation/tree.php,
	operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
	operation/users/user_edit.php: cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6798 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-24 08:54:40 +00:00
parent 9892515199
commit 79e34957cc
19 changed files with 218 additions and 145 deletions

View File

@ -1,3 +1,17 @@
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/modules/manage_network_components.php,
include/functions_ui.php, include/functions_incidents.php,
include/functions_agents.php, include/functions_alerts.php,
include/functions_messages.php, include/db/mysql.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/auth/ldap.php, operation/events/events.php,
operation/incidents/incident_detail.php, operation/tree.php,
operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
operation/users/user_edit.php: cleaned source code style.
2012-07-23 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor_prediction.php,

View File

@ -123,7 +123,8 @@ function update_compound ($step) {
}
alerts_set_alerts_compound_disable ($id, false);
} elseif ($step == 2) {
}
elseif ($step == 2) {
$monday = (bool) get_parameter ('monday');
$tuesday = (bool) get_parameter ('tuesday');
$wednesday = (bool) get_parameter ('wednesday');
@ -189,21 +190,23 @@ function update_compound ($step) {
alerts_delete_alert_compound_action ($key);
}
}
foreach ($add_actions as $id_action) {
/* TODO: fires_min and fires_max missing */
alerts_add_alert_compound_action ($id, (int) $id_action);
}
} elseif ($step == 3) {
}
elseif ($step == 3) {
$recovery_notify = (bool) get_parameter ('recovery_notify');
$field2_recovery = (bool) get_parameter ('field2_recovery');
$field3_recovery = (bool) get_parameter ('field3_recovery');
$result = alerts_update_alert_compound ($id,
array ('recovery_notify' => $recovery_notify,
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery));
} else {
}
else {
return false;
}

View File

@ -469,4 +469,4 @@ function check_all_checkboxes() {
$(".check_delete").attr('checked', false);
}
}
</script>
</script>

View File

@ -86,16 +86,16 @@ if (isset ($_GET["update"]) or (isset($_GET["crt"]))) { // Edit mode
$parent_detection = $row["parent_detection"];
$parent_recursion = $row["parent_recursion"];
}
} elseif (isset ($_GET["create"]) or isset($_GET["crt"])) {
}
elseif (isset ($_GET["create"]) or isset($_GET["crt"])) {
$create_recon = true;
if (isset ($_GET["crt"])){
if ($_GET["crt"] != "Create"){
if (isset ($_GET["crt"])) {
if ($_GET["crt"] != "Create") {
$create_recon = false;
}
}
if ($create_recon){
if ($create_recon) {
$id_rt = -1;
$name = "";
$network = "";

View File

@ -22,34 +22,35 @@ if (!isset ($config)) {
die ('
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Sancho Lerena">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
<meta name="keywords" content="pandora, monitoring, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
</head>
<body>
<div id="main" style="float:left; margin-left: 100px">
<div align="center">
<div id="login_f">
<h1 id="log_f" class="error">You cannot access this file</h1>
<div>
<img src="../../images/pandora_logo.png" border="0"></a>
</div>
<div class="msg">
<span class="error"><b>ERROR:</b>
You can\'t access this file directly!</span>
</div>
</div>
</div>
</body>
<head>
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Sancho Lerena">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
<meta name="keywords" content="pandora, monitoring, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
</head>
<body>
<div id="main" style="float:left; margin-left: 100px">
<div align="center">
<div id="login_f">
<h1 id="log_f" class="error">You cannot access this file</h1>
<div>
<img src="../../images/pandora_logo.png" border="0"></a>
</div>
<div class="msg">
<span class="error"><b>ERROR:</b>
You can\'t access this file directly!</span>
</div>
</div>
</div>
</div>
</body>
</html>
');
}
@ -93,7 +94,7 @@ foreach ($opt_keys as $key) {
$config["auth"][$key] = 0;
continue;
case "ldap_admin_dn":
case "ldap_admin_pwd":
case "ldap_admin_pwd":
$config["auth"][$key] = "";
continue;
default:
@ -127,7 +128,8 @@ function process_user_login ($login, $pass) {
if ($profile === false && empty ($config["auth"]["create_user_undefined"])) {
$config["auth_error"] = "No profile"; //Error message, don't translate
return false; //User doesn't have a profile so doesn't have access
} elseif ($profile === false && !empty ($config["auth"]["create_user_undefined"])) {
}
elseif ($profile === false && !empty ($config["auth"]["create_user_undefined"])) {
$ret = profile_create_user_profile ($login); //User doesn't have a profile but we are asked to create one
if ($ret === false) {
$config["auth_error"] = "Profile creation failed"; //Error message, don't translate
@ -164,8 +166,10 @@ function is_user_admin ($user_id) {
*/
function is_user ($id_user) {
$user = get_user_info ($id_user);
if (empty ($user))
return false;
return true;
}
@ -182,6 +186,7 @@ function get_user_fullname ($id_user) {
//User doesn't exist
return '';
}
return (string) $info["fullname"];
}
@ -194,6 +199,7 @@ function get_user_fullname ($id_user) {
*/
function get_user_email ($id_user) {
$info = get_user_info ($id_user);
return (string) $info["email"];
}
@ -209,6 +215,7 @@ function get_user_id ($user) {
if (is_array ($user))
/* FIXME: Is this right? */
return $user['id_user'];
return (int) $user;
}
@ -234,7 +241,7 @@ function get_user_info ($id_user) {
return $ldap_cache[$id_user];
}
/**
* Get all users that are defined in the admin group in LDAP
*
@ -245,7 +252,8 @@ function get_user_admins () {
if (! empty ($ldap_cache["cached_admins"])) {
return $ldap_cache["cached_admins"];
} else {
}
else {
$ldap_cache["cached_admins"] = array ();
}
@ -254,12 +262,14 @@ function get_user_admins () {
$sr = ldap_search ( $ldap_cache["ds"], $config["auth"]["ldap_admin_group_name"], $search_filter, array ($config["auth"]["ldap_admin_group_attr"]));
if (!$sr) {
$ldap_cache["error"] .= 'Error searching LDAP server (get_user_admins): ' . ldap_error ($ldap_cache["ds"]);
} else {
}
else {
$admins = ldap_get_entries( $ldap_cache["ds"], $sr);
for( $x = 0; $x < $admins[0][$config["auth"]["ldap_admin_group_attr"]]['count']; $x++) {
if ($config["auth"]["ldap_admin_group_type"] != 'posixgroup') {
$ldap_cache["cached_admins"][] = stripdn ($admins[0][$config["auth"]["ldap_admin_group_attr"]][$x]);
} else {
}
else {
$ldap_cache["cached_admins"][] = $admins[0][$config["auth"]["ldap_admin_group_attr"]][$x];
}
}
@ -305,17 +315,20 @@ function ldap_search_user ($login) {
if (!$sr) {
$ldap_cache["error"] .= 'Error searching LDAP server: ' . ldap_error ($ldap_cache["ds"]);
} else {
}
else {
$info = @ldap_get_entries ($ldap_cache["ds"], $sr );
if ( $info['count'] != 1 ) {
$ldap_cache["error"] .= 'Invalid user';
} else {
}
else {
$nick = $info[0]['dn'];
}
@ldap_free_result ($sr);
}
@ldap_close ($ldap_cache["ds"]);
}
return $nick;
}
@ -329,7 +342,7 @@ function ldap_search_user ($login) {
*/
function ldap_valid_login ($login, $password) {
global $ldap_cache, $config;
if (! function_exists ("ldap_connect")) {
die ("Your installation of PHP does not support LDAP");
}
@ -337,7 +350,8 @@ function ldap_valid_login ($login, $password) {
$ret = false;
if (!empty ($config["auth"]["ldap_port"])) {
$ds = @ldap_connect ($config["auth"]["ldap_server"], $config["auth"]["ldap_port"]); //Since this is a separate bind, we don't store it global
} else {
}
else {
$ds = @ldap_connect ($config["auth"]["ldap_server"]); //Since this is a separate bind we don't store it global
}
if ($ds) {
@ -355,15 +369,18 @@ function ldap_valid_login ($login, $password) {
if (!$r) {
$ldap_cache["error"] .= 'Invalid login';
//$ldap_cache["error"] .= ': incorrect password'; // uncomment for debugging
} else {
}
else {
$ret = true;
}
} else {
}
else {
$ldap_cache["error"] .= 'Invalid login';
//$ldap_cache["error"] .= ': no such user';
}
@ldap_close ($ds);
} else {
}
else {
$ldap_cache["error"] .= 'Error connecting to LDAP server';
}
return $ret;
@ -387,12 +404,14 @@ function ldap_load_user ($login) {
if (!$sr) {
$ldap_cache["error"] .= 'Error searching LDAP server (load_user): ' . ldap_error( $ldap_cache["ds"] );
} else {
}
else {
$info = @ldap_get_entries ($ldap_cache["ds"], $sr);
if ($info['count'] != 1) {
$ldap_cache["error"] .= 'Invalid login';
//$ldap_cache["error"] .= ', could not load user'; //Uncomment for debugging
} else {
}
else {
$ret = array ();
foreach ($config["auth"]["ldap_user_attr"] as $internal_key => $ldap_key) {
$ret["last_connect"] = $time;
@ -408,7 +427,8 @@ function ldap_load_user ($login) {
@ldap_free_result ($sr);
}
@ldap_close ( $ldap_cache["ds"] );
} else {
}
else {
$ldap_cache["error"] .= 'Could not connect to LDAP server';
}
@ -540,9 +560,11 @@ function ldap_connect_bind () {
if (!empty ($config["auth"]["ldap_port"]) && !is_resource ($ldap_cache["ds"])) {
$ldap_cache["ds"] = @ldap_connect ($config["auth"]["ldap_server"], $config["auth"]["ldap_port"]);
} elseif (!is_resource ($ldap_cache["ds"])) {
}
elseif (!is_resource ($ldap_cache["ds"])) {
$ldap_cache["ds"] = @ldap_connect ($config["auth"]["ldap_server"]);
} else {
}
else {
return true;
}
@ -557,10 +579,11 @@ function ldap_connect_bind () {
return $ret;
}
}
if (!empty ($config["auth"]["ldap_admin_dn"])) {
$r = @ldap_bind ($ldap_cache["ds"], $config["auth"]["ldap_admin_dn"], $config["auth"]["ldap_admin_pwd"]);
} else {
}
else {
$r = @ldap_bind ($ldap_cache["ds"]);
}
@ -569,10 +592,10 @@ function ldap_connect_bind () {
return $ret;
}
return true;
} else {
}
else {
$ldap_cache["error"] .= 'Error connecting to LDAP server';
return $ret;
}
}
?>
?>

View File

@ -367,22 +367,22 @@ function mysql_escape_string_sql($string) {
function mysql_db_get_value_filter ($field, $table, $filter, $where_join = 'AND') {
if (! is_array ($filter) || empty ($filter))
return false;
/* Avoid limit and offset if given */
unset ($filter['limit']);
unset ($filter['offset']);
$sql = sprintf ("SELECT %s FROM %s WHERE %s LIMIT 1",
$field, $table,
db_format_array_where_clause_sql ($filter, $where_join));
$result = db_get_all_rows_sql ($sql);
if ($result === false)
return false;
$fieldClean = str_replace('`', '', $field);
return $result[0][$fieldClean];
}
@ -1046,5 +1046,4 @@ function mysql_db_get_table_count($sql, $search_history_db = false) {
return $count;
}
?>

View File

@ -1897,7 +1897,15 @@ function agents_monitor_critical ($id_agent, $filter="") {
$filter = " AND ".$filter;
}
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND tagente_estado.id_agente = tagente.id_agente AND tagente.id_agente = $id_agent".$filter);
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_estado.utimestamp != 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND estado = 1
AND tagente_estado.id_agente = tagente.id_agente
AND tagente.id_agente = $id_agent" . $filter);
}
// Get warning monitors by using the status code in modules.
@ -1908,7 +1916,15 @@ function agents_monitor_warning ($id_agent, $filter="") {
$filter = " AND ".$filter;
}
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 2 AND tagente_estado.id_agente = tagente.id_agente AND tagente.id_agente = $id_agent".$filter);
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_estado.utimestamp != 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND estado = 2
AND tagente_estado.id_agente = tagente.id_agente
AND tagente.id_agente = $id_agent" . $filter);
}
// Get unknown monitors by using the status code in modules.
@ -1918,19 +1934,34 @@ function agents_monitor_unknown ($id_agent, $filter="") {
if ($filter) {
$filter = " AND ".$filter;
}
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 3 AND tagente_estado.id_agente = tagente.id_agente AND tagente.id_agente = $id_agent".$filter);
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_estado.utimestamp != 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND estado = 3
AND tagente_estado.id_agente = tagente.id_agente
AND tagente.id_agente = $id_agent" . $filter);
}
// Get ok monitors by using the status code in modules.
function agents_monitor_ok ($id_agent, $filter="") {
if ($filter) {
$filter = " AND ".$filter;
}
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente.id_agente = $id_agent".$filter);
return db_get_sql ("SELECT COUNT( DISTINCT tagente_modulo.id_agente_modulo)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_estado.utimestamp != 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND estado = 0
AND tagente_estado.id_agente = tagente.id_agente
AND tagente.id_agente = $id_agent" . $filter);
}
/**

View File

@ -1523,7 +1523,8 @@ function alerts_validate_alert_compound ($id_alert_compound) {
$group_id, $agent_id, 1, $config["id_user"],
"alert_manual_validation", 1, $alert["id"],
$id);
} elseif ($result === false) {
}
elseif ($result === false) {
return false;
}
}

View File

@ -90,16 +90,18 @@ if (!function_exists ('mime_content_type')) {
'odt' => 'application/vnd.oasis.opendocument.text',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet'
);
$ext = strtolower (array_pop (explode ('.', $filename)));
if (array_key_exists ($ext, $mime_types)) {
return $mime_types[$ext];
} elseif (function_exists ('finfo_open')) {
}
elseif (function_exists ('finfo_open')) {
$finfo = finfo_open (FILEINFO_MIME);
$mimetype = finfo_file ($finfo, $filename);
finfo_close ($finfo);
return $mimetype;
} else {
}
else {
$temp = exec ("file ".$filename);
if (isset($temp) && $temp != '')
return $temp;

View File

@ -296,16 +296,19 @@ function incidents_delete_note ($id_note, $transact = true) {
$errors++;
}
}
if ($transact == true && $errors > 0) {
db_process_sql_rollback ();
return false;
} elseif ($transact == true) {
}
elseif ($transact == true) {
db_process_sql_commit ();
return true;
} elseif ($errors > 0) {
}
elseif ($errors > 0) {
return false;
} else {
}
else {
return true;
}
}

View File

@ -74,7 +74,8 @@ function messages_create_group ($usuario_origen, $dest_group, $subject, $mensaje
if (! array_key_exists ($usuario_origen, $users)) {
//Users don't exist in the system
return false;
} elseif (empty ($group_users)) {
}
elseif (empty ($group_users)) {
//There are no users in the group, so it hasn't failed although it hasn't done anything.
return true;
}
@ -90,7 +91,7 @@ function messages_create_group ($usuario_origen, $dest_group, $subject, $mensaje
}
}
}
foreach ($group_user as $user) {
$return = messages_create_message ($usuario_origen, get_user_id ($user), $subject, $mensaje);
if ($return === false) {

View File

@ -1023,7 +1023,8 @@ function reporting_get_group_stats ($id_group = 0) {
function reporting_event_reporting ($id_group, $period, $date = 0, $return = false) {
if (empty ($date)) {
$date = get_system_time ();
} elseif (!is_numeric ($date)) {
}
elseif (!is_numeric ($date)) {
$date = strtotime ($date);
}
@ -1049,7 +1050,7 @@ function reporting_event_reporting ($id_group, $period, $date = 0, $return = fal
$data[3] = $event["timestamp"];
array_push ($table->data, $data);
}
if (empty ($return))
html_print_table ($table);
return $table;
@ -1066,7 +1067,7 @@ function reporting_event_reporting ($id_group, $period, $date = 0, $return = fal
function reporting_get_fired_alerts_table ($alerts_fired) {
$agents = array ();
global $config;
require_once ($config["homedir"].'/include/functions_alerts.php');
foreach (array_keys ($alerts_fired) as $id_alert) {
@ -1238,7 +1239,7 @@ function reporting_alert_reporting_module ($id_agent_module, $period = 0, $date
FROM talert_template_modules AS t1
INNER JOIN talert_templates AS t2 ON t1.id_alert_template = t2.id
WHERE id_agent_module = ' . $id_agent_module);
if ($alerts === false) {
$alerts = array();
}
@ -1311,7 +1312,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
if (sizeof ($alerts) > 0)
$fired_percentage = round (sizeof ($alerts_fired) / sizeof ($alerts) * 100, 2);
$not_fired_percentage = 100 - $fired_percentage;
$data = array ();
$data[__('Alerts fired')] = $fired_percentage;
$data[__('Alerts not fired')] = $not_fired_percentage;
@ -1319,13 +1320,14 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
$output .= '<strong>'.__('Total alerts monitored').': '.sizeof ($alerts).'</strong><br />';
if (! sizeof ($alerts_fired)) {
if (!$return)
echo $output;
return $output;
}
$table = reporting_get_fired_alerts_table ($alerts_fired);
@ -1340,6 +1342,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
if (!$return)
echo $output;
return $output;
}
@ -1359,7 +1362,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = false) {
if (empty ($date)) //If date is 0, false or empty
$date = get_system_time ();
$datelimit = $date - $period;
$output = '';
@ -1435,13 +1438,15 @@ function reporting_get_monitors_down_table ($monitors_down) {
$data[0] = '';
if ($monitor['descripcion'] != '') {
$data[1] = $monitor['descripcion'];
} else {
}
else {
$data[1] = $monitor['nombre'];
}
array_push ($table->data, $data);
}
}
}
return $table;
}
@ -1457,11 +1462,13 @@ function reporting_get_monitors_down_table ($monitors_down) {
*/
function reporting_print_group_reporting ($id_group, $return = false) {
$agents = agents_get_group_agents ($id_group, false, "none");
$output = '<strong>'.__('Agents in group').': '.count ($agents).'</strong><br />';
$output = '<strong>' .
sprintf(__('Agents in group: %s'), count($agents)) .
'</strong><br />';
if ($return === false)
echo $output;
return $output;
}
@ -1532,6 +1539,7 @@ function reporting_get_agent_alerts_table ($id_agent, $period = 0, $date = 0) {
array_push ($table->data, $data);
}
return $table;
}
@ -1612,11 +1620,12 @@ function reporting_get_agent_modules_table ($id_agent, $period = 0, $date = 0) {
*/
function reporting_get_agent_detailed ($id_agent, $period = 0, $date = 0, $return = false) {
$output = '';
$n_a_string = __('N/A').'(*)';
$n_a_string = __('N/A(*)');
/* Show modules in agent */
$output .= '<div class="agent_reporting">';
$output .= '<h3 style="text-decoration: underline">'.__('Agent').' - '.agents_get_name ($id_agent).'</h3>';
$output .= '<h3 style="text-decoration: underline">' .
__('Agent') . ' - ' . agents_get_name ($id_agent) . '</h3>';
$output .= '<h4>'.__('Modules').'</h3>';
$table_modules = reporting_get_agent_modules_table ($id_agent, $period, $date);
$table_modules->width = '99%';

View File

@ -1953,7 +1953,7 @@ function ui_get_full_url ($url = '') {
if ( $port != null ) {
$fullurl .= ":".$port;
}
if ($url === '') {
$url = $_SERVER['REQUEST_URI'];
}

View File

@ -455,7 +455,7 @@ foreach ($agents as $agent) {
$data = array ();
$data[0] = '';
$data[0] = '';
$data[0] .= '<span class="left">';
$data[0] .= ui_print_agent_name($agent["id_agente"], true, 60, 'font-size:6.5pt !important;', true);
$data[0] .= '</span>';
@ -469,12 +469,6 @@ foreach ($agents as $agent) {
}
$data[0] .= '</div>';
/*if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {
$data[0] .= '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$agent["id_agente"].'">';
$data[0] .= html_print_image ("images/setup.png", true, array ("border" => 0, "width" => 16));
$data[0] .= '</a>&nbsp;';
}*/
$data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[&hellip;]', 'font-size: 6.5pt');
$data[2] = ui_print_os_icon ($agent["id_os"], false, true);
@ -494,15 +488,15 @@ foreach ($agents as $agent) {
$data[5] .= $agent_info["modules"];
if ($agent_info["monitor_alertsfired"] > 0)
$data[5] .= ' : <span class="orange">'.$agent_info["monitor_alertsfired"].'</span>';
$data[5] .= ' : <span class="orange">' . $agent_info["monitor_alertsfired"] . '</span>';
if ($agent_info["monitor_critical"] > 0)
$data[5] .= ' : <span class="red">'.$agent_info["monitor_critical"].'</span>';
$data[5] .= ' : <span class="red">' . $agent_info["monitor_critical"] . '</span>';
if ($agent_info["monitor_warning"] > 0)
$data[5] .= ' : <span class="yellow">'.$agent_info["monitor_warning"].'</span>';
$data[5] .= ' : <span class="yellow">' . $agent_info["monitor_warning"] . '</span>';
if ($agent_info["monitor_unknown"] > 0)
$data[5] .= ' : <span class="grey">'.$agent_info["monitor_unknown"].'</span>';
$data[5] .= ' : <span class="grey">' . $agent_info["monitor_unknown"] . '</span>';
if ($agent_info["monitor_normal"] > 0)
$data[5] .= ' : <span class="green">'.$agent_info["monitor_normal"].'</span>';
$data[5] .= ' : <span class="green">' . $agent_info["monitor_normal"] . '</span>';
$data[5] .= '</b>';
$data[6] = $agent_info["status_img"];
@ -519,7 +513,7 @@ foreach ($agents as $agent) {
$data[8] = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
else
$data[8] = $time;
// This old code was returning "never" on agents without modules, BAD !!
// And does not print outdated agents in red. WRONG !!!!
// $data[7] = ui_print_timestamp ($agent_info["last_contact"], true);
@ -534,8 +528,8 @@ foreach ($agents as $agent) {
$data[9] = "<a href='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$agent["id_agente"]."&disk_conf=1'>".
html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')))."</a>";
}
$data[10] = "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&
$data[10] = "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&
borrar_agente=".$agent["id_agente"]."&group_id=$group_id&recursion=$recursion&search=$search&offset=$offset&sort_field=$sortField&sort=$sort'".
' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, array("border" => '0')) ."</a></td>";
}
@ -550,19 +544,6 @@ if (!empty ($table->data)) {
} else {
echo '<div class="nf">'.__('There are no defined agents').'</div>';
}
/* Godmode controls SHOULD NOT BE HERE
if (check_acl ($config['id_user'], 0, "LM") || check_acl ($config['id_user'], 0, "AW")
|| check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "DM")
|| check_acl ($config['id_user'], 0, "UM")) {
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden ('new_agent', 1);
html_print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo '</form>';
}
*/
?>
<script type="text/javascript">
@ -573,16 +554,15 @@ $(document).ready (function () {
},
function () {
$(".actions", this).css ("visibility", "hidden");
});
});
$("#group_id").click (
function () {
$(this).css ("width", "auto");
});
$("#group_id").blur (function () {
$(this).css ("width", "180px");
});
});
</script>
</script>

View File

@ -71,31 +71,35 @@ foreach ($modules as $module_id => $module) {
if ($loc < $offset) {
$loc++;
continue; //Skip offset
} elseif ($loc >= $offset + $config["block_size"]) {
}
elseif ($loc >= $offset + $config["block_size"]) {
continue;
}
$data = array ();
$data[0] = ui_print_moduletype_icon ($module["id_tipo_modulo"], true);
$data[1] = ui_print_string_substr ($module["nombre"], 25, true);
if ($module["min_critical"] != 0){
if ($module["min_critical"] != 0) {
$sla_min = $module["min_critical"];
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], $sla_min));
$data[2] = 100 - $data[2]. "%";
} else {
}
else {
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%';
}
//TODO: Make this work for all new status
$status = modules_get_agentmodule_status ($module_id);
if ($status == 1){
if ($status == 1) {
$data[3] = html_print_image ("images/pixel_red.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Down')));
} else {
}
else {
$data[3] = html_print_image ("images/pixel_green.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Up')));
}
if ($module["module_interval"] > 0) {
$data[4] = $module["module_interval"];
} else {
}
else {
$data[4] = $interval;
}
array_push ($table->data, $data);

View File

@ -439,7 +439,7 @@ $(document).ready( function() {
$("input[name=allbox]").change (function() {
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
});
$('#select_validate').change (function() {
$option = $('#select_validate').val();

View File

@ -226,7 +226,8 @@ if (isset ($id_inc)) { //If $id_inc is set (when $_GET["id"] is set, not $_GET["
ui_print_page_header (__('Incident details'). ' #'.$id_inc, "images/book_edit.png", false, "", false, "");
echo '<form name="accion_form" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident&action=update">';
echo '<input type="hidden" name="id_inc" value="'.$id_inc.'">';
} else {
}
else {
ui_print_page_header (__('Create incident'), "images/book_edit.png", false, "", false, "");
echo '<form name="accion_form" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident&action=insert">';
}

View File

@ -132,14 +132,15 @@ if (is_ajax ())
ui_print_timestamp ($agent["ultimo_contacto"]);
echo " / ";
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
echo __('Never');
} else {
}
else {
echo $agent["ultimo_contacto_remoto"];
}
echo '</td></tr>';
// Timezone Offset
if ($agent['timezone_offset'] != 0) {
echo '<tr><td class="datos2"><b>'.__('Timezone Offset'). '</b></td>';

View File

@ -39,7 +39,8 @@ if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM")) AND ($id !=
//If current user is editing himself or if the user has UM (User Management) rights on any groups the user is part of AND the authorization scheme allows for users/admins to update info
if (($config["id_user"] == $id || check_acl ($config["id_user"], users_get_groups ($id), "UM")) && $config["user_can_update_info"]) {
$view_mode = false;
} else {
}
else {
$view_mode = true;
}