mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
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:
parent
7e8201c2ac
commit
9cde128f7c
@ -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>
|
2012-07-23 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/agentes/module_manager_editor_prediction.php,
|
* godmode/agentes/module_manager_editor_prediction.php,
|
||||||
|
@ -123,7 +123,8 @@ function update_compound ($step) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alerts_set_alerts_compound_disable ($id, false);
|
alerts_set_alerts_compound_disable ($id, false);
|
||||||
} elseif ($step == 2) {
|
}
|
||||||
|
elseif ($step == 2) {
|
||||||
$monday = (bool) get_parameter ('monday');
|
$monday = (bool) get_parameter ('monday');
|
||||||
$tuesday = (bool) get_parameter ('tuesday');
|
$tuesday = (bool) get_parameter ('tuesday');
|
||||||
$wednesday = (bool) get_parameter ('wednesday');
|
$wednesday = (bool) get_parameter ('wednesday');
|
||||||
@ -194,7 +195,8 @@ function update_compound ($step) {
|
|||||||
/* TODO: fires_min and fires_max missing */
|
/* TODO: fires_min and fires_max missing */
|
||||||
alerts_add_alert_compound_action ($id, (int) $id_action);
|
alerts_add_alert_compound_action ($id, (int) $id_action);
|
||||||
}
|
}
|
||||||
} elseif ($step == 3) {
|
}
|
||||||
|
elseif ($step == 3) {
|
||||||
$recovery_notify = (bool) get_parameter ('recovery_notify');
|
$recovery_notify = (bool) get_parameter ('recovery_notify');
|
||||||
$field2_recovery = (bool) get_parameter ('field2_recovery');
|
$field2_recovery = (bool) get_parameter ('field2_recovery');
|
||||||
$field3_recovery = (bool) get_parameter ('field3_recovery');
|
$field3_recovery = (bool) get_parameter ('field3_recovery');
|
||||||
@ -203,7 +205,8 @@ function update_compound ($step) {
|
|||||||
array ('recovery_notify' => $recovery_notify,
|
array ('recovery_notify' => $recovery_notify,
|
||||||
'field2_recovery' => $field2_recovery,
|
'field2_recovery' => $field2_recovery,
|
||||||
'field3_recovery' => $field3_recovery));
|
'field3_recovery' => $field3_recovery));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ if (isset ($_GET["update"]) or (isset($_GET["crt"]))) { // Edit mode
|
|||||||
$parent_detection = $row["parent_detection"];
|
$parent_detection = $row["parent_detection"];
|
||||||
$parent_recursion = $row["parent_recursion"];
|
$parent_recursion = $row["parent_recursion"];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} elseif (isset ($_GET["create"]) or isset($_GET["crt"])) {
|
elseif (isset ($_GET["create"]) or isset($_GET["crt"])) {
|
||||||
$create_recon = true;
|
$create_recon = true;
|
||||||
if (isset ($_GET["crt"])) {
|
if (isset ($_GET["crt"])) {
|
||||||
if ($_GET["crt"] != "Create") {
|
if ($_GET["crt"] != "Create") {
|
||||||
|
@ -49,6 +49,7 @@ if (!isset ($config)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
');
|
');
|
||||||
@ -127,7 +128,8 @@ function process_user_login ($login, $pass) {
|
|||||||
if ($profile === false && empty ($config["auth"]["create_user_undefined"])) {
|
if ($profile === false && empty ($config["auth"]["create_user_undefined"])) {
|
||||||
$config["auth_error"] = "No profile"; //Error message, don't translate
|
$config["auth_error"] = "No profile"; //Error message, don't translate
|
||||||
return false; //User doesn't have a profile so doesn't have access
|
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
|
$ret = profile_create_user_profile ($login); //User doesn't have a profile but we are asked to create one
|
||||||
if ($ret === false) {
|
if ($ret === false) {
|
||||||
$config["auth_error"] = "Profile creation failed"; //Error message, don't translate
|
$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) {
|
function is_user ($id_user) {
|
||||||
$user = get_user_info ($id_user);
|
$user = get_user_info ($id_user);
|
||||||
|
|
||||||
if (empty ($user))
|
if (empty ($user))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +186,7 @@ function get_user_fullname ($id_user) {
|
|||||||
//User doesn't exist
|
//User doesn't exist
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) $info["fullname"];
|
return (string) $info["fullname"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +199,7 @@ function get_user_fullname ($id_user) {
|
|||||||
*/
|
*/
|
||||||
function get_user_email ($id_user) {
|
function get_user_email ($id_user) {
|
||||||
$info = get_user_info ($id_user);
|
$info = get_user_info ($id_user);
|
||||||
|
|
||||||
return (string) $info["email"];
|
return (string) $info["email"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +215,7 @@ function get_user_id ($user) {
|
|||||||
if (is_array ($user))
|
if (is_array ($user))
|
||||||
/* FIXME: Is this right? */
|
/* FIXME: Is this right? */
|
||||||
return $user['id_user'];
|
return $user['id_user'];
|
||||||
|
|
||||||
return (int) $user;
|
return (int) $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +252,8 @@ function get_user_admins () {
|
|||||||
|
|
||||||
if (! empty ($ldap_cache["cached_admins"])) {
|
if (! empty ($ldap_cache["cached_admins"])) {
|
||||||
return $ldap_cache["cached_admins"];
|
return $ldap_cache["cached_admins"];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ldap_cache["cached_admins"] = array ();
|
$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"]));
|
$sr = ldap_search ( $ldap_cache["ds"], $config["auth"]["ldap_admin_group_name"], $search_filter, array ($config["auth"]["ldap_admin_group_attr"]));
|
||||||
if (!$sr) {
|
if (!$sr) {
|
||||||
$ldap_cache["error"] .= 'Error searching LDAP server (get_user_admins): ' . ldap_error ($ldap_cache["ds"]);
|
$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);
|
$admins = ldap_get_entries( $ldap_cache["ds"], $sr);
|
||||||
for( $x = 0; $x < $admins[0][$config["auth"]["ldap_admin_group_attr"]]['count']; $x++) {
|
for( $x = 0; $x < $admins[0][$config["auth"]["ldap_admin_group_attr"]]['count']; $x++) {
|
||||||
if ($config["auth"]["ldap_admin_group_type"] != 'posixgroup') {
|
if ($config["auth"]["ldap_admin_group_type"] != 'posixgroup') {
|
||||||
$ldap_cache["cached_admins"][] = stripdn ($admins[0][$config["auth"]["ldap_admin_group_attr"]][$x]);
|
$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];
|
$ldap_cache["cached_admins"][] = $admins[0][$config["auth"]["ldap_admin_group_attr"]][$x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,17 +315,20 @@ function ldap_search_user ($login) {
|
|||||||
|
|
||||||
if (!$sr) {
|
if (!$sr) {
|
||||||
$ldap_cache["error"] .= 'Error searching LDAP server: ' . ldap_error ($ldap_cache["ds"]);
|
$ldap_cache["error"] .= 'Error searching LDAP server: ' . ldap_error ($ldap_cache["ds"]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$info = @ldap_get_entries ($ldap_cache["ds"], $sr );
|
$info = @ldap_get_entries ($ldap_cache["ds"], $sr );
|
||||||
if ( $info['count'] != 1 ) {
|
if ( $info['count'] != 1 ) {
|
||||||
$ldap_cache["error"] .= 'Invalid user';
|
$ldap_cache["error"] .= 'Invalid user';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$nick = $info[0]['dn'];
|
$nick = $info[0]['dn'];
|
||||||
}
|
}
|
||||||
@ldap_free_result ($sr);
|
@ldap_free_result ($sr);
|
||||||
}
|
}
|
||||||
@ldap_close ($ldap_cache["ds"]);
|
@ldap_close ($ldap_cache["ds"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nick;
|
return $nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +350,8 @@ function ldap_valid_login ($login, $password) {
|
|||||||
$ret = false;
|
$ret = false;
|
||||||
if (!empty ($config["auth"]["ldap_port"])) {
|
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
|
$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
|
$ds = @ldap_connect ($config["auth"]["ldap_server"]); //Since this is a separate bind we don't store it global
|
||||||
}
|
}
|
||||||
if ($ds) {
|
if ($ds) {
|
||||||
@ -355,15 +369,18 @@ function ldap_valid_login ($login, $password) {
|
|||||||
if (!$r) {
|
if (!$r) {
|
||||||
$ldap_cache["error"] .= 'Invalid login';
|
$ldap_cache["error"] .= 'Invalid login';
|
||||||
//$ldap_cache["error"] .= ': incorrect password'; // uncomment for debugging
|
//$ldap_cache["error"] .= ': incorrect password'; // uncomment for debugging
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ret = true;
|
$ret = true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ldap_cache["error"] .= 'Invalid login';
|
$ldap_cache["error"] .= 'Invalid login';
|
||||||
//$ldap_cache["error"] .= ': no such user';
|
//$ldap_cache["error"] .= ': no such user';
|
||||||
}
|
}
|
||||||
@ldap_close ($ds);
|
@ldap_close ($ds);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ldap_cache["error"] .= 'Error connecting to LDAP server';
|
$ldap_cache["error"] .= 'Error connecting to LDAP server';
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -387,12 +404,14 @@ function ldap_load_user ($login) {
|
|||||||
|
|
||||||
if (!$sr) {
|
if (!$sr) {
|
||||||
$ldap_cache["error"] .= 'Error searching LDAP server (load_user): ' . ldap_error( $ldap_cache["ds"] );
|
$ldap_cache["error"] .= 'Error searching LDAP server (load_user): ' . ldap_error( $ldap_cache["ds"] );
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$info = @ldap_get_entries ($ldap_cache["ds"], $sr);
|
$info = @ldap_get_entries ($ldap_cache["ds"], $sr);
|
||||||
if ($info['count'] != 1) {
|
if ($info['count'] != 1) {
|
||||||
$ldap_cache["error"] .= 'Invalid login';
|
$ldap_cache["error"] .= 'Invalid login';
|
||||||
//$ldap_cache["error"] .= ', could not load user'; //Uncomment for debugging
|
//$ldap_cache["error"] .= ', could not load user'; //Uncomment for debugging
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ret = array ();
|
$ret = array ();
|
||||||
foreach ($config["auth"]["ldap_user_attr"] as $internal_key => $ldap_key) {
|
foreach ($config["auth"]["ldap_user_attr"] as $internal_key => $ldap_key) {
|
||||||
$ret["last_connect"] = $time;
|
$ret["last_connect"] = $time;
|
||||||
@ -408,7 +427,8 @@ function ldap_load_user ($login) {
|
|||||||
@ldap_free_result ($sr);
|
@ldap_free_result ($sr);
|
||||||
}
|
}
|
||||||
@ldap_close ( $ldap_cache["ds"] );
|
@ldap_close ( $ldap_cache["ds"] );
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ldap_cache["error"] .= 'Could not connect to LDAP server';
|
$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"])) {
|
if (!empty ($config["auth"]["ldap_port"]) && !is_resource ($ldap_cache["ds"])) {
|
||||||
$ldap_cache["ds"] = @ldap_connect ($config["auth"]["ldap_server"], $config["auth"]["ldap_port"]);
|
$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"]);
|
$ldap_cache["ds"] = @ldap_connect ($config["auth"]["ldap_server"]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +582,8 @@ function ldap_connect_bind () {
|
|||||||
|
|
||||||
if (!empty ($config["auth"]["ldap_admin_dn"])) {
|
if (!empty ($config["auth"]["ldap_admin_dn"])) {
|
||||||
$r = @ldap_bind ($ldap_cache["ds"], $config["auth"]["ldap_admin_dn"], $config["auth"]["ldap_admin_pwd"]);
|
$r = @ldap_bind ($ldap_cache["ds"], $config["auth"]["ldap_admin_dn"], $config["auth"]["ldap_admin_pwd"]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$r = @ldap_bind ($ldap_cache["ds"]);
|
$r = @ldap_bind ($ldap_cache["ds"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,10 +592,10 @@ function ldap_connect_bind () {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$ldap_cache["error"] .= 'Error connecting to LDAP server';
|
$ldap_cache["error"] .= 'Error connecting to LDAP server';
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -1046,5 +1046,4 @@ function mysql_db_get_table_count($sql, $search_history_db = false) {
|
|||||||
|
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -1897,7 +1897,15 @@ function agents_monitor_critical ($id_agent, $filter="") {
|
|||||||
$filter = " AND ".$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.
|
// Get warning monitors by using the status code in modules.
|
||||||
@ -1908,7 +1916,15 @@ function agents_monitor_warning ($id_agent, $filter="") {
|
|||||||
$filter = " AND ".$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.
|
// Get unknown monitors by using the status code in modules.
|
||||||
@ -1919,18 +1935,33 @@ function agents_monitor_unknown ($id_agent, $filter="") {
|
|||||||
$filter = " AND ".$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.
|
// Get ok monitors by using the status code in modules.
|
||||||
|
|
||||||
function agents_monitor_ok ($id_agent, $filter="") {
|
function agents_monitor_ok ($id_agent, $filter="") {
|
||||||
|
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
$filter = " AND ".$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1523,7 +1523,8 @@ function alerts_validate_alert_compound ($id_alert_compound) {
|
|||||||
$group_id, $agent_id, 1, $config["id_user"],
|
$group_id, $agent_id, 1, $config["id_user"],
|
||||||
"alert_manual_validation", 1, $alert["id"],
|
"alert_manual_validation", 1, $alert["id"],
|
||||||
$id);
|
$id);
|
||||||
} elseif ($result === false) {
|
}
|
||||||
|
elseif ($result === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,14 @@ if (!function_exists ('mime_content_type')) {
|
|||||||
$ext = strtolower (array_pop (explode ('.', $filename)));
|
$ext = strtolower (array_pop (explode ('.', $filename)));
|
||||||
if (array_key_exists ($ext, $mime_types)) {
|
if (array_key_exists ($ext, $mime_types)) {
|
||||||
return $mime_types[$ext];
|
return $mime_types[$ext];
|
||||||
} elseif (function_exists ('finfo_open')) {
|
}
|
||||||
|
elseif (function_exists ('finfo_open')) {
|
||||||
$finfo = finfo_open (FILEINFO_MIME);
|
$finfo = finfo_open (FILEINFO_MIME);
|
||||||
$mimetype = finfo_file ($finfo, $filename);
|
$mimetype = finfo_file ($finfo, $filename);
|
||||||
finfo_close ($finfo);
|
finfo_close ($finfo);
|
||||||
return $mimetype;
|
return $mimetype;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$temp = exec ("file ".$filename);
|
$temp = exec ("file ".$filename);
|
||||||
if (isset($temp) && $temp != '')
|
if (isset($temp) && $temp != '')
|
||||||
return $temp;
|
return $temp;
|
||||||
|
@ -300,12 +300,15 @@ function incidents_delete_note ($id_note, $transact = true) {
|
|||||||
if ($transact == true && $errors > 0) {
|
if ($transact == true && $errors > 0) {
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
return false;
|
return false;
|
||||||
} elseif ($transact == true) {
|
}
|
||||||
|
elseif ($transact == true) {
|
||||||
db_process_sql_commit ();
|
db_process_sql_commit ();
|
||||||
return true;
|
return true;
|
||||||
} elseif ($errors > 0) {
|
}
|
||||||
|
elseif ($errors > 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,8 @@ function messages_create_group ($usuario_origen, $dest_group, $subject, $mensaje
|
|||||||
if (! array_key_exists ($usuario_origen, $users)) {
|
if (! array_key_exists ($usuario_origen, $users)) {
|
||||||
//Users don't exist in the system
|
//Users don't exist in the system
|
||||||
return false;
|
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.
|
//There are no users in the group, so it hasn't failed although it hasn't done anything.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,8 @@ function reporting_get_group_stats ($id_group = 0) {
|
|||||||
function reporting_event_reporting ($id_group, $period, $date = 0, $return = false) {
|
function reporting_event_reporting ($id_group, $period, $date = 0, $return = false) {
|
||||||
if (empty ($date)) {
|
if (empty ($date)) {
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
} elseif (!is_numeric ($date)) {
|
}
|
||||||
|
elseif (!is_numeric ($date)) {
|
||||||
$date = strtotime ($date);
|
$date = strtotime ($date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,6 +1327,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
|
|||||||
if (! sizeof ($alerts_fired)) {
|
if (! sizeof ($alerts_fired)) {
|
||||||
if (!$return)
|
if (!$return)
|
||||||
echo $output;
|
echo $output;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
$table = reporting_get_fired_alerts_table ($alerts_fired);
|
$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)
|
if (!$return)
|
||||||
echo $output;
|
echo $output;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,13 +1438,15 @@ function reporting_get_monitors_down_table ($monitors_down) {
|
|||||||
$data[0] = '';
|
$data[0] = '';
|
||||||
if ($monitor['descripcion'] != '') {
|
if ($monitor['descripcion'] != '') {
|
||||||
$data[1] = $monitor['descripcion'];
|
$data[1] = $monitor['descripcion'];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data[1] = $monitor['nombre'];
|
$data[1] = $monitor['nombre'];
|
||||||
}
|
}
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,7 +1462,9 @@ function reporting_get_monitors_down_table ($monitors_down) {
|
|||||||
*/
|
*/
|
||||||
function reporting_print_group_reporting ($id_group, $return = false) {
|
function reporting_print_group_reporting ($id_group, $return = false) {
|
||||||
$agents = agents_get_group_agents ($id_group, false, "none");
|
$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)
|
if ($return === false)
|
||||||
echo $output;
|
echo $output;
|
||||||
@ -1532,6 +1539,7 @@ function reporting_get_agent_alerts_table ($id_agent, $period = 0, $date = 0) {
|
|||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $table;
|
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) {
|
function reporting_get_agent_detailed ($id_agent, $period = 0, $date = 0, $return = false) {
|
||||||
$output = '';
|
$output = '';
|
||||||
$n_a_string = __('N/A').'(*)';
|
$n_a_string = __('N/A(*)');
|
||||||
|
|
||||||
/* Show modules in agent */
|
/* Show modules in agent */
|
||||||
$output .= '<div class="agent_reporting">';
|
$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>';
|
$output .= '<h4>'.__('Modules').'</h3>';
|
||||||
$table_modules = reporting_get_agent_modules_table ($id_agent, $period, $date);
|
$table_modules = reporting_get_agent_modules_table ($id_agent, $period, $date);
|
||||||
$table_modules->width = '99%';
|
$table_modules->width = '99%';
|
||||||
|
@ -469,12 +469,6 @@ foreach ($agents as $agent) {
|
|||||||
}
|
}
|
||||||
$data[0] .= '</div>';
|
$data[0] .= '</div>';
|
||||||
|
|
||||||
/*if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {
|
|
||||||
$data[0] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente='.$agent["id_agente"].'">';
|
|
||||||
$data[0] .= html_print_image ("images/setup.png", true, array ("border" => 0, "width" => 16));
|
|
||||||
$data[0] .= '</a> ';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt');
|
$data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt');
|
||||||
|
|
||||||
$data[2] = ui_print_os_icon ($agent["id_os"], false, true);
|
$data[2] = ui_print_os_icon ($agent["id_os"], false, true);
|
||||||
@ -550,19 +544,6 @@ if (!empty ($table->data)) {
|
|||||||
} else {
|
} else {
|
||||||
echo '<div class="nf">'.__('There are no defined agents').'</div>';
|
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&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">
|
<script type="text/javascript">
|
||||||
@ -583,6 +564,5 @@ $(document).ready (function () {
|
|||||||
$("#group_id").blur (function () {
|
$("#group_id").blur (function () {
|
||||||
$(this).css ("width", "180px");
|
$(this).css ("width", "180px");
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -71,7 +71,8 @@ foreach ($modules as $module_id => $module) {
|
|||||||
if ($loc < $offset) {
|
if ($loc < $offset) {
|
||||||
$loc++;
|
$loc++;
|
||||||
continue; //Skip offset
|
continue; //Skip offset
|
||||||
} elseif ($loc >= $offset + $config["block_size"]) {
|
}
|
||||||
|
elseif ($loc >= $offset + $config["block_size"]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$data = array ();
|
$data = array ();
|
||||||
@ -81,7 +82,8 @@ foreach ($modules as $module_id => $module) {
|
|||||||
$sla_min = $module["min_critical"];
|
$sla_min = $module["min_critical"];
|
||||||
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], $sla_min));
|
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], $sla_min));
|
||||||
$data[2] = 100 - $data[2]. "%";
|
$data[2] = 100 - $data[2]. "%";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%';
|
$data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,13 +91,15 @@ foreach ($modules as $module_id => $module) {
|
|||||||
$status = modules_get_agentmodule_status ($module_id);
|
$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')));
|
$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')));
|
$data[3] = html_print_image ("images/pixel_green.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Up')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module["module_interval"] > 0) {
|
if ($module["module_interval"] > 0) {
|
||||||
$data[4] = $module["module_interval"];
|
$data[4] = $module["module_interval"];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data[4] = $interval;
|
$data[4] = $interval;
|
||||||
}
|
}
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -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, "");
|
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 '<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.'">';
|
echo '<input type="hidden" name="id_inc" value="'.$id_inc.'">';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui_print_page_header (__('Create incident'), "images/book_edit.png", false, "", false, "");
|
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">';
|
echo '<form name="accion_form" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident&action=insert">';
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,8 @@ if (is_ajax ())
|
|||||||
|
|
||||||
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
||||||
echo __('Never');
|
echo __('Never');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo $agent["ultimo_contacto_remoto"];
|
echo $agent["ultimo_contacto_remoto"];
|
||||||
}
|
}
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
@ -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 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"]) {
|
if (($config["id_user"] == $id || check_acl ($config["id_user"], users_get_groups ($id), "UM")) && $config["user_can_update_info"]) {
|
||||||
$view_mode = false;
|
$view_mode = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$view_mode = true;
|
$view_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user