diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 2e27ee6c62..7a17aba028 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -2145,8 +2145,8 @@ class ConsoleSupervisor [ 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', 'title' => __('This instance is not registered in the Update manager section'), - 'message' => __('Click here to start the registration process'), - 'url' => 'javascript: force_run_register();', + 'message' => __('Click here to start the registration process'), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', ] ); } else { @@ -2166,7 +2166,7 @@ class ConsoleSupervisor // Check default password for "admin". $admin_with_default_pass = db_get_value_sql( 'SELECT count(*) FROM tusuario - WHERE + WHERE id_user="admin" AND password="1da7ee7d45b96d0e1f45ee4ee23da560" AND is_admin=1 @@ -2441,11 +2441,11 @@ class ConsoleSupervisor config_update_value('last_um_check', $future, true); $messages = update_manager_get_messages(); + if (is_array($messages) === true) { $source_id = get_notification_source_id( 'Official communication' ); - foreach ($messages as $message) { if (isset($message['url']) === false) { $message['url'] = '#'; @@ -2476,8 +2476,8 @@ class ConsoleSupervisor // List all servers except satellite server. $server_version_list = db_get_all_rows_sql( sprintf( - 'SELECT `name`, `version` - FROM tserver + 'SELECT `name`, `version` + FROM tserver WHERE server_type != %d GROUP BY `version`', SERVER_TYPE_ENTERPRISE_SATELLITE diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index ba18483af0..c72cfb15f4 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -84,10 +84,7 @@ function get_notification_targets(int $id_message) if (is_array($ret)) { foreach ($ret as $row) { - array_push( - $targets['users'], - get_user_fullname($row['id_user']) - ); + array_push($targets['users'], get_user_fullname($row['id_user'])); } } @@ -227,8 +224,10 @@ function check_notification_readable(int $id_message) * * @return array [users] and [groups] with the targets. */ -function get_notification_source_targets(int $id_source, ?string $subtype=null) -{ +function get_notification_source_targets( + int $id_source, + ?string $subtype=null +) { $ret = []; $filter = ''; @@ -484,7 +483,8 @@ function notifications_add_group_to_source($source_id, $groups) continue; } - $res = $res && db_process_sql_insert( + $res = $res && + db_process_sql_insert( 'tnotification_source_group', [ 'id_group' => $group, @@ -525,7 +525,8 @@ function notifications_add_users_to_source($source_id, $users) continue; } - $res = $res && db_process_sql_insert( + $res = $res && + db_process_sql_insert( 'tnotification_source_user', [ 'id_user' => $user, @@ -551,7 +552,13 @@ function notifications_add_users_to_source($source_id, $users) function notifications_get_group_source_not_configured($source_id) { $groups_selected = notifications_get_group_sources_for_select($source_id); - $all_groups = users_get_groups_for_select(false, 'AR', false, true, $groups_selected); + $all_groups = users_get_groups_for_select( + false, + 'AR', + false, + true, + $groups_selected + ); return array_diff($all_groups, $groups_selected); } @@ -566,12 +573,10 @@ function notifications_get_group_source_not_configured($source_id) */ function notifications_get_user_source_not_configured($source_id) { - $users_selected = array_keys(notifications_get_user_sources_for_select($source_id)); - $users = get_users( - 'id_user', - ['!id_user' => $users_selected], - ['id_user'] + $users_selected = array_keys( + notifications_get_user_sources_for_select($source_id) ); + $users = get_users('id_user', ['!id_user' => $users_selected], ['id_user']); return index_array($users, 'id_user', 'id_user'); } @@ -587,8 +592,8 @@ function notifications_get_user_source_not_configured($source_id) function notifications_build_user_enable_return($status, $enabled) { return [ - 'status' => ((bool) $status === true) ? 1 : 0, - 'enabled' => ((bool) $enabled === true) ? 1 : 0, + 'status' => (bool) $status === true ? 1 : 0, + 'enabled' => (bool) $enabled === true ? 1 : 0, ]; } @@ -625,16 +630,11 @@ function notifications_get_user_label_status($source, $user, $label) $common_groups = array_intersect( array_keys(users_get_groups($user)), - array_keys( - notifications_get_group_sources_for_select($source['id']) - ) + array_keys(notifications_get_group_sources_for_select($source['id'])) ); // No group found, return no permissions. $value = empty($common_groups) ? false : $source[$label]; - return notifications_build_user_enable_return( - $value, - false - ); + return notifications_build_user_enable_return($value, false); } @@ -681,13 +681,7 @@ function notifications_get_counters() { $num_notifications = 0; $last_id = 0; - $last_message = messages_get_overview( - 'timestamp', - 'DESC', - false, - false, - 1 - ); + $last_message = messages_get_overview('timestamp', 'DESC', false, false, 1); if (!empty($last_message)) { $num_notifications = messages_get_count(); $last_id = $last_message[0]['id_mensaje']; @@ -718,7 +712,9 @@ function notifications_get_counters() function notifications_print_ball($num_notifications, $last_id) { $no_notifications = (int) $num_notifications === 0; - $class_status = ($no_notifications) ? 'notification-ball-no-messages' : 'notification-ball-new-messages'; + $class_status = $no_notifications + ? 'notification-ball-no-messages' + : 'notification-ball-new-messages'; return sprintf( '