Merge branch 'develop' into 'ent-7787-Debug-modulos-web-corta-urls'

# Conflicts:
#   pandora_console/extras/mr/51.sql
This commit is contained in:
José González 2021-11-22 11:44:06 +00:00
commit b8d884008b
117 changed files with 25020 additions and 18081 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.758-211112
Version: 7.0NG.758-211122
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.758-211112"
pandora_version="7.0NG.758-211122"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.758';
use constant AGENT_BUILD => '211112';
use constant AGENT_BUILD => '211122';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.758
%define release 211112
%define release 211122
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.758
%define release 211112
%define release 211122
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.758"
PI_BUILD="211112"
PI_BUILD="211122"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{211112}
{211122}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.758 Build 211112")
#define PANDORA_VERSION ("7.0NG.758 Build 211122")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.758(Build 211112))"
VALUE "ProductVersion", "(7.0NG.758(Build 211122))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,6 +1,9 @@
# pandora disable listing
Options -Indexes
# Avoid clickjacking
Header always append X-Frame-Options SAMEORIGIN
<Files ~ "\.log$">
Order Allow,Deny
Deny from All

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.758-211112
Version: 7.0NG.758-211122
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.758-211112"
pandora_version="7.0NG.758-211122"
package_pear=0
package_pandora=1

View File

@ -31,7 +31,7 @@ global $config;
// Require needed class.
require_once $config['homedir'].'/include/class/AgentsAlerts.class.php';
// Get the parameter.
$sec2 = get_parameter_get('sec2');
$sec2 = get_parameter_get('sec2');
// Add operation menu option.
extensions_add_operation_menu_option(
__('Agents/Alerts view'),

View File

@ -351,7 +351,7 @@ function mainModuleGroups()
}
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
$data[$i][$j] .= '<a class="info_cell white font_18px" rel="'.$rel.'" href="'.$url.'">';
$data[$i][$j] .= "<a class='info_cell white font_18px' rel='".$rel."' href='".$url."'>";
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>';
} else {

View File

@ -206,7 +206,7 @@ function users_extension_main_god($god=true)
}
extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM');
extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', null, 'UM');
extensions_add_godmode_function('users_extension_main_god');
extensions_add_main_function('users_extension_main');

View File

@ -111,4 +111,7 @@ enterprise/operation/agentes/pandora_networkmap.view.php
enterprise/include/ajax/map_enterprise.ajax.php
enterprise/include/javascript/SimpleMapController.js
enterprise/include/javascript/tooltipster.bundle.min.js
enterprise/include/styles/tooltipster.bundle.min.css
enterprise/include/styles/tooltipster.bundle.min.css
mobile/include/javascript/jquery.mobile-1.3.1.js
mobile/include/style/jquery.mobile-1.3.1.css
godmode/alerts/configure_alert_special_days.php

View File

@ -2,4 +2,31 @@ START TRANSACTION;
ALTER TABLE tagente_modulo MODIFY debug_content TEXT;
CREATE TABLE IF NOT EXISTS `talert_calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
`id_group` INT(10) NOT NULL DEFAULT 0,
`description` text,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;
UPDATE `talert_special_days` set `day_code` = 1 WHERE `same_day` = 'monday';
UPDATE `talert_special_days` set `day_code` = 2 WHERE `same_day` = 'tuesday';
UPDATE `talert_special_days` set `day_code` = 3 WHERE `same_day` = 'wednesday';
UPDATE `talert_special_days` set `day_code` = 4 WHERE `same_day` = 'thursday';
UPDATE `talert_special_days` set `day_code` = 5 WHERE `same_day` = 'friday';
UPDATE `talert_special_days` set `day_code` = 6 WHERE `same_day` = 'saturday';
UPDATE `talert_special_days` set `day_code` = 7 WHERE `same_day` = 'sunday';
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
ALTER TABLE `talert_special_days` ADD FOREIGN KEY (`id_calendar`) REFERENCES `talert_calendar`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tagent_repository` ADD COLUMN `deployment_timeout` INT UNSIGNED DEFAULT 600 AFTER `path`;
COMMIT;

View File

@ -2683,6 +2683,7 @@ CREATE TABLE `tagent_repository` (
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`deployment_timeout` INT UNSIGNED DEFAULT 600,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
@ -4223,3 +4224,31 @@ INSERT INTO `tncm_script` VALUES
(5,5,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;term&#x0d;&#x0a;end&#x0d;&#x0a;end&#x0d;&#x0a;exit&#x0d;&#x0a;');
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5);
-- ----------------------------------------------------------------------
-- Table `talert_calendar`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
`id_group` INT(10) NOT NULL DEFAULT 0,
`description` text,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;
UPDATE `talert_special_days` set `day_code` = 1 WHERE `same_day` = 'monday';
UPDATE `talert_special_days` set `day_code` = 2 WHERE `same_day` = 'tuesday';
UPDATE `talert_special_days` set `day_code` = 3 WHERE `same_day` = 'wednesday';
UPDATE `talert_special_days` set `day_code` = 4 WHERE `same_day` = 'thursday';
UPDATE `talert_special_days` set `day_code` = 5 WHERE `same_day` = 'friday';
UPDATE `talert_special_days` set `day_code` = 6 WHERE `same_day` = 'saturday';
UPDATE `talert_special_days` set `day_code` = 7 WHERE `same_day` = 'sunday';
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
ALTER TABLE `talert_special_days` ADD FOREIGN KEY (`id_calendar`) REFERENCES `talert_calendar`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -64,6 +64,8 @@ $data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -341,6 +341,7 @@ if (isset($groups[$grupo]) || $new_agent) {
'selected' => $grupo,
'return' => true,
'required' => true,
'privilege' => 'AW',
]
);
} else {

View File

@ -196,6 +196,13 @@ if ($create_agent) {
$nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$grupo = (int) get_parameter_post('grupo');
if ((bool) check_acl($config['id_user'], $grupo, 'AW') === false) {
db_pandora_audit('ACL Violation', 'Trying to access agent manager');
include $config['homedir'].'/general/noaccess.php';
return;
}
$intervalo = (string) get_parameter_post('intervalo', SECONDS_5MINUTES);
$comentarios = (string) get_parameter_post('comentarios', '');
$modo = (int) get_parameter_post('modo');
@ -990,6 +997,8 @@ if ($update_agent) {
$cps = get_parameter_switch('cps', -1);
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
$fields = db_get_all_fields_in_table('tagent_custom_fields');
$secondary_groups = (string) get_parameter('secondary_hidden', '');
if ($fields === false) {
$fields = [];
@ -1219,7 +1228,16 @@ if ($update_agent) {
"Quiet":"'.(int) $quiet.'",
"Cps":"'.(int) $cps.'"}';
enterprise_hook('update_agent', [$id_agente]);
// Create the secondary groups.
enterprise_hook(
'agents_update_secondary_groups',
[
$id_agente,
explode(',', $secondary_groups),
[],
]
);
ui_print_success_message(__('Successfully updated'));
db_pandora_audit(
'Agent management',

View File

@ -1,577 +1,75 @@
<?php
/**
* Calendar controller.
*
* @category Alerts
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Copyright (c) 2012-2016 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Begin.
global $config;
require_once 'include/functions_alerts.php';
require_once 'include/ics-parser/class.iCalReader.php';
require_once $config['homedir'].'/vendor/autoload.php';
require_once $config['homedir'].'/include/class/CalendarManager.class.php';
check_login();
use PandoraFMS\CalendarManager;
if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
$ajaxPage = 'godmode/alerts/alert_special_days';
$url = 'index.php?sec=galertas&sec2=godmode/alerts/alert_special_days';
if (is_ajax()) {
$get_alert_command = (bool) get_parameter('get_alert_command');
if ($get_alert_command) {
$id = (int) get_parameter('id');
$command = alerts_get_alert_command($id);
echo json_encode($command);
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$cs = new CalendarManager($url, $ajaxPage);
} catch (Exception $e) {
if ((bool) is_ajax() === true) {
echo json_encode(['error' => '[CalendarManager]'.$e->getMessage() ]);
exit;
} else {
echo '[CalendarManager]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// Header
ui_print_page_header(
__('Alerts').' &raquo; '.__('Special days list'),
'images/gm_alerts.png',
false,
'alert_special_days',
true
);
// AJAX controller.
if ((bool) is_ajax() === true) {
$method = get_parameter('method');
$update_special_day = (bool) get_parameter('update_special_day');
$create_special_day = (bool) get_parameter('create_special_day');
$delete_special_day = (bool) get_parameter('delete_special_day');
$upload_ical = (bool) get_parameter('upload_ical', 0);
$display_range = (int) get_parameter('display_range');
if ($upload_ical) {
$same_day = (string) get_parameter('same_day');
$overwrite = (bool) get_parameter('overwrite', 0);
$values = [];
$values['id_group'] = (string) get_parameter('id_group');
$values['same_day'] = $same_day;
$error = $_FILES['ical_file']['error'];
$extension = substr($_FILES['ical_file']['name'], -3);
if ($error == 0 && strcasecmp($extension, 'ics') == 0) {
$skipped_dates = '';
// $today = date ('Ymd');
$this_month = date('Ym');
$ical = new ICal($_FILES['ical_file']['tmp_name']);
$events = $ical->events();
foreach ($events as $event) {
$event_date = substr($event['DTSTART'], 0, 8);
$event_month = substr($event['DTSTART'], 0, 6);
if ($event_month >= $this_month) {
$values['description'] = @$event['SUMMARY'];
$values['date'] = $event_date;
$date = date('Y-m-d', strtotime($event_date));
$date_check = '';
$filter['id_group'] = $values['id_group'];
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
if ($overwrite) {
$id_special_day = db_get_value_filter('id', 'talert_special_days', $filter);
alerts_update_alert_special_day($id_special_day, $values);
} else {
if ($skipped_dates == '') {
$skipped_dates = __('Skipped dates: ');
}
$skipped_dates .= $date.' ';
}
} else {
alerts_create_alert_special_day($date, $same_day, $values);
}
}
}
$result = true;
} else {
$result = false;
}
if ($result) {
db_pandora_audit('Special days list', 'Upload iCalendar '.$_FILES['ical_file']['name']);
}
ui_print_result_message($result, __('Success to upload iCalendar').'<br />'.$skipped_dates, __('Fail to upload iCalendar'));
}
if ($create_special_day) {
$date = (string) get_parameter('date');
$same_day = (string) get_parameter('same_day');
$values = [];
$values['id_group'] = (string) get_parameter('id_group');
$values['description'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$aviable_description = true;
if (preg_match('/script/i', $values['description'])) {
$aviable_description = false;
}
$array_date = explode('-', $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') {
// '0001' means every year.
$year = '0001';
$date = $year.'-'.$month.'-'.$day;
}
if (!checkdate($month, $day, $year)) {
$result = '';
} else {
$date_check = '';
$filter['id_group'] = $values['id_group'];
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be created, it already exists');
if (method_exists($cs, $method) === true) {
if (CalendarManager::ajaxMethod($method) === true) {
$cs->{$method}();
} else {
if ($aviable_description) {
$result = alerts_create_alert_special_day($date, $same_day, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
} else {
$result = false;
}
$cs->error('Unavailable method.');
}
}
if ($result) {
db_pandora_audit('Command management', 'Create special day '.$result, false, false, $info);
} else {
db_pandora_audit('Command management', 'Fail try to create special day', false, false);
$cs->error('Method not found. ['.$method.']');
}
// Show errors
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
$messageAction = ui_print_result_message(
$result,
__('Successfully created'),
$messageAction
);
}
if ($update_special_day) {
$id = (int) get_parameter('id');
$alert = alerts_get_alert_special_day($id);
$date = (string) get_parameter('date');
$date_orig = (string) get_parameter('date_orig');
$same_day = (string) get_parameter('same_day');
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$id_group = (string) get_parameter('id_group');
$id_group_orig = (string) get_parameter('id_group_orig');
$aviable_description = true;
if (preg_match('/script/i', $description)) {
$aviable_description = false;
}
$array_date = explode('-', $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') {
// '0001' means every year.
$year = '0001';
$date = $year.'-'.$month.'-'.$day;
}
$values = [];
$values['date'] = $date;
$values['id_group'] = $id_group;
$values['same_day'] = $same_day;
$values['description'] = $description;
if (!checkdate($month, $day, $year)) {
$result = '';
} else {
if ($id_group != $id_group_orig || $date != $date_orig) {
$date_check = '';
$filter['id_group'] = $id_group;
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be updated, it already exists');
} else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
} else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
}
if ($result) {
db_pandora_audit('Command management', 'Update special day '.$id, false, false, $info);
} else {
db_pandora_audit('Command management', 'Fail to update special day '.$id, false, false);
}
// Show errors
if (!isset($messageAction)) {
$messageAction = __('Could not be updated');
}
$messageAction = ui_print_result_message(
$result,
__('Successfully updated'),
$messageAction
);
}
if ($delete_special_day) {
$id = (int) get_parameter('id');
$result = alerts_delete_alert_special_day($id);
if ($result) {
db_pandora_audit('Command management', 'Delete special day '.$id);
} else {
db_pandora_audit('Command management', 'Fail to delete special day '.$id);
}
ui_print_result_message(
$result,
__('Successfully deleted'),
__('Could not be deleted')
);
}
echo "<table cellpadding='4' cellspacing='4' class='databox upload bolder margin-bottom-10' width='100%
'><tr>";
echo "<form method='post' enctype='multipart/form-data' action='index.php?sec=gagente&sec2=godmode/alerts/alert_special_days'>";
echo '<td>';
echo __('iCalendar(.ics) file').'&nbsp;';
html_print_input_file('ical_file', false, false);
echo '</td><td>';
echo __('Same day of the week');
$days = [];
$days['monday'] = __('Monday');
$days['tuesday'] = __('Tuesday');
$days['wednesday'] = __('Wednesday');
$days['thursday'] = __('Thursday');
$days['friday'] = __('Friday');
$days['saturday'] = __('Saturday');
$days['sunday'] = __('Sunday');
html_print_select($days, 'same_day', $same_day, '', '', 0, false, false, false);
echo '</td><td>';
echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!users_can_manage_group_all('LM')) {
$can_manage_group_all = false;
// Stop any execution.
exit;
} else {
$can_manage_group_all = true;
// Run.
$cs->run();
}
echo '<div class="inline w250px">';
html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;');
echo '</div>';
echo '</td><td>';
echo __('Overwrite');
ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false);
echo '&nbsp;';
html_print_checkbox('overwrite', 1, $overwrite, false, false, false, true);
echo '</td><td>';
html_print_input_hidden('upload_ical', 1);
echo "<input name='srcbutton' type='submit' class='sub next' value='".__('Upload')."'>";
echo '</td></form>';
echo '</tr></table>';
$this_year = date('Y');
$this_month = date('m');
$filter = [];
if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
}
// Show display range.
$html = "<table cellpadding='4' cellspacing='4' width='100%' margin-bottom: 10px;'><tr><td>".__('Display range: ');
if ($display_range) {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">['.__('Default').']</a>&nbsp;&nbsp;';
if ($display_range > 1970) {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($display_range - 1);
$html .= '">&lt;&lt;&nbsp;</a>';
}
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range='.$display_range.'" class="bolder">['.$display_range.']</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($display_range + 1);
$html .= '">&nbsp;&gt;&gt;</a>';
} else {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days" class="bolder">['.__('Default').']</a>&nbsp;&nbsp;';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($this_year - 1);
$html .= '">&lt;&lt;&nbsp;</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= $this_year;
$html .= '">[';
$html .= $this_year;
$html .= ']</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($this_year + 1);
$html .= '">&nbsp;&gt;&gt;</a>';
}
$html .= '</td></tr>';
echo $html;
// Show calendar
for ($month = 1; $month <= 12; $month++) {
if ($display_range) {
$display_month = $month;
$display_year = $display_range;
} else {
$display_month = ($this_month + $month - 1);
$display_year = $this_year;
}
if ($display_month > 12) {
$display_month -= 12;
$display_year += 1;
}
$cal_table = new stdClass();
$cal_table->width = '100%';
$cal_table->class = 'databox data';
$cal_table->data = [];
$cal_table->head = [];
$cal_table->head[0] = __('Sun');
$cal_table->head[1] = __('Mon');
$cal_table->head[2] = __('Tue');
$cal_table->head[3] = __('Wed');
$cal_table->head[4] = __('Thu');
$cal_table->head[5] = __('Fri');
$cal_table->head[6] = __('Sat');
$cal_table->cellstyle = [];
$cal_table->size = [];
$cal_table->size[0] = '14%';
$cal_table->size[1] = '14%';
$cal_table->size[2] = '14%';
$cal_table->size[3] = '14%';
$cal_table->size[4] = '14%';
$cal_table->size[5] = '14%';
$cal_table->size[6] = '14%';
$cal_table->align = [];
$cal_table->border = '1';
$cal_table->titlestyle = 'text-align:center; font-weight: bold;';
switch ($display_month) {
case 1:
$cal_table->title = __('January');
break;
case 2:
$cal_table->title = __('February');
break;
case 3:
$cal_table->title = __('March');
break;
case 4:
$cal_table->title = __('April');
break;
case 5:
$cal_table->title = __('May');
break;
case 6:
$cal_table->title = __('June');
break;
case 7:
$cal_table->title = __('July');
break;
case 8:
$cal_table->title = __('August');
break;
case 9:
$cal_table->title = __('September');
break;
case 10:
$cal_table->title = __('October');
break;
case 11:
$cal_table->title = __('November');
break;
case 12:
$cal_table->title = __('December');
break;
}
$cal_table->title .= ' / '.$display_year;
$last_day = date('j', mktime(0, 0, 0, ($display_month + 1), 0, $display_year));
$cal_line = 0;
for ($day = 1; $day < ($last_day + 1); $day++) {
$week = date('w', mktime(0, 0, 0, $display_month, $day, $display_year));
if ($cal_line == 0 && $week != 0 && $day == 1) {
for ($i = 0; $i < $week; $i++) {
$cal_table->cellstyle[$cal_line][$i] = 'font-size: 18px;';
$cal_table->data[$cal_line][$i] = '-';
}
}
if ($week == 0 || $week == 6) {
$cal_table->cellstyle[$cal_line][$week] = 'color: red;';
}
$date = sprintf('%04d-%02d-%02d', $display_year, $display_month, $day);
$date_wildcard = sprintf('0001-%02d-%02d', $display_month, $day);
$special_days = '';
$filter['date'] = [
$date,
$date_wildcard,
];
$filter['order']['field'] = 'date';
$filter['order']['order'] = 'DESC';
$special_days = db_get_all_rows_filter('talert_special_days', $filter);
if ($special_days != '') {
foreach ($special_days as $special_day) {
$cal_table->data[$cal_line][$week] .= '<div class="font_18px" style="';
if ($special_day['same_day'] == 'sunday' || $special_day['same_day'] == 'saturday') {
$cal_table->data[$cal_line][$week] .= 'color: red;';
}
$cal_table->data[$cal_line][$week] .= '">';
$cal_table->data[$cal_line][$week] .= $day;
$cal_table->data[$cal_line][$week] .= '</div>';
$cal_table->data[$cal_line][$week] .= ui_print_group_icon($special_day['id_group'], true);
if ($special_day['date'] == $date_wildcard) {
$cal_table->data[$cal_line][$week] .= '('.ui_print_help_tip('This is valid every year. However, this will be ignored if indivisual setting for the same group is available.', true).') ';
}
$cal_table->data[$cal_line][$week] .= __('Same as ');
switch ($special_day['same_day']) {
case 'monday':
$cal_table->data[$cal_line][$week] .= __('Monday');
break;
case 'tuesday':
$cal_table->data[$cal_line][$week] .= __('Tuesday');
break;
case 'wednesday':
$cal_table->data[$cal_line][$week] .= __('Wednesday');
break;
case 'thursday':
$cal_table->data[$cal_line][$week] .= __('Thursday');
break;
case 'friday':
$cal_table->data[$cal_line][$week] .= __('Friday');
break;
case 'saturday':
$cal_table->data[$cal_line][$week] .= __('Saturday');
break;
case 'sunday':
$cal_table->data[$cal_line][$week] .= __('Sunday');
break;
}
// Only show description if is filled.
if (empty($special_day['description']) === false) {
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true);
}
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&id='.$special_day['id'].'" title=';
$cal_table->data[$cal_line][$week] .= __('Edit');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/config.png',
true,
['class' => 'invert_filter']
).'</a> &nbsp;';
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&delete_special_day=1&id='.$special_day['id'].'"onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;" title=';
$cal_table->data[$cal_line][$week] .= __('Remove');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/cross.png',
true,
['class' => 'invert_filter']
).'</a>';
;
}
$cal_table->data[$cal_line][$week] .= '<br>';
$cal_table->cellstyle[$cal_line][$week] = 'font-weight: bold;';
}
} else {
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
$cal_table->data[$cal_line][$week] = $day.'&nbsp;';
}
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&create_special_day=1&date='.$date.'" title=';
$cal_table->data[$cal_line][$week] .= __('Create');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/add_mc.png',
true,
['class' => 'invert_filter']
).'</a>';
if ($week == 6) {
$cal_line++;
}
}
for ($padding = ($week + 1); $padding <= 6; $padding++) {
$cal_table->cellstyle[$cal_line][$padding] = 'font-size: 18px;';
$cal_table->data[$cal_line][$padding] = '-';
}
html_print_table($cal_table);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden('create_special_day', 1);
echo '</form>';
echo '</div>';

View File

@ -237,7 +237,7 @@ $create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_saf
$sql_exclude_command_id = '';
if ($config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
}
@ -597,6 +597,7 @@ $(document).ready (function () {
$("#id_command").change (function () {
values = Array ();
// No se envia el valor del commando.
values.push({
name: "page",
value: "godmode/alerts/alert_commands"});

View File

@ -1,159 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Copyright (c) 2012-2013 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
global $config;
require_once 'include/functions_alerts.php';
check_login();
if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
ui_require_javascript_file('calendar');
$id = (int) get_parameter('id');
$date = (string) get_parameter('date');
$name = '';
$command = '';
$description = '';
$same_day = '';
$id_group = 0;
if ($id) {
$special_day = alerts_get_alert_special_day($id);
$date = str_replace('0001', '*', $special_day['date']);
$date_orig = $date;
$same_day = $special_day['same_day'];
$description = $special_day['description'];
$id_group = $special_day['id_group'];
$id_group_orig = $id_group;
}
if ($date == '') {
$date = date('Y-m-d', get_system_time());
}
// Header.
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure special day'),
'images/gm_alerts.png',
false,
'',
true
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = [];
$table->size[0] = '20%';
$table->data = [];
$table->data[0][0] = __('Date');
$table->data[0][1] = html_print_input_text(
'date',
$date,
'',
10,
10,
true
);
$table->data[0][1] .= html_print_image(
'images/calendar_view_day.png',
true,
[
'alt' => 'calendar',
'onclick' => "scwShow(scwID('text-date'),this);",
'class' => 'invert_filter',
]
);
$table->data[1][0] = __('Group');
$groups = users_get_groups();
$own_info = get_user_info($config['id_user']);
// Only display group "All" if user is administrator or has "LM" privileges.
if (users_can_manage_group_all('LM')) {
$display_all_group = true;
} else {
$display_all_group = false;
}
$table->data[1][1] = html_print_select_groups(
false,
'LW',
$display_all_group,
'id_group',
$id_group,
'',
'',
0,
true
);
$table->data[2][0] = __('Same day of the week');
$days = [];
$days['monday'] = __('Monday');
$days['tuesday'] = __('Tuesday');
$days['wednesday'] = __('Wednesday');
$days['thursday'] = __('Thursday');
$days['friday'] = __('Friday');
$days['saturday'] = __('Saturday');
$days['sunday'] = __('Sunday');
$table->data[2][1] = html_print_select(
$days,
'same_day',
$same_day,
'',
'',
0,
true,
false,
false
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true
);
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);
html_print_input_hidden('update_special_day', 1);
html_print_input_hidden('id_group_orig', $id_group_orig);
html_print_input_hidden('date_orig', $date_orig);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
} else {
html_print_input_hidden('create_special_day', 1);
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
}
echo '</div>';
echo '</form>';

View File

@ -11,8 +11,11 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
use PandoraFMS\Calendar;
require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('meta/include/functions_alerts_meta.php');
@ -288,7 +291,7 @@ function update_template($step)
$friday = (bool) get_parameter('friday');
$saturday = (bool) get_parameter('saturday');
$sunday = (bool) get_parameter('sunday');
$special_day = (bool) get_parameter('special_day');
$special_day = (int) get_parameter('special_day');
$time_from = (string) get_parameter('time_from');
$time_from = date('H:i:00', strtotime($time_from));
$time_to = (string) get_parameter('time_to');
@ -418,7 +421,7 @@ $thursday = true;
$friday = true;
$saturday = true;
$sunday = true;
$special_day = false;
$special_day = 0;
$default_action = 0;
$fields = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -561,7 +564,7 @@ if ($id && ! $create_template) {
$friday = (bool) $template['friday'];
$saturday = (bool) $template['saturday'];
$sunday = (bool) $template['sunday'];
$special_day = (bool) $template['special_day'];
$special_day = (int) $template['special_day'];
$max_alerts = $template['max_alerts'];
$min_alerts = $template['min_alerts'];
$min_alerts_reset_counter = $template['min_alerts_reset_counter'];
@ -671,11 +674,36 @@ if ($step == 2) {
);
$table->data[0][2] = __('Use special days list');
$table->data[0][3] = html_print_checkbox(
$data_special_days = Calendar::calendars(
// Fields.
[ '`talert_calendar`.*' ],
// Filter.
[],
// Count.
false,
// Offset.
null,
// Limit.
null,
// Order.
null,
// Sort field.
null,
// Reduce to a select.
true
);
$table->data[0][3] = html_print_select(
$data_special_days,
'special_day',
1,
$special_day,
'',
__('None'),
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
);

View File

@ -60,7 +60,7 @@ if (check_acl($config['id_user'], 0, 'AR')
// Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery');
$menu_godmode['discovery']['sec2'] = 'godmode/servers/discovery';
$menu_godmode['discovery']['sec2'] = '';
$menu_godmode['discovery']['id'] = 'god-discovery';
$menu_godmode['discovery']['sub'] = $sub;
}
@ -254,20 +254,20 @@ if (check_acl($config['id_user'], 0, 'LW')
$sub = [];
if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) {
// Custom event fields
$sub['godmode/events/events&amp;section=filter']['text'] = __('Event filters');
$sub['godmode/events/events&amp;section=filter']['id'] = 'Event filters';
$sub['godmode/events/events&section=filter']['text'] = __('Event filters');
$sub['godmode/events/events&section=filter']['id'] = 'Event filters';
}
if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/events/events&amp;section=fields']['text'] = __('Custom events');
$sub['godmode/events/events&amp;section=fields']['id'] = 'Custom events';
$sub['godmode/events/events&amp;section=responses']['text'] = __('Event responses');
$sub['godmode/events/events&amp;section=responses']['id'] = 'Event responses';
$sub['godmode/events/events&section=fields']['text'] = __('Custom events');
$sub['godmode/events/events&section=fields']['id'] = 'Custom events';
$sub['godmode/events/events&section=responses']['text'] = __('Event responses');
$sub['godmode/events/events&section=responses']['id'] = 'Event responses';
}
if (!empty($sub)) {
$menu_godmode['geventos']['text'] = __('Events');
$menu_godmode['geventos']['sec2'] = 'godmode/events/events&amp;section=filter';
$menu_godmode['geventos']['sec2'] = 'godmode/events/events&section=filter';
$menu_godmode['geventos']['id'] = 'god-events';
$menu_godmode['geventos']['sub'] = $sub;
}
@ -307,7 +307,7 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
if (check_acl($config['id_user'], 0, 'PM')) {
// Setup
$menu_godmode['gsetup']['text'] = __('Setup');
$menu_godmode['gsetup']['sec2'] = 'godmode/setup/setup&section=general';
$menu_godmode['gsetup']['sec2'] = 'general';
$menu_godmode['gsetup']['id'] = 'god-setup';
$sub = [];
@ -319,50 +319,50 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub['general']['subtype'] = 'nolink';
$sub2 = [];
$sub2['godmode/setup/setup&amp;section=general']['text'] = __('General Setup');
$sub2['godmode/setup/setup&amp;section=general']['id'] = 'General Setup';
$sub2['godmode/setup/setup&amp;section=general']['refr'] = 0;
$sub2['godmode/setup/setup&section=general']['text'] = __('General Setup');
$sub2['godmode/setup/setup&section=general']['id'] = 'General Setup';
$sub2['godmode/setup/setup&section=general']['refr'] = 0;
enterprise_hook('password_submenu');
enterprise_hook('enterprise_submenu');
enterprise_hook('historydb_submenu');
enterprise_hook('log_collector_submenu');
$sub2['godmode/setup/setup&amp;section=auth']['text'] = __('Authentication');
$sub2['godmode/setup/setup&amp;section=auth']['refr'] = 0;
$sub2['godmode/setup/setup&section=auth']['text'] = __('Authentication');
$sub2['godmode/setup/setup&section=auth']['refr'] = 0;
$sub2['godmode/setup/setup&amp;section=perf']['text'] = __('Performance');
$sub2['godmode/setup/setup&amp;section=perf']['refr'] = 0;
$sub2['godmode/setup/setup&section=perf']['text'] = __('Performance');
$sub2['godmode/setup/setup&section=perf']['refr'] = 0;
$sub2['godmode/setup/setup&amp;section=vis']['text'] = __('Visual styles');
$sub2['godmode/setup/setup&amp;section=vis']['refr'] = 0;
$sub2['godmode/setup/setup&section=vis']['text'] = __('Visual styles');
$sub2['godmode/setup/setup&section=vis']['refr'] = 0;
if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) {
$sub2['godmode/setup/setup&amp;section=net']['text'] = __('Netflow');
$sub2['godmode/setup/setup&amp;section=net']['refr'] = 0;
$sub2['godmode/setup/setup&section=net']['text'] = __('Netflow');
$sub2['godmode/setup/setup&section=net']['refr'] = 0;
}
}
$sub2['godmode/setup/setup&amp;section=ehorus']['text'] = __('eHorus');
$sub2['godmode/setup/setup&amp;section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&amp;section=integria']['text'] = __('Integria IMS');
$sub2['godmode/setup/setup&amp;section=integria']['refr'] = 0;
$sub2['godmode/setup/setup&section=integria']['text'] = __('Integria IMS');
$sub2['godmode/setup/setup&section=integria']['refr'] = 0;
enterprise_hook('module_library_submenu');
$sub2['godmode/setup/setup&amp;section=notifications']['text'] = __('Notifications');
$sub2['godmode/setup/setup&amp;section=notifications']['refr'] = 0;
$sub2['godmode/setup/setup&section=notifications']['text'] = __('Notifications');
$sub2['godmode/setup/setup&section=notifications']['refr'] = 0;
$sub2['godmode/setup/setup&amp;section=websocket_engine']['text'] = __('Websocket Engine');
$sub2['godmode/setup/setup&amp;section=websocket_engine']['refr'] = 0;
$sub2['godmode/setup/setup&section=websocket_engine']['text'] = __('Websocket Engine');
$sub2['godmode/setup/setup&section=websocket_engine']['refr'] = 0;
$sub2['godmode/setup/setup&amp;section=external_tools']['text'] = __('External Tools');
$sub2['godmode/setup/setup&amp;section=external_tools']['refr'] = 0;
$sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools');
$sub2['godmode/setup/setup&section=external_tools']['refr'] = 0;
if ($config['activate_gis']) {
$sub2['godmode/setup/setup&amp;section=gis']['text'] = __('Map conections GIS');
$sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS');
}
$sub['general']['sub2'] = $sub2;
@ -462,9 +462,9 @@ if (is_array($config['extensions'])) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
if ($extmenu['name'] == 'Cron jobs') {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'extensions';
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
} else {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions';
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
}
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true;
@ -525,8 +525,8 @@ $menu_godmode['links']['sub'] = $sub;
// Update Manager
if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) {
$menu_godmode['messages']['text'] = __('Update manager');
$menu_godmode['messages']['sec2'] = '';
$menu_godmode['messages']['id'] = 'god-um_messages';
$menu_godmode['messages']['sec2'] = '';
$sub = [];
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
@ -543,7 +543,6 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
// Module library.
if (check_acl($config['id_user'], 0, 'AR')) {
$menu_godmode['gmodule_library']['text'] = __('Module library');
$menu_godmode['gmodule_library']['sec2'] = 'godmode/module_library/module_library_view';
$menu_godmode['gmodule_library']['id'] = 'god-module_library';
$sub = [];

View File

@ -581,7 +581,7 @@ if ($is_management_allowed === true && $multiple_delete) {
$id = 0;
}
if ($id || $new_component
if ((bool) $id !== false || $new_component
|| $create_network_from_module
|| $create_network_from_snmp_browser
) {
@ -598,6 +598,7 @@ $url = ui_get_url_refresh(
'offset' => false,
'search_string' => $search_string,
'search_id_group' => $search_id_group,
'id' => $id,
],
true,
false

View File

@ -3505,7 +3505,7 @@ function print_SLA_list($width, $action, $idItem=null)
<tr id="sla_template" class="datos">
<td colspan="6">
<?php
echo __('Please save the SLA for start to add items in this list.');
echo __('Please save the item before adding entries to this list.');
?>
</td>
</tr>
@ -3772,23 +3772,23 @@ function print_SLA_list($width, $action, $idItem=null)
],
]
);
if (!empty($services_tmp)
&& $services_tmp != ENTERPRISE_NOT_HOOK
if (!empty($services_tmp)
&& $services_tmp != ENTERPRISE_NOT_HOOK
) {
foreach ($services_tmp as $service) {
$check_module_sla = modules_check_agentmodule_exists(
$service['sla_id_module']
);
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla
&& $check_module_sla_value
) {
foreach ($services_tmp as $service) {
$check_module_sla = modules_check_agentmodule_exists(
$service['sla_id_module']
);
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla
&& $check_module_sla_value
) {
$services[$service['id']] = $service['name'];
}
}
$services[$service['id']] = $service['name'];
}
}
}
echo '<td class="sla_list_service_col">';
echo html_print_select(

View File

@ -1970,9 +1970,11 @@ switch ($action) {
);
$values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter(
'combo_server'
);
if ($values['server_name'] == '') {
$values['server_name'] = get_parameter(
'combo_server'
);
}
if ((($values['type'] == 'custom_graph')
|| ($values['type'] == 'automatic_custom_graph'))

View File

@ -204,6 +204,15 @@ foreach ($layoutDatas as $layoutData) {
);
break;
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case CIRCULAR_PROGRESS_BAR:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/percentile_item.png',
true,
['title' => __('Percentile')]
);
break;
case MODULE_GRAPH:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/chart_curve.png',
@ -306,6 +315,16 @@ foreach ($layoutDatas as $layoutData) {
break;
case NETWORK_LINK:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/network_link_item.png',
true,
[
'title' => __('Network link'),
'class' => 'invert_filter',
]
);
break;
case LINE_ITEM:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/line_item.png',
@ -325,6 +344,30 @@ foreach ($layoutDatas as $layoutData) {
);
break;
case BASIC_CHART:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/basic_chart.png',
true,
['title' => __('Basic chart')]
);
break;
case ODOMETER:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/odometer.png',
true,
['title' => __('Odometer')]
);
break;
case CLOCK:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/clock-tab.png',
true,
['title' => __('Clock')]
);
break;
default:
if (enterprise_installed()) {
$table->data[($i + 1)]['icon'] = enterprise_visual_map_print_list_element('icon', $layoutData);
@ -394,6 +437,13 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true).' x '.html_print_input_text('height_'.$idLayoutData, $layoutData['width'], '', 2, 5, true);
break;
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case PERCENTILE_BUBBLE:
case PERCENTILE_BAR:
$table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true);
break;
default:
$table->data[($i + 1)][2] = html_print_input_text('width_'.$idLayoutData, $layoutData['width'], '', 2, 5, true).' x '.html_print_input_text('height_'.$idLayoutData, $layoutData['height'], '', 2, 5, true);
break;
@ -478,6 +528,7 @@ foreach ($layoutDatas as $layoutData) {
case LABEL:
case NETWORK_LINK:
case LINE_ITEM:
case CLOCK:
$table->data[($i + 2)][0] = '';
break;
@ -520,7 +571,7 @@ foreach ($layoutDatas as $layoutData) {
$params['value'] = db_get_value('alias', 'tagente', 'id_agente', $layoutData['id_agent']);
}
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {
if ($layoutData['id_custom_graph'] != 0) {
$table->data[($i + 2)][0] = __('Custom graph');
} else {
$table->data[($i + 2)][0] = ui_print_agent_autocomplete_input($params);
@ -540,6 +591,7 @@ foreach ($layoutDatas as $layoutData) {
case NETWORK_LINK:
case LINE_ITEM:
case GROUP_ITEM:
case CLOCK:
$table->data[($i + 2)][1] = '';
break;
@ -569,7 +621,7 @@ foreach ($layoutDatas as $layoutData) {
$modules = io_safe_output($modules);
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {
if ($layoutData['id_custom_graph'] != 0) {
if (is_metaconsole()) {
$graphs = [];
$graphs = metaconsole_get_custom_graphs(true);

View File

@ -433,7 +433,10 @@ switch ($activeTab) {
$idsElements = db_get_all_rows_filter(
'tlayout_data',
['id_layout' => $idVisualConsole],
['id']
[
'id',
'type',
]
);
if ($idsElements === false) {
@ -449,18 +452,33 @@ switch ($activeTab) {
$values['height'] = get_parameter('height_'.$id, 0);
$values['pos_x'] = get_parameter('left_'.$id, 0);
$values['pos_y'] = get_parameter('top_'.$id, 0);
$type = db_get_value('type', 'tlayout_data', 'id', $id);
switch ($type) {
case MODULE_GRAPH:
switch ($idElement['type']) {
case NETWORK_LINK:
case LINE_ITEM:
continue 2;
break;
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$values['period'] = get_parameter('period_'.$id, 0);
break;
case MODULE_GRAPH:
$values['period'] = get_parameter('period_'.$id, 0);
unset($values['image']);
break;
case GROUP_ITEM:
$values['id_group'] = get_parameter('group_'.$id, 0);
$values['show_statistics'] = get_parameter('show_statistics', 0);
break;
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case PERCENTILE_BUBBLE:
case PERCENTILE_BAR:
unset($values['height']);
break;
}

View File

@ -1513,7 +1513,7 @@ $(document).ready (function () {
$('#table_macros-field' + i)
.removeAttr('class');
$("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_value]").val(old_value).trigger('change');
$('#table_macros-field').show();
}
}

View File

@ -1,17 +1,28 @@
<?php
/**
* * Configure profiles.
*
* @category Profiles
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Global variables
// Global variables.
global $config;
check_login();
@ -32,7 +43,7 @@ enterprise_include_once('meta/include/functions_users_meta.php');
$tab = get_parameter('tab', 'profile');
$pure = get_parameter('pure', 0);
// Header
// Header.
if (!is_metaconsole()) {
$buttons = [
'user' => [
@ -79,46 +90,46 @@ if (!is_metaconsole()) {
$new_profile = (bool) get_parameter('new_profile');
$id_profile = (int) get_parameter('id');
// Edit profile
// Edit profile.
if ($id_profile || $new_profile) {
if ($new_profile) {
// Name
// Name.
$name = '';
// Agents
// Agents.
$agent_view = 0;
$agent_edit = 0;
$agent_disable = 0;
// Alerts
// Alerts.
$alert_edit = 0;
$alert_management = 0;
// Users
// Users.
$user_management = 0;
// DB
// DB.
$db_management = 0;
// Pandora
// Pandora.
$pandora_management = 0;
// Events
// Events.
$event_view = 0;
$event_edit = 0;
$event_management = 0;
// Reports
// Reports.
$report_view = 0;
$report_edit = 0;
$report_management = 0;
// Network maps
// Network maps.
$map_view = 0;
$map_edit = 0;
$map_management = 0;
// Visual console
// Visual console.
$vconsole_view = 0;
$vconsole_edit = 0;
$vconsole_management = 0;
@ -145,43 +156,43 @@ if ($id_profile || $new_profile) {
exit;
}
// Name
// Name.
$name = $profile['name'];
// Agents
// Agents.
$agent_view = (bool) $profile['agent_view'];
$agent_edit = (bool) $profile['agent_edit'];
$agent_disable = (bool) $profile['agent_disable'];
// Alerts
// Alerts.
$alert_edit = (bool) $profile['alert_edit'];
$alert_management = (bool) $profile['alert_management'];
// Users
// Users.
$user_management = (bool) $profile['user_management'];
// DB
// DB.
$db_management = (bool) $profile['db_management'];
// Pandora
// Pandora.
$pandora_management = (bool) $profile['pandora_management'];
// Events
// Events.
$event_view = (bool) $profile['event_view'];
$event_edit = (bool) $profile['event_edit'];
$event_management = (bool) $profile['event_management'];
// Reports
// Reports.
$report_view = (bool) $profile['report_view'];
$report_edit = (bool) $profile['report_edit'];
$report_management = (bool) $profile['report_management'];
// Network maps
// Network maps.
$map_view = (bool) $profile['map_view'];
$map_edit = (bool) $profile['map_edit'];
$map_management = (bool) $profile['map_management'];
// Visual console
// Visual console.
$vconsole_view = (bool) $profile['vconsole_view'];
$vconsole_edit = (bool) $profile['vconsole_edit'];
$vconsole_management = (bool) $profile['vconsole_management'];
@ -249,14 +260,14 @@ if ($id_profile || $new_profile) {
$table->style[0] = 'font-weight: bold';
$table->data = [];
// Name
// Name.
$row = [];
$row['name'] = __('Profile name');
$row['input'] = html_print_input_text('name', $name, '', 30, 60, true);
$table->data['name'] = $row;
$table->data[] = '<hr>';
// Agents
// Agents.
$row = [];
$row['name'] = __('View agents');
$row['input'] = html_print_checkbox('agent_view', 1, $agent_view, true);
@ -271,7 +282,7 @@ if ($id_profile || $new_profile) {
$table->data['AW'] = $row;
$table->data[] = '<hr>';
// Alerts
// Alerts.
$row = [];
$row['name'] = __('Edit alerts');
$row['input'] = html_print_checkbox('alert_edit', 1, $alert_edit, true);
@ -282,7 +293,7 @@ if ($id_profile || $new_profile) {
$table->data['LM'] = $row;
$table->data[] = '<hr>';
// Events
// Events.
$row = [];
$row['name'] = __('View events');
$row['input'] = html_print_checkbox('event_view', 1, $event_view, true);
@ -297,7 +308,7 @@ if ($id_profile || $new_profile) {
$table->data['EM'] = $row;
$table->data[] = '<hr>';
// Reports
// Reports.
$row = [];
$row['name'] = __('View reports');
$row['input'] = html_print_checkbox('report_view', 1, $report_view, true);
@ -312,7 +323,7 @@ if ($id_profile || $new_profile) {
$table->data['RM'] = $row;
$table->data[] = '<hr>';
// Network maps
// Network maps.
$row = [];
$row['name'] = __('View network maps');
$row['input'] = html_print_checkbox('map_view', 1, $map_view, true);
@ -327,7 +338,7 @@ if ($id_profile || $new_profile) {
$table->data['MM'] = $row;
$table->data[] = '<hr>';
// Visual console
// Visual console.
$row = [];
$row['name'] = __('View visual console');
$row['input'] = html_print_checkbox('vconsole_view', 1, $vconsole_view, true);
@ -347,36 +358,36 @@ if ($id_profile || $new_profile) {
$disable_option = '';
}
// NCM
// NCM.
$row = [];
$row['name'] = __('View NCM data');
$row['input'] = html_print_checkbox('network_config_view', 1, $network_config_view, true);
$table->data['VR'] = $row;
$table->data['NR'] = $row;
$row = [];
$row['name'] = __('Operate NCM');
$row['input'] = html_print_checkbox('network_config_edit', 1, $network_config_edit, true, false, 'autoclick_profile_users(\'network_config_edit\', \'network_config_view\', \'false\')');
$table->data['VW'] = $row;
$table->data['NW'] = $row;
$row = [];
$row['name'] = __('Manage NCM');
$row['input'] = html_print_checkbox('network_config_management', 1, $network_config_management, true, false, 'autoclick_profile_users(\'network_config_management\', \'network_config_view\', \'network_config_edit\')');
$table->data['VM'] = $row;
$table->data['NM'] = $row;
$table->data[] = '<hr>';
// Users
// Users.
$row = [];
$row['name'] = __('Manage users');
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true, false, $disable_option);
$table->data['UM'] = $row;
$table->data[] = '<hr>';
// DB
// DB.
$row = [];
$row['name'] = __('Manage database');
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true, false, $disable_option);
$table->data['DM'] = $row;
$table->data[] = '<hr>';
// Pandora
// Pandora.
$row = [];
$row['name'] = __('%s management', get_product_name());
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true, false, $disable_option);

View File

@ -140,7 +140,9 @@ if (is_ajax()) {
$has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2);
if ($has_profile == false) {
$user_is_global_admin = users_is_admin($id2);
if ($has_profile === false && $user_is_global_admin === false) {
$result = delete_user($id2);
if ($result) {
@ -1544,6 +1546,7 @@ $(document).ready (function () {
var img_delete = '<?php echo $delete_image; ?>';
var id_user = '<?php echo io_safe_output($id); ?>';
var is_metaconsole = '<?php echo $meta; ?>';
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
var data = [];
$('input:image[name="add"]').click(function (e) {
@ -1588,7 +1591,7 @@ $(document).ready (function () {
$('input:image[name="del"]').click(function (e) {
e.preventDefault();
var rows = $("#table_profiles tr").length;
if ((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) {
if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') {
if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
return;
}
@ -1610,8 +1613,11 @@ $(document).ready (function () {
success: function (data) {
row.remove();
var rows = $("#table_profiles tr").length;
if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1') {
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
} else if (is_metaconsole === '1' && rows <= 3 && user_is_global_admin !== '1') {
window.location.replace("<?php echo ui_get_full_url('index.php?sec=advanced&sec2=advanced/users_setup', false, false, true); ?>");
}
}
});
@ -1750,7 +1756,6 @@ function show_double_auth_info () {
var $dialogContainer = $("div#dialog-double_auth-container");
$dialogContainer.html($loadingSpinner);
console.log(userID);
// Load the info page
var request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
@ -1915,7 +1920,6 @@ function show_double_auth_deactivation () {
},
success: function(data, textStatus, xhr) {
console.log(data);
if (data === -1) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Authentication error').'</div></b>'; ?>");
}

View File

@ -1612,6 +1612,7 @@ if ($get_extended_event) {
data : {
page: "include/ajax/events",
get_comments: 1,
meta: '.(int) is_metaconsole().',
event: '.json_encode($event).',
},
dataType : "html",

View File

@ -41,6 +41,8 @@ if ($get_sec_pages) {
$pages = menu_get_sec_pages($sec, $menu_hash);
}
$pages = menu_pepare_acl_select_data($pages, $sec);
echo json_encode($pages);
return;
}

View File

@ -218,6 +218,11 @@ function process_user_login_remote($login, $pass, $api=false)
switch ($config['auth']) {
// LDAP
case 'ldap':
// Use local authentication if user is global admin.
if (is_user_admin($login) === true) {
return false;
}
$sr = ldap_process_user_login($login, $pass);
if (!$sr) {
@ -227,6 +232,11 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory
case 'ad':
// Use local authentication if user is global admin.
if (is_user_admin($login) === true) {
return false;
}
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
@ -780,7 +790,7 @@ function ldap_process_user_login($login, $password)
io_safe_output($config['ldap_base_dn']),
$config['ldap_login_attr'],
io_safe_output($config['ldap_admin_login']),
io_safe_output($config['ldap_admin_pass']),
io_output_password($config['ldap_admin_pass']),
io_safe_output($login)
);
@ -804,7 +814,7 @@ function ldap_process_user_login($login, $password)
} else {
// PHP LDAP function
if ($config['ldap_admin_login'] != '' && $config['ldap_admin_pass'] != '') {
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) {
if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), io_output_password($config['ldap_admin_pass']))) {
$config['auth_error'] = 'Admin ldap connection fail';
@ldap_close($ds);
return false;

View File

@ -2423,17 +2423,20 @@ class AgentWizard extends HTML
}
// Get current value.
if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE
|| in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
if (isset($moduleData['value']) === true) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
}
// It unit of measure have data, attach to current value.
@ -2593,17 +2596,20 @@ class AgentWizard extends HTML
// Get current value.
$currentValue = '';
if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE
|| in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
if (isset($moduleData['value']) === true) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
}
// Format current value with thousands and decimals.
@ -3461,7 +3467,7 @@ class AgentWizard extends HTML
} else {
preg_match('/\.\d+$/', $key, $index);
$tmp = explode(': ', $oid_unit);
$output[$index[0]] = ($tmp[1] ?? '');
$output[$index[0]] = str_replace('"', '', ($tmp[1] ?? ''));
}
}
}

View File

@ -133,7 +133,9 @@ class AgentsAlerts extends HTML
// Refresh rate.
$this->refreshSelectedRate = (string) get_parameter('refresh-rate', '30');
// Show Modules without alerts table.
$this->showWithoutAlertModules = isset($_POST['show-modules-without-alerts']);
$this->showWithoutAlertModules = (isset($_POST['show-modules-without-alerts']))
? true
: isset($_GET['show-modules-without-alerts']);
// Selected group.
$this->groupId = (int) get_parameter('group-id', 0);
// Create alert token.
@ -200,6 +202,8 @@ class AgentsAlerts extends HTML
*/
private function createAlertTable()
{
global $config;
$table = new stdClass();
if ($this->groupId > 0) {
@ -219,7 +223,7 @@ class AgentsAlerts extends HTML
$sql = 'SELECT tagente.alias, tagente_modulo.nombre,
tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules) '.$grupo.' LIMIT 20 OFFSET '.$offset_modules;
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules) '.$grupo.' LIMIT '.$config['block_size'].' OFFSET '.$offset_modules;
$agent_modules = db_get_all_rows_sql($sql);
@ -227,7 +231,7 @@ class AgentsAlerts extends HTML
$count_agent_module[0]['COUNT(tagente_modulo.nombre)'],
ui_get_url_refresh(),
0,
0,
false,
false,
'offset',
true,
@ -831,6 +835,7 @@ class AgentsAlerts extends HTML
'arguments' => [
'type' => 'button',
'return' => true,
'label' => '',
'name' => 'pure',
'attributes' => 'class="full_screen_button '.$screenSwitchClass.'" title="'.$screenSwitchTitle.'"',
],

File diff suppressed because it is too large Load Diff

View File

@ -52,6 +52,12 @@ class ConsoleSupervisor
*/
public const MIN_PERFORMANCE_MODULES = 100;
/**
* Minimum queued elements in synchronization queue to be warned..
*/
public const MIN_SYNC_QUEUE_LENGTH = 200;
/**
* Show if console supervisor is enabled or not.
*
@ -242,6 +248,16 @@ class ConsoleSupervisor
$this->checkAuditLogOldLocation();
/*
* Checks if sync queue is longer than limits.
* NOTIF.SYNCQUEUE.LENGTH
*/
if (is_metaconsole() === true) {
$this->checkSyncQueueLength();
$this->checkSyncQueueStatus();
}
}
@ -492,6 +508,16 @@ class ConsoleSupervisor
*/
$this->checkAuditLogOldLocation();
/*
* Checks if sync queue is longer than limits.
* NOTIF.SYNCQUEUE.LENGTH
*/
if (is_metaconsole() === true) {
$this->checkSyncQueueLength();
$this->checkSyncQueueStatus();
}
}
@ -2684,4 +2710,117 @@ class ConsoleSupervisor
}
/**
* Verifies the status of synchronization queue and warns if something is
* not working as expected.
*
* @return void
*/
public function checkSyncQueueLength()
{
global $config;
if (is_metaconsole() !== true) {
return;
}
$sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer();
$counts = $sync->getQueues(true);
if (count($counts) === 0) {
// Clean all.
$this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.%');
}
$items_min = $config['sync_queue_items_max'];
if (is_numeric($items_min) !== true && $items_min <= 0) {
$items_min = self::MIN_SYNC_QUEUE_LENGTH;
}
foreach ($counts as $node_id => $count) {
if ($count < $items_min) {
$this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.'.$node_id);
} else {
try {
$node = new PandoraFMS\Enterprise\Metaconsole\Node($node_id);
$url = '__url__/index.php?sec=advanced&sec2=advanced/metasetup&tab=consoles';
$this->notify(
[
'type' => 'NOTIF.SYNCQUEUE.LENGTH.'.$node_id,
'title' => __('Node %s sync queue length exceeded, ', $node->server_name()),
'message' => __(
'Synchronization queue lenght for node %s is %d items, this value should be 0 or lower than %d, please check the queue status.',
$node->server_name(),
$count,
$items_min
),
'url' => $url,
]
);
} catch (\Exception $e) {
// Clean, exception in node finding.
$this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.'.$node_id);
}
}
}
}
/**
* Verifies the status of synchronization queue and warns if something is
* not working as expected.
*
* @return void
*/
public function checkSyncQueueStatus()
{
if (is_metaconsole() !== true) {
return;
}
$sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer();
$queues = $sync->getQueues();
if (count($queues) === 0) {
// Clean all.
$this->cleanNotifications('NOTIF.SYNCQUEUE.STATUS.%');
}
foreach ($queues as $node_id => $queue) {
if (count($queue) === 0) {
$this->cleanNotifications('NOTIF.SYNCQUEUE.STATUS.'.$node_id);
continue;
}
$item = $queue[0];
if (empty($item->error()) === false) {
try {
$node = new PandoraFMS\Enterprise\Metaconsole\Node($node_id);
$url = '__url__/index.php?sec=advanced&sec2=advanced/metasetup&tab=consoles';
$this->notify(
[
'type' => 'NOTIF.SYNCQUEUE.STATUS.'.$node_id,
'title' => __('Node %s sync queue failed, ', $node->server_name()),
'message' => __(
'Node %s cannot process synchronization queue due %s, please check the queue status.',
$node->server_name(),
$item->error()
),
'url' => $url,
]
);
} catch (\Exception $e) {
// Clean, exception in node finding.
$this->cleanNotifications('NOTIF.SYNCQUEUE.STATUS.'.$node_id);
}
}
}
}
}

View File

@ -600,7 +600,7 @@ class Tree
if (is_metaconsole()) {
$module['serverID'] = $this->serverID;
$module['serverName'] = $this->serverName;
$module['serverName'] = empty($this->serverName) === false ? $this->serverName : servers_get_name($this->serverID);
} else {
$module['serverName'] = false;
$module['serverID'] = false;
@ -895,9 +895,15 @@ class Tree
protected function processAgents(&$agents, $server=false)
{
if (!empty($agents)) {
$agents_aux = [];
foreach ($agents as $iterator => $agent) {
$this->processAgent($agents[$iterator], $server);
if ($agents[$iterator]['counters']['total'] !== '0') {
$agents_aux[] = $agents[$iterator];
}
}
$agents = $agents_aux;
}
}
@ -950,10 +956,9 @@ class Tree
$module_status_inner = '';
$module_search_inner = '';
$module_search_filter = '';
if (!empty($this->filter['searchModule'])) {
$module_search_inner = '
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo';
$module_search_filter = "AND tam.disabled = 0

View File

@ -32,6 +32,8 @@ class TreeOS extends Tree
'tco.icon_name AS iconHTML',
];
$this->L1inner = 'INNER JOIN tconfig_os tco ON tco.id_os = x2.g';
$this->L1innerInside = 'INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente';
$this->L1orderByFinal = 'tco.name';
$this->L2condition = 'AND ta.id_os = '.$this->rootID;

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC211112';
$build_version = 'PC211122';
$pandora_version = 'v7.0NG.758';
// Do not overwrite default timezone set if defined.

View File

@ -679,7 +679,7 @@ function agents_get_agents(
// Add the group filter to
$where = db_format_array_where_clause_sql($filter, 'AND', '('.$where_secondary.') AND ');
if ($where == '' && $where_secondary != '') {
$where = $where_secondary;
$where = '('.$where_secondary.')';
}
$where_nogroup = db_format_array_where_clause_sql(
@ -1181,6 +1181,10 @@ function agents_get_group_agents(
}
}
if (isset($search['all_agents'])) {
unset($search['all_agents']);
}
if (isset($search['string']) === true) {
$string = io_safe_input($search['string']);
$filter[] = "(nombre COLLATE utf8_general_ci LIKE '%$string%' OR direccion LIKE '%$string%')";
@ -1283,7 +1287,7 @@ function agents_get_group_agents(
if (!$add_alert_bulk_op) {
// Add the rest of the filter from the search array.
foreach ($search as $key => $value) {
$filter[] = $value;
$filter[$key] = $value;
}
}
} else if ($filter !== true) {

View File

@ -2380,118 +2380,6 @@ function get_alert_last_fire_timestamp_in_period($id_alert_module, $period, $dat
}
/**
* Insert in talert_special_days a new special day.
*
* @param date of special day.
* @param same day of the week.
* @param mixed A single value or array of values to insert (can be a multiple a mount of rows).
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise.
*/
function alerts_create_alert_special_day($date, $same_day, $values=false)
{
if (empty($date)) {
return false;
}
if (empty($same_day)) {
return false;
}
if (! is_array($values)) {
$values = [];
}
global $config;
$date_db = '';
switch ($config['dbtype']) {
case 'mysql':
$date_db = 'date';
break;
case 'oracle':
$date_db = '"date"';
break;
}
$values[$date_db] = $date;
$values['same_day'] = $same_day;
return @db_process_sql_insert('talert_special_days', $values);
}
/**
* Update a special day in talert_special_days.
*
* @param int special day Id.
* @param mixed Array of values to update.
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function alerts_update_alert_special_day($id_special_day, $values)
{
$id_special_day = safe_int($id_special_day, 1);
if (empty($id_special_day)) {
return false;
}
if (! is_array($values)) {
return false;
}
return (@db_process_sql_update(
'talert_special_days',
$values,
['id' => $id_special_day]
)) !== false;
}
/**
* Delete a special day in talert_special_days.
*
* @param int special day Id.
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function alerts_delete_alert_special_day($id_special_day)
{
$id_special_day = safe_int($id_special_day, 1);
if (empty($id_special_day)) {
return false;
}
return (@db_process_sql_delete(
'talert_special_days',
['id' => $id_special_day]
)) !== false;
}
/**
* Get a special day in talert_special_days.
*
* @param int special day Id.
*
* @return mixed False in case of error or invalid values passed. All row of the selected command otherwise
*/
function alerts_get_alert_special_day($id_special_day)
{
$id_special_day = safe_int($id_special_day, 1);
if (empty($id_special_day)) {
return false;
}
return db_get_row('talert_special_days', 'id', $id_special_day);
}
/**
* Get number of alert fired that an action is executed. Only fot non default alerts
*

View File

@ -55,6 +55,7 @@ enterprise_include_once('include/functions_alerts.php');
// Clases.
use PandoraFMS\Module;
use PandoraFMS\Enterprise\Cluster;
use PandoraFMS\SpecialDay;
/**
@ -14131,7 +14132,7 @@ function api_get_special_days($thrash1, $thrash2, $other, $thrash3)
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <special_day>;<same_day>;<description>;<id_group>; in this order
* @param array $other it's array, $other as param is <special_day>;<day_code>;<description>;<id_group>; in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
*
@ -14150,6 +14151,7 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3)
$same_day = $other['data'][1];
$description = $other['data'][2];
$idGroup = $other['data'][3];
$calendar_name = (isset($other['data'][4]) === true) ? $other['data'][4] : 'Default';
if (!check_acl($config['id_user'], $idGroup, 'LM', true)) {
returnError('forbidden', 'string');
@ -14186,17 +14188,51 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3)
}
}
$values = [
'description' => $other['data'][2],
'id_group' => $other['data'][3],
$weekdays = [
'monday' => 1,
'tuesday' => 2,
'wednesday' => 3,
'thursday' => 4,
'friday' => 5,
'saturday' => 6,
'sunday' => 7,
'holiday' => 8,
];
$idSpecialDay = alerts_create_alert_special_day($special_day, $same_day, $values);
$day_code = (isset($weekdays[$same_day]) === true) ? $weekdays[$same_day] : 0;
if (is_error($idSpecialDay)) {
returnError('Special Day could not be created');
} else {
returnData('string', ['type' => 'string', 'data' => $idSpecialDay]);
if ($day_code === 0) {
returnError('Special Day could not be created. Same day doesn\'t exists.');
return;
}
$id_calendar = db_get_value_sql(
sprintf(
'SELECT id FROM talert_calendar WHERE name="%s"',
$calendar_name
)
);
if ($id_calendar === false) {
returnError('Special Day could not be created. Calendar doesn\'t exists.');
return;
}
try {
$sd = new SpecialDay();
$sd->date($special_day);
$sd->id_group($idGroup);
$sd->day_code($day_code);
$sd->description($description);
$sd->id_calendar($id_calendar);
$sd->save();
if ($sd->save() === true) {
returnData('string', ['type' => 'string', 'data' => $sd->id()]);
} else {
returnError('Special Day could not be created');
}
} catch (Exception $e) {
returnData('string', ['type' => 'string', 'data' => $e]);
}
}
@ -14693,7 +14729,7 @@ function api_set_recreate_service_modules($id, $id_agent)
*
* @param string $id Id of the special day to update.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <special_day>;<same_day>;<description>;<id_group>; in this order
* @param array $other it's array, $other as param is <special_day>;<day_code>;<description>;<id_group>; in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
*
@ -14709,9 +14745,10 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
}
$special_day = $other['data'][0];
$same_day = $other['data'][1];
$day_code = $other['data'][1];
$description = $other['data'][2];
$idGroup = $other['data'][3];
$id_calendar = $other['data'][4];
if (!check_acl($config['id_user'], $idGroup, 'LM', true)) {
returnError('forbidden', 'string');
@ -14742,24 +14779,22 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
return;
}
$return = db_process_sql_update(
'talert_special_days',
[
'date' => $special_day,
'same_day' => $same_day,
'description' => $description,
'id_group' => $idGroup,
],
['id' => $id_special_day]
);
returnData(
'string',
[
'type' => 'string',
'data' => (int) ((bool) $return),
]
);
try {
$sd = new SpecialDay();
$sd->date($special_day);
$sd->id_group($idGroup);
$sd->day_code($day_code);
$sd->description($description);
$sd->id_calendar($id_calendar);
$sd->save();
if ($sd->save() === true) {
returnError('Special Day could not be updated');
} else {
returnData('string', ['type' => 'string', 'data' => $sd->id()]);
}
} catch (Exception $e) {
returnData('string', ['type' => 'string', 'data' => $e]);
}
}
@ -14805,13 +14840,20 @@ function api_set_delete_special_day($id_special_day, $thrash2, $thrash3, $thrash
return;
}
$return = alerts_delete_alert_special_day($id_special_day);
try {
$specialDay = new SpecialDay($id_special_day);
} catch (\Exception $e) {
if ($id > 0) {
returnError('The Special Day could not be deleted.');
}
if (is_error($return)) {
returnError('The Special Day could not be deleted.');
} else {
returnData('string', ['type' => 'string', 'data' => $return]);
return;
}
// Remove.
$specialDay->delete();
$return = 'success';
returnData('string', ['type' => 'string', 'data' => $return]);
}

View File

@ -620,7 +620,7 @@ function config_update_config()
$error_update[] = __('Admin LDAP login');
}
if (!config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'))) {
if (!config_update_value('ldap_admin_pass', io_input_password(io_safe_output(get_parameter('ldap_admin_pass'))))) {
$error_update[] = __('Admin LDAP password');
}

View File

@ -4891,7 +4891,8 @@ function events_page_general($event)
$data = [];
$data[0] = __('Event ID');
$data[1] = '#'.$event['id_evento'];
$table_event_id = (isset($event['max_id_evento']) === true) ? $event['max_id_evento'] : $event['id_evento'];
$data[1] = '#'.$table_event_id;
$table_general->data[] = $data;
$data = [];

View File

@ -2050,7 +2050,7 @@ function graphic_combined_module(
$width,
$height,
$color,
$module_name_list,
[],
$long_index,
ui_get_full_url(
'images/image_problem_area_small.png',

View File

@ -728,7 +728,8 @@ function html_print_select(
$simple_multiple_options=false,
$required=false,
$truncate_size=false,
$select2_enable=true
$select2_enable=true,
$multiple_select2=false
) {
$output = "\n";
@ -900,7 +901,8 @@ function html_print_select(
$select2 = 'select2_dark.min';
}
if ($multiple === false && $select2_enable === true) {
// Note that multiple_select2 is introduced as a workaround to overcome the pointless limitation of preventing "multiple" select inputs from using select2 library without affecting the existing calls to this function.
if ($multiple === false && $select2_enable === true || $multiple_select2 === true) {
if (is_ajax()) {
$output .= '<script src="';
$output .= ui_get_full_url(
@ -4030,15 +4032,19 @@ function html_print_input_file($name, $return=false, $options=false)
if ($options) {
if (isset($options['size'])) {
$output .= 'size="'.$options['size'].'"';
$output .= ' size="'.$options['size'].'"';
}
if (isset($options['disabled'])) {
$output .= 'disabled="disabled"';
$output .= ' disabled="disabled"';
}
if (isset($options['class'])) {
$output .= 'class="'.$options['class'].'"';
$output .= ' class="'.$options['class'].'"';
}
if (isset($options['required'])) {
$output .= ' required';
}
}

View File

@ -454,3 +454,46 @@ function get_tickets_integriaims($tickets_filters)
return $array_get_incidents;
}
function integriaims_upload_file($filename, $incident_id, $file_description)
{
if ($_FILES[$filename]['name'] != '') {
$filename = io_safe_input($_FILES[$filename]['name']);
$filesize = io_safe_input($_FILES[$filename]['size']);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$invalid_extensions = '/^(bat|exe|cmd|sh|php|php1|php2|php3|php4|php5|pl|cgi|386|dll|com|torrent|js|app|jar|iso|
pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|
htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh)$/i';
if (!preg_match($invalid_extensions, $extension)) {
// The following is if you have clamavlib installed.
// (php5-clamavlib) and enabled in php.ini
// http://www.howtoforge.com/scan_viruses_with_php_clamavlib
if (extension_loaded('clamav')) {
cl_setlimits(5, 1000, 200, 0, 10485760);
$malware = cl_scanfile($_FILES['file']['tmp_name']);
if ($malware) {
$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
die($error);
}
}
$filecontent = base64_encode(file_get_contents($_FILES[$filename]['tmp_name']));
$result_api_call = integria_api_call(null, null, null, null, 'attach_file', [$incident_id, $filename, $filesize, $file_description, $filecontent], false, '', '|;|');
// API method returns '0' string if success.
$file_added = ($result_api_call === '0') ? true : false;
ui_print_result_message(
$file_added,
__('File successfully added'),
__('File could not be added')
);
} else {
ui_print_error_message(__('File has an invalid extension'));
}
}
}

View File

@ -483,24 +483,16 @@ function menu_add_extras(&$menu)
$menu_extra['gusuarios']['sub']['godmode/users/configure_user']['text'] = __('Configure user');
$menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile');
$menu_extra['gservers']['sub']['godmode/servers/manage_recontask_form']['text'] = __('Manage recontask');
$menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management');
$menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
$menu_extra['gmodules']['sub']['godmode/tag/edit_tag']['text'] = __('Tags management');
$menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management');
$menu_extra['estado']['sub']['operation/agentes/ver_agente']['text'] = __('View agent');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_template']['text'] = __('Configure alert template');
$menu_extra['network']['sub']['operation/agentes/networkmap']['text'] = __('Manage network map');
$menu_extra['network']['sub']['operation/visual_console/render_view']['text'] = __('View visual console');
$menu_extra['network']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Builder visual console');
$menu_extra['eventos']['sub']['godmode/events/events']['text'] = __('Administration events');
$menu_extra['reporting']['sub']['operation/reporting/reporting_viewer']['text'] = __('View reporting');
$menu_extra['reporting']['sub']['operation/reporting/graph_viewer']['text'] = __('Graph viewer');
@ -516,7 +508,6 @@ function menu_add_extras(&$menu)
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
}
$menu_extra['workspace']['sub']['operation/incidents/incident_statistics']['text'] = __('Incidents statistics');
$menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages');
$menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups');
@ -525,14 +516,9 @@ function menu_add_extras(&$menu)
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands');
$menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_correlation']['text'] = __('Manage event alerts');
$menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets');
$menu_extra['estado']['sub']['enterprise/godmode/services/manage_services']['text'] = __('Manage services');
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
$menu_extra['estado']['sub']['enterprise/godmode/snmpconsole/snmp_trap_editor']['text'] = __('SNMP trap editor');
$menu_extra['estado']['sub']['snmpconsole']['sub2']['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
$menu_extra['estado']['sub']['snmpconsole']['sub2']['operation/snmpconsole/snmp_view']['text'] = __('SNMP console');
@ -588,6 +574,10 @@ function menu_get_sec($with_categories=false)
}
}
if ($k === 'discovery') {
$in_godmode = true;
}
if ($in_godmode) {
$category = __('Administration');
} else {
@ -658,13 +648,11 @@ function menu_get_sec_pages($sec, $menu_hash=false)
foreach ($menu[$sec]['sub'] as $k => $v) {
// Avoid special cases of standalone windows.
if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) {
continue;
if ($sec !== 'links') {
continue;
}
}
// If this value has various parameters, we only get the first.
$k = explode('&', $k);
$k = $k[0];
$sec2_array[$k] = $v['text'];
}
}
@ -695,6 +683,7 @@ function menu_get_sec2_pages($sec, $sec2, $menu_hash=false)
}
$sec3_array = [];
$sec2 = io_safe_output($sec2);
if (isset($menu[$sec]['sub']) && isset($menu[$sec]['sub'][$sec2]['sub2'])) {
// Get the sec2 of the subsections.
@ -719,10 +708,6 @@ function menu_sec2_in_sec($sec, $sec2)
{
$sec2_array = menu_get_sec_pages($sec);
// If this value has various parameters, we only get the first.
$sec2 = explode('&', $sec2);
$sec2 = $sec2[0];
if ($sec2_array != null && in_array($sec2, array_keys($sec2_array))) {
return true;
}
@ -735,13 +720,47 @@ function menu_sec3_in_sec2($sec, $sec2, $sec3)
{
$sec3_array = menu_get_sec2_pages($sec, $sec2, $menu_hash = false);
// If this value has various parameters, we only get the first.
$sec3 = explode('&', $sec3);
$sec3 = $sec3[0];
if ($sec3_array != null && in_array($sec3, array_keys($sec3_array))) {
return true;
}
return false;
}
/**
* Prepare menu data for enterprise acl conf.
*
* @param array $pages
* @param string $sec
* @return string $pages
*/
function menu_pepare_acl_select_data($pages, $sec)
{
$exclude_pages = [
'estado' => 'operation/agentes/tactical',
'network' => 'operation/agentes/networkmap_list',
'extensions' => [
'operation/extensions',
'enterprise/extensions/vmware',
'extensions/users_connected',
],
'gmodules' => 'godmode/modules/manage_network_templates',
'geventos' => 'godmode/events/events&amp;section=filter',
'gsetup' => 'godmode/setup/setup&section=general',
];
foreach ($exclude_pages as $exclude_sec => $sec2) {
if ($sec === $exclude_sec) {
if (is_array($sec2) === true) {
foreach ($sec2 as $value) {
unset($pages[$value]);
}
}
unset($pages[$sec2]);
}
}
return $pages;
}

View File

@ -8700,8 +8700,8 @@ function reporting_increment($report, $content)
$return['data']['message'] = __('The monitor have no data in this range of dates or monitor type is not numeric');
$return['data']['error'] = true;
} else if (is_numeric($old_data) && is_numeric($last_data)) {
$return['data']['old'] = $old_data;
$return['data']['now'] = $last_data;
$return['data']['old'] = round(floatval($old_data), $config['graph_precision']);
$return['data']['now'] = round(floatval($last_data), $config['graph_precision']);
$increment = ($old_data - $last_data);
if ($increment < 0) {
@ -10813,11 +10813,11 @@ function reporting_get_stats_agents_monitors($data)
if ($mobile) {
$urls = [];
$urls['total_agents'] = 'index.php?page=agents';
$urls['monitor_checks'] = 'index.php?page=modules';
$urls['monitor_total'] = 'index.php?page=modules';
} else {
$urls = [];
$urls['total_agents'] = $config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60';
$urls['monitor_checks'] = $config['homeurl'].'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1';
$urls['monitor_total'] = $config['homeurl'].'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1';
}
// Agents and modules table
@ -10839,8 +10839,8 @@ function reporting_get_stats_agents_monitors($data)
}
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true);
$tdata[4] = $data['monitor_checks'] <= 0 ? '-' : $data['monitor_checks'];
$tdata[4] = '<a class="big_data" href="'.$urls['monitor_checks'].'">'.$tdata[4].'</a>';
$tdata[4] = $data['monitor_total'] <= 0 ? '-' : $data['monitor_total'];
$tdata[4] = '<a class="big_data" href="'.$urls['monitor_total'].'">'.$tdata[4].'</a>';
/*
Hello there! :)
@ -10848,7 +10848,7 @@ function reporting_get_stats_agents_monitors($data)
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/
if ($data['total_agents']) {
if (($data['monitor_checks'] / $data['total_agents'] > 100) && !enterprise_installed()) {
if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) {
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
}
@ -13669,7 +13669,7 @@ function reporting_label_macro($item, $label)
if (preg_match('/_agentgroup_/', $label)) {
$label = str_replace(
'_agentgroup_',
$item['agent_group'],
groups_get_name($item['agent_group']),
$label
);
}

View File

@ -177,13 +177,8 @@ function servers_get_performance()
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente.id_agente = tagente_estado.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_modulo <> 0
AND delete_pending = 0
AND (utimestamp > 0
OR (id_tipo_modulo = 100
OR (id_tipo_modulo > 21
AND id_tipo_modulo < 23)
)
)
AND tagente.disabled = 0
GROUP BY tagente_modulo.id_modulo'
);

View File

@ -105,64 +105,119 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
if (is_metaconsole() && !empty($list_groups)) {
$cache_table = 'tmetaconsole_agent';
$sql_stats = "SELECT id_grupo, COUNT(id_agente) AS agents_total,
SUM(total_count) AS monitors_total,
SUM(normal_count) AS monitors_ok,
SUM(warning_count) AS monitors_warning,
SUM(critical_count) AS monitors_critical,
SUM(unknown_count) AS monitors_unknown,
SUM(notinit_count) AS monitors_not_init,
SUM(fired_count) AS alerts_fired
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
GROUP BY id_grupo";
if (users_is_admin() === false) {
$user_groups_ids_array = explode(',', $user_groups_ids);
$user_group_children_ids = [];
foreach ($user_groups_ids_array as $user_group_id) {
$group_children_ids = groups_get_children_ids($user_group_id);
$user_group_children_ids = array_merge($user_group_children_ids, $group_children_ids);
}
$user_groups_ids = implode(',', array_unique($user_group_children_ids));
}
$sql_stats = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_total,
SUM(tma.total_count) AS monitors_total,
SUM(tma.normal_count) AS monitors_ok,
SUM(tma.warning_count) AS monitors_warning,
SUM(tma.critical_count) AS monitors_critical,
SUM(tma.unknown_count) AS monitors_unknown,
SUM(tma.notinit_count) AS monitors_not_init,
SUM(tma.fired_count) AS alerts_fired
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND tma.id_grupo IN (%s) OR tmasg.id_group IN (%s)
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats = db_get_all_rows_sql($sql_stats);
$sql_stats_unknown = "SELECT id_grupo, COUNT(id_agente) AS agents_unknown
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count > 0
GROUP BY id_grupo";
$sql_stats_unknown = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_unknown
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
AND tma.critical_count = 0
AND tma.warning_count = 0
AND tma.unknown_count > 0
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats_unknown = db_get_all_rows_sql($sql_stats_unknown);
$sql_stats_not_init = "SELECT id_grupo, COUNT(id_agente) AS agents_not_init
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND (total_count = 0 OR total_count = notinit_count)
GROUP BY id_grupo";
$sql_stats_not_init = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_not_init
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
AND (tma.total_count = 0 OR tma.total_count = tma.notinit_count)
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats_not_init = db_get_all_rows_sql($sql_stats_not_init);
$sql_stats_ok = "SELECT id_grupo, COUNT(id_agente) AS agents_ok
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0
GROUP BY id_grupo";
$sql_stats_ok = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_ok
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
AND tma.critical_count = 0
AND tma.warning_count = 0
AND tma.unknown_count = 0
AND tma.normal_count > 0
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats_ok = db_get_all_rows_sql($sql_stats_ok);
$sql_stats_warning = "SELECT id_grupo, COUNT(id_agente) AS agents_warning
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count = 0
AND warning_count > 0
GROUP BY id_grupo";
$sql_stats_warning = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_warning
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
AND tma.critical_count = 0
AND tma.warning_count > 0
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats_warning = db_get_all_rows_sql($sql_stats_warning);
$sql_stats_critical = "SELECT id_grupo, COUNT(id_agente) AS agents_critical
FROM $cache_table
WHERE disabled = 0
AND id_grupo IN ($user_groups_ids)
AND critical_count > 0
GROUP BY id_grupo";
$sql_stats_critical = sprintf(
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_critical
FROM tmetaconsole_agent tma
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
ON tma.id_agente = tmasg.id_agent
WHERE tma.disabled = 0
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
AND tma.critical_count > 0
GROUP BY tma.id_grupo',
$user_groups_ids,
$user_groups_ids
);
$data_stats_critical = db_get_all_rows_sql($sql_stats_critical);
if (!empty($data_stats)) {
@ -292,7 +347,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$list['_total_agents_'] = $total_agentes[0]['total_agents'];
$list['_monitor_alerts_fire_count_'] = $group_stat[0]['alerts_fired'];
$list['_monitors_alerts_'] = tactical_monitor_alerts(explode(',', $user_groups_ids), $user_strict, explode(',', $user_groups_ids));
$list['_monitors_alerts_'] = tactical_monitor_alerts($user_strict);
// Get total count of monitors for this group, except disabled.
$list['_monitor_checks_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
@ -332,7 +387,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$list['_server_sanity_'] = format_numeric((100 - $list['_module_sanity_']), 1);
} else {
if (users_is_admin()) {
if (users_is_admin() || users_can_manage_group_all()) {
$result_list = db_get_all_rows_sql(
sprintf(
'SELECT COUNT(*) as contado, estado FROM tagente_estado tae
@ -411,12 +466,14 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
}
$list['_monitors_alerts_fired_'] = tactical_monitor_fired_alerts(explode(',', $user_groups_ids), $user_strict, explode(',', $user_groups_ids));
$list['_monitors_alerts_'] = tactical_monitor_alerts(explode(',', $user_groups_ids), $user_strict, explode(',', $user_groups_ids));
$list['_monitors_alerts_'] = tactical_monitor_alerts($user_strict);
$total_agentes = agents_get_agents(false, ['count(DISTINCT id_agente) as total_agents'], 'AR', false, false, 1);
$list['_total_agents_'] = $total_agentes[0]['total_agents'];
$list['_monitor_checks_'] = ($list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
$list['_monitor_checks_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
$list['_monitor_total_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
// Calculate not_normal monitors
$list['_monitor_not_normal_'] = ($list['_monitor_checks_'] - $list['_monitors_ok_']);
@ -442,42 +499,33 @@ function tactical_status_modules_agents($id_user=false, $user_strict=false, $acc
}
function tactical_monitor_alerts($group_array, $strict_user=false, $id_group_strict=false)
function tactical_monitor_alerts($strict_user=false)
{
// If there are not groups to query, we jump to nextone
if (empty($group_array)) {
return 0;
} else if (!is_array($group_array)) {
$group_array = [$group_array];
}
$groups = users_get_groups($config['id_user'], 'AR', false);
$id_groups = array_keys($groups);
$group_clause = implode(',', $group_array);
$group_clause = '('.$group_clause.')';
if ($strict_user) {
$group_clause_strict = implode(',', $id_group_strict);
$group_clause_strict = '('.$group_clause_strict.')';
$sql = "SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0 AND tagente_modulo.disabled = 0
AND talert_template_modules.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo";
$count = db_get_sql($sql);
return $count;
if (empty($id_groups)) {
$where_clause .= ' AND (1 = 0) ';
} else {
// TODO REVIEW ORACLE AND POSTGRES
return db_get_sql(
"SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0 AND tagente_modulo.disabled = 0
AND talert_template_modules.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo"
$where_clause .= sprintf(
' AND id_agent_module IN (
SELECT tam.id_agente_modulo
FROM tagente_modulo tam
WHERE tam.id_agente IN (SELECT ta.id_agente
FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON
ta.id_agente = tasg.id_agent
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)))) ',
implode(',', $id_groups),
implode(',', $id_groups)
);
}
$filter_alert = [];
$filter_alert['disabled'] = 'all_enabled';
$alert_count = get_group_alerts($id_groups, $filter_alert, false, $where_clause, false, false, false, true, $strict_user);
return $alert_count;
}

View File

@ -596,7 +596,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$hashdata = md5($hashdata);
$url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'].'&'.'loginhash=auto&'."loginhash_data=$hashdata&".'loginhash_user='.str_rot13($user);
if ($grants_on_node) {
if ($grants_on_node && (bool) $user_access_node !== false) {
$cellName .= '<a href="'.$url.'">'.'<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
} else {
$cellName .= '<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b>';

View File

@ -3591,19 +3591,87 @@ function ui_print_datatable(array $parameters)
// Order.
$err_msg = '<div id="error-'.$table_id.'"></div>';
$output = $err_msg.$filter.$extra.$table.$js;
if (is_ajax() === false) {
ui_require_css_file('datatables.min', 'include/styles/js/');
ui_require_css_file('tables');
if (is_metaconsole()) {
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
}
ui_require_css_file('datatables.min', 'include/styles/js/');
ui_require_css_file('tables');
if (is_metaconsole()) {
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
ui_require_javascript_file('datatables.min');
ui_require_javascript_file('buttons.dataTables.min');
ui_require_javascript_file('dataTables.buttons.min');
ui_require_javascript_file('buttons.html5.min');
ui_require_javascript_file('buttons.print.min');
} else {
// Load tables.css.
$output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url(
'include/styles/tables.css',
false,
false,
false
);
$output .= '"/>';
if (is_metaconsole() === true) {
// Load tables_meta.css.
$output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url(
ENTERPRISE_DIR.'/include/styles/tables_meta.css',
false,
false,
false
);
$output .= '"/>';
}
// Load datatables.js.
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/datatables.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
// Load buttons.dataTables.min.js.
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/buttons.dataTables.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
// Load dataTables.buttons.min.js.
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/dataTables.buttons.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
// Load buttons.html5.min.js.
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/buttons.html5.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
// Load buttons.print.min.js.
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/buttons.print.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
}
ui_require_javascript_file('datatables.min');
ui_require_javascript_file('buttons.dataTables.min');
ui_require_javascript_file('dataTables.buttons.min');
ui_require_javascript_file('buttons.html5.min');
ui_require_javascript_file('buttons.print.min');
if (isset($parameters['return']) && $parameters['return'] == true) {
// Compat.
$parameters['print'] = false;

View File

@ -225,14 +225,14 @@ function d3_bullet_chart(
.bullet .range.s2 { fill: #ccc; }
.bullet .measure.s0 { fill: steelblue; }
.bullet .measure.s1 { fill: steelblue; }
.bullet .title { font-size: 7pt; font-weight: bold; text-align:left; }
.bullet .title { font-size: 9pt; font-weight: bold; text-align:left; cursor: help;}
.bullet .subtitle { fill: #999; font-size: 7pt;}
.bullet g text { font-size:'.$font_size.'pt; '.$invert_color.' }
</style>
<script language="javascript" type="text/javascript">
var margin = {top: 5, right: 40, bottom: 20, left: 120};
var margin = {top: 5, right: 40, bottom: 20, left: 130};
var width = ('.$width.'+10);
var height = '.$height.'- margin.top - margin.bottom;
@ -251,13 +251,14 @@ function d3_bullet_chart(
$name = io_safe_output($data['nombre']);
}
$name = ui_print_truncate_text($name, 15, false, true, false, '...', false);
$long_name = $name;
$name = ui_print_truncate_text($name, 20, false, true, false, '...', false);
$marker = '';
if ($data['value'] == 0) {
$marker = ', 0';
}
$temp[] = '{"title":"'.$name.'","subtitle":"'.$data['unit'].'",
$temp[] = '{"longTitle":"'.$long_name.'", "title":"'.$name.'","subtitle":"'.$data['unit'].'",
"ranges":['.((float) $data['max']).'],"measures":['.$data['value'].'],
"markers":['.$data['min_warning'].','.$data['min_critical'].$marker.']}';
}
@ -276,12 +277,19 @@ function d3_bullet_chart(
.call(chart);
var title = svg.append("g")
.attr("width", "120px")
.style("text-anchor", "end")
.attr("transform", "translate(-10, 15)");
title.append("text")
.attr("class", "'.$font.' invert_filter")
.text(function(d) { return d.title; });
.attr("class", "title '.$font.' invert_filter")
.attr("textLength","120")
.attr("lengthAdjust", "spacingAndGlyphs")
.text(function(d) { return d.title; })
.append("title")
.text(function(d) { return d.longTitle; });
title.append("text")
.attr("class", "subtitle")

View File

@ -33,7 +33,7 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false
if ($mobile === true) {
$output .= '
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.js').'"></script>
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.mobile-1.3.1.js').'"></script>';
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.mobile-1.4.5.js').'"></script>';
}
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area

View File

@ -134,7 +134,8 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
$("input.module_types_excluded").each(function(index, el) {
var module_type = parseInt($(el).val());
if (module_type !== NaN) module_types_excluded.push(module_type);
if (isNaN(module_type) == false)
module_types_excluded.push(module_type);
});
} catch (error) {}
}

View File

@ -1,5 +1,4 @@
/* globals $ */
/* globals $ confirmDialog uniqId showMsg*/
function parse_alert_command(command, classs) {
if (classs == "recovery") {
classs = "fields_recovery";
@ -36,21 +35,64 @@ function parse_alert_command(command, classs) {
return command;
}
// eslint-disable-next-line no-unused-vars
function render_command_preview(original_command) {
$("#textarea_command_preview").html(
parse_alert_command(original_command, "")
);
}
// eslint-disable-next-line no-unused-vars
function render_command_recovery_preview(original_command) {
$("#textarea_command_recovery_preview").html(
parse_alert_command(original_command, "recovery")
);
}
// eslint-disable-next-line no-unused-vars
function render_command_description(command_description) {
if (command_description != "") {
command_description = "<br>" + command_description;
}
$("#command_description").html(command_description);
}
// eslint-disable-next-line no-unused-vars
function load_templates_alerts_special_days(settings) {
confirmDialog({
title: settings.title,
message: function() {
var id = "div-" + uniqId();
$.ajax({
method: "post",
url: settings.url,
data: {
page: settings.page,
method: "drawAlertTemplates",
date: settings.date,
id_group: settings.id_group,
day_code: settings.day_code,
id_calendar: settings.id_calendar
},
datatype: "html",
success: function(data) {
$("#" + id)
.empty()
.html(data);
},
error: function(e) {
showMsg(e);
}
});
return "<div id ='" + id + "'>" + settings.loading + "</div>";
},
ok: settings.btn_ok_text,
cancel: settings.btn_cancel_text,
onAccept: function() {
$("#" + settings.name_form).submit();
},
size: 750,
maxHeight: 500
});
}

View File

@ -1242,9 +1242,8 @@ var TreeController = {
}
if (
(typeof element.searchChildren != "undefined" &&
element.searchChildren) ||
element.disabled == true
typeof element.searchChildren != "undefined" &&
element.searchChildren
) {
if (
element.rootType == "group_edition" &&

View File

@ -0,0 +1,274 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Calendar entity class.
*
* @category Class
* @package Pandora FMS
* @subpackage OpenSource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
namespace PandoraFMS;
/**
* PandoraFMS agent entity.
*/
class Calendar extends Entity
{
/**
* Search Calendar.
*
* @param array $filter Filters.
*
* @return array Rows.
*/
public static function search(array $filter)
{
$table = '`talert_calendar`';
$rows = \db_get_all_rows_filter(
$table,
$filter,
['`talert_calendar`.*']
);
return $rows;
}
/**
* Builds a PandoraFMS\Calendar object from given id.
*
* @param integer $id Id special day.
*/
public function __construct(?int $id=null)
{
$table = 'talert_calendar';
$filter = ['id' => $id];
$this->existsInDB = false;
if (is_numeric($id) === true
&& $id > 0
) {
parent::__construct(
$table,
$filter,
null,
false
);
$this->existsInDB = true;
} else {
// Create empty skel.
parent::__construct($table, null);
}
}
/**
* Saves current definition to database.
*
* @return mixed Affected rows of false in case of error.
* @throws \Exception On error.
*/
public function save()
{
if ($this->fields['id'] > 0) {
// Update.
$updates = $this->fields;
$rs = \db_process_sql_update(
$this->table,
$updates,
['id' => $this->fields['id']]
);
if ($rs === false) {
global $config;
throw new \Exception(
__METHOD__.' error: '.$config['dbconnection']->error
);
}
} else {
// Creation.
$inserts = $this->fields;
// Clean null fields.
foreach ($inserts as $k => $v) {
if ($v === null) {
unset($inserts[$k]);
}
}
$rs = \db_process_sql_insert(
$this->table,
$inserts
);
if ($rs === false) {
global $config;
throw new \Exception(
__METHOD__.' error: '.$config['dbconnection']->error
);
}
$this->fields['id'] = $rs;
}
return true;
}
/**
* Remove this calendar.
*
* @return void
*/
public function delete()
{
if ($this->existsInDB === true) {
\db_process_delete_temp(
$this->table,
'id',
$this->fields['id']
);
}
}
/**
* Returns an array with all calendar filtered.
*
* @param array $fields Fields array or 'count' keyword to retrieve count.
* @param array $filter Filters to be applied.
* @param boolean $count Retrieve count of items instead results.
* @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination).
* @param string $order Sort order.
* @param string $sort_field Sort field.
* @param boolean $select_options Array options for select.
*
* @return array With all results.
* @throws \Exception On error.
*/
public static function calendars(
array $fields=[ '`talert_calendar`.*' ],
array $filter=[],
bool $count=false,
?int $offset=null,
?int $limit=null,
?string $order=null,
?string $sort_field=null,
?bool $select_options=false
) {
$sql_filters = [];
$order_by = '';
$pagination = '';
if (isset($filter['free_search']) === true
&& empty($filter['free_search']) === false
) {
$sql_filters[] = vsprintf(
' AND (`talert_calendar`.`name` like "%%%s%%"
OR `talert_calendar`.`description` like "%%%s%%")',
array_fill(0, 2, $filter['free_search'])
);
}
if (isset($order) === true) {
$dir = 'asc';
if ($order === 'desc') {
$dir = 'desc';
};
if (in_array(
$sort_field,
[ 'name' ]
) === true
) {
$order_by = sprintf(
'ORDER BY `talert_calendar`.`%s` %s',
$sort_field,
$dir
);
} else {
// Custom field order.
$order_by = sprintf(
'ORDER BY `%s` %s',
$sort_field,
$dir
);
}
}
if (isset($limit) === true && $limit > 0
&& isset($offset) === true && $offset >= 0
) {
$pagination = sprintf(
' LIMIT %d OFFSET %d ',
$limit,
$offset
);
}
$sql = sprintf(
'SELECT %s
FROM `talert_calendar`
WHERE 1=1
%s
%s
%s',
join(',', $fields),
join(' ', $sql_filters),
$order_by,
$pagination
);
if ($count === true) {
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
return ['count' => \db_get_value_sql($sql)];
}
$return = \db_get_all_rows_sql($sql);
if (is_array($return) === false) {
return [];
}
if ($select_options === true) {
$return = array_reduce(
$return,
function ($carry, $item) {
$carry[$item['id']] = $item['name'];
return $carry;
}
);
}
return $return;
}
}

View File

@ -304,8 +304,21 @@ class MapsMadeByUser extends Widget
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
$node_id = $this->nodeId;
if (\is_metaconsole() === true && $node_id > 0) {
if (\metaconsole_connect(null, $node_id) !== NOERR) {
echo json_encode(
['error' => __('Failed to connect to node %d', $node_id) ]
);
}
}
$fields = $this->getVisualConsoles();
if (\is_metaconsole() === true && $node_id > 0) {
\metaconsole_restore_db();
}
// Visual console.
$inputs[] = [
'label' => __('Visual console'),

View File

@ -339,6 +339,7 @@ class TacticalWidget extends Widget
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -0,0 +1,310 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Special day entity class.
*
* @category Class
* @package Pandora FMS
* @subpackage OpenSource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
namespace PandoraFMS;
/**
* PandoraFMS agent entity.
*/
class SpecialDay extends Entity
{
/**
* Builds a PandoraFMS\SpecialDay object from given id.
*
* @param integer $id Id special day.
*/
public function __construct(?int $id=null)
{
$table = 'talert_special_days';
$filter = ['id' => $id];
$this->existsInDB = false;
if (is_numeric($id) === true
&& $id > 0
) {
parent::__construct(
$table,
$filter,
null,
false
);
$this->existsInDB = true;
} else {
// Create empty skel.
parent::__construct($table, null);
}
}
/**
* Saves current definition to database.
*
* @return mixed Affected rows of false in case of error.
* @throws \Exception On error.
*/
public function save()
{
if ($this->fields['id'] > 0) {
// Update.
$updates = $this->fields;
$rs = \db_process_sql_update(
$this->table,
$updates,
['id' => $this->fields['id']]
);
if ($rs === false) {
global $config;
throw new \Exception(
__METHOD__.' error: '.$config['dbconnection']->error
);
}
} else {
// Creation.
$inserts = $this->fields;
// Clean null fields.
foreach ($inserts as $k => $v) {
if ($v === null) {
unset($inserts[$k]);
}
}
$rs = \db_process_sql_insert(
$this->table,
$inserts
);
if ($rs === false) {
global $config;
throw new \Exception(
__METHOD__.' error: '.$config['dbconnection']->error
);
}
$this->fields['id'] = $rs;
}
return true;
}
/**
* Remove this Special day.
*
* @return void
*/
public function delete()
{
if ($this->existsInDB === true) {
\db_process_delete_temp(
$this->table,
'id',
$this->fields['id']
);
}
}
/**
* Returns an array with all special days filtered.
*
* @param array $fields Fields array or 'count' keyword to retrieve count.
* @param array $filter Filters to be applied.
* @param boolean $count Retrieve count of items instead results.
* @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination).
* @param string $order Sort order.
* @param string $sort_field Sort field.
* @param boolean $reduce Reduce result [Year][month][day].
*
* @return array With all results.
* @throws \Exception On error.
*/
public static function specialDays(
array $fields=[ '`talert_special_days`.*' ],
array $filter=[],
bool $count=false,
?int $offset=null,
?int $limit=null,
?string $order=null,
?string $sort_field=null,
?bool $reduce=false
) {
$sql_filters = [];
$order_by = '';
$pagination = '';
if (isset($filter['free_search']) === true
&& empty($filter['free_search']) === false
) {
$sql_filters[] = vsprintf(
' AND `talert_special_days`.`name` like "%%%s%%"',
array_fill(0, 1, $filter['free_search'])
);
}
if (isset($filter['id_calendar']) === true
&& empty($filter['id_calendar']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`id_calendar` = %d',
$filter['id_calendar']
);
}
if (isset($filter['date']) === true
&& empty($filter['date']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`date` >= "%s"',
$filter['date']
);
}
if (isset($filter['futureDate']) === true
&& empty($filter['futureDate']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`date` <= "%s"',
$filter['futureDate']
);
}
if (isset($filter['id_group']) === true
&& empty($filter['id_group']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`id_group` IN ("%s")',
implode(',', $filter['id_group'])
);
}
if (isset($filter['date_match']) === true
&& empty($filter['date_match']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`date` = "%s"',
$filter['date_match']
);
}
if (isset($filter['day_code']) === true
&& empty($filter['day_code']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`day_code` = %d',
$filter['day_code']
);
}
if (isset($order) === true) {
$dir = 'asc';
if ($order === 'desc') {
$dir = 'desc';
};
if (in_array(
$sort_field,
[ 'name' ]
) === true
) {
$order_by = sprintf(
'ORDER BY `talert_special_days`.`%s` %s',
$sort_field,
$dir
);
} else {
// Custom field order.
$order_by = sprintf(
'ORDER BY `%s` %s',
$sort_field,
$dir
);
}
}
if (isset($limit) === true && $limit > 0
&& isset($offset) === true && $offset >= 0
) {
$pagination = sprintf(
' LIMIT %d OFFSET %d ',
$limit,
$offset
);
}
$sql = sprintf(
'SELECT %s
FROM `talert_special_days`
WHERE 1=1
%s
%s
%s',
join(',', $fields),
join(' ', $sql_filters),
$order_by,
$pagination
);
if ($count === true) {
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
return ['count' => \db_get_value_sql($sql)];
}
$return = \db_get_all_rows_sql($sql);
if (is_array($return) === false) {
return [];
}
if ($reduce === true) {
$return = array_reduce(
$return,
function ($carry, $item) {
$year = date('Y', strtotime($item['date']));
$month = date('n', strtotime($item['date']));
$day = date('j', strtotime($item['date']));
$carry[$year][$month][$day][] = $item;
return $carry;
}
);
}
return $return;
}
}

View File

@ -327,6 +327,10 @@ final class ModuleGraph extends Item
$width = (int) $data['width'];
$height = (int) $data['height'];
if ($height == 0) {
$height = 15;
}
// Custom graph.
if (empty($customGraphId) === false) {
$customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId);

View File

@ -292,3 +292,54 @@ div#rules.show {
#rules select.click-list-elements:focus {
outline-color: transparent;
}
#icalendar-special-days {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
background-color: #fff;
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 20px 50px;
}
#icalendar-special-days ul.wizard {
flex: 0;
}
#icalendar-special-days ul.wizard:first-child {
flex: 1 1 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
margin-right: 80px;
}
.note-special-day {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
align-content: center;
}
.note-special-day div {
display: flex;
flex-direction: row;
align-items: center;
align-content: center;
}
.note-special-day div a.tip {
margin: 0px;
margin-right: 2px;
}
.note-special-day div a.tip > img {
margin: 0px;
}

View File

@ -110,7 +110,7 @@
/* --- Sidebar --- */
.sidebar_library {
min-width: 360px;
width: 240px;
margin-left: 50px;
border-left: 1px solid #d0d0d0;
padding: 0px 0px 0px 30px;
@ -151,7 +151,7 @@
#category_result,
#search_result {
display: grid;
grid-template-columns: repeat(3, minmax(300px, 1fr));
grid-template-columns: repeat(3, minmax(175px, 1fr));
grid-gap: 20px;
}

View File

@ -3000,7 +3000,7 @@ input.search_input {
background-color: #f2f6f7;
padding: 0px;
margin: 0;
width: 300px;
width: 150px;
height: 30px;
margin-left: 2px;
padding-left: 15px;
@ -6162,9 +6162,8 @@ div.graph div.legend table {
.sound_events {
background-color: #494949;
max-width: 550px;
max-height: 400px;
margin-top: 40px;
margin: 40px 2em 0;
min-height: auto;
}
.w16px {

View File

@ -58,7 +58,8 @@ input.sub,
button.sub,
.bg_general,
.show_result_interpreter,
div#rules::after table.agent_info_table thead > tr:first-child th,
div#rules::after,
table.agent_info_table thead > tr:first-child th,
table.agent_info_table tr {
background-color: #222 !important;
color: #fff !important;

View File

@ -220,8 +220,6 @@ echo '<head>'."\n";
// This starts the page head. In the callback function,
// $page['head'] array content will be processed into the head.
ob_start('ui_process_page_head');
// Avoid clickjacking.
header('X-Frame-Options: SAMEORIGIN');
// Enterprise main.
enterprise_include_once('index.php');

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.758';
$build = '211112';
$build = '211122';
$banner = "v$version Build $build";
error_reporting(0);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ legend {
tr.group_view_crit,
.group_view_crit {
background-color: #fa3030;
background-color: #fa3030 !important;
color: #000000 !important;
}
.group_view_crit * {
@ -155,7 +155,7 @@ tr.group_view_crit,
}
.ui-btn-up-group_view_crit,
.ui-btn-hover-group_view_crit {
background-color: #f85858;
background-color: #f85858 !important;
color: #fff;
border: 1px solid #111111;
font-weight: bold;
@ -166,7 +166,7 @@ tr.group_view_crit,
.group_view_normal *,
.group_view_norm,
.group_view_norm * {
background-color: #ffffff;
background-color: #ffffff !important;
color: #000000 !important;
}
.group_view_norm * {
@ -175,7 +175,7 @@ tr.group_view_crit,
.group_view_not_init,
.group_view_not_init * {
background-color: #5ab7e5;
background-color: #5ab7e5 !important;
color: #fff !important;
}
@ -183,7 +183,7 @@ tr.group_view_crit,
.ui-btn-hover-group_view_normal,
.ui-btn-up-group_view_norm,
.ui-btn-hover-group_view_norm {
background-color: #6eb432;
background-color: #6eb432 !important;
color: #fff;
border: 1px solid #111111;
font-weight: bold;
@ -192,7 +192,7 @@ tr.group_view_crit,
.group_view_ok,
.group_view_ok * {
background-color: #00c000;
background-color: #00c000 !important;
color: #000000 !important;
}
.group_view_ok * {
@ -200,7 +200,7 @@ tr.group_view_crit,
}
.ui-btn-up-group_view_ok,
.ui-btn-hover-group_view_ok {
background-color: #6eb432;
background-color: #6eb432 !important;
color: #fff;
border: 1px solid #111111;
font-weight: bold;
@ -212,14 +212,14 @@ tr.group_view_warn,
tr.group_view_warn.a,
a.group_view_warn,
tr.a.group_view_warn {
background-color: #f5e535;
background-color: #f5e535 !important;
}
a.group_view_warn {
color: #000000 !important;
}
.ui-btn-up-group_view_warn,
.ui-btn-hover-group_view_warn {
background-color: #ffea59;
background-color: #ffea59 !important;
color: #111;
border: 1px solid #111111;
font-weight: bold;
@ -228,14 +228,14 @@ a.group_view_warn {
tr.group_view_alrm,
.group_view_alrm {
background-color: #ed8701;
background-color: #ed8701 !important;
}
.group_view_alrm * {
color: #000000 !important;
}
.ui-btn-up-group_view_alrm,
.ui-btn-hover-group_view_alrm {
background-color: #f7931e;
background-color: #f7931e !important;
color: #fff;
border: 1px solid #111111;
font-weight: bold;
@ -244,14 +244,14 @@ tr.group_view_alrm,
tr.group_view_unk,
.group_view_unk {
background-color: #c4c4c4;
background-color: #c4c4c4 !important;
}
.group_view_unk * {
color: #000000 !important;
}
.ui-btn-up-group_view_unk,
.ui-btn-hover-group_view_unk {
background-color: #999999;
background-color: #999999 !important;
color: #fff;
border: 1px solid #111111;
font-weight: bold;
@ -302,10 +302,15 @@ tr.group_view_data,
.list_groups .number_count {
right: 10px;
display: flex;
align-items: center;
height: 100%;
}
.list_groups .name_count {
left: 10px;
display: flex;
align-items: center;
}
.list_groups .name_count img {
@ -316,13 +321,13 @@ tr.group_view_data,
/* For mobiles */
@media screen and (max-width: 750px) {
.list_groups .name_count img {
margin-top: -7px;
margin-top: 0px;
}
}
/* For tablets */
@media screen and (min-width: 750px) {
.list_groups .name_count img {
margin-top: -3px;
margin-top: 0px;
}
}
@ -450,134 +455,13 @@ table.event_details td.cell_event_name {
#validate_button {
margin: 10px auto;
display: block;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 40px;
}
/*
@media screen and (max-width: 25em)
{
.pandora_responsive th {
padding-right: 10px;
padding-left: 10px;
}
.pandora_responsive .event_id td,
.pandora_responsive .event_id th,
.pandora_responsive .event_name td,
.pandora_responsive .event_name th,
.pandora_responsive .event_owner th,
.pandora_responsive .event_timestamp th,
.pandora_responsive .event_timestamp td,
.pandora_responsive .event_type td,
.pandora_responsive .event_type th {
float: left;
}
.pandora_responsive .event_id {
float: left;
}
.pandora_responsive .event_name {
}
.cell_event_name {
padding-left: 10px;
}
.event_timestamp td,
.event_timestamp th {
margin-top: 10px;
margin-bottom: 10px;
}
.cell_event_name {
width: 300px;
}
.cell_event_owner {
float: left;
}
.event_type th {
float: left;
}
.cell_event_type {
float: left;
}
.event_owner {
float: left;
}
.event_type {
float: left;
}
.event_repeated {
clear: left;
float: left;
}
.event_repeated > th {
float: left;
}
.cell_event_repeated {
float: left;
}
.event_severity {
float: left;
}
.event_severity > th {
float: left;
}
.cell_event_severity {
float: left;
}
.event_status > th {
float: left;
}
.cell_event_status {
float: left;
}
.event_acknowledged_by > th {
float: left;
}
.cell_event_acknowledged_by {
float: left;
}
.event_group > th {
float: left;
}
.cell_event_group {
float: left;
}
.event_tags > th {
float: left;
margin-top: 10px;
}
.cell_event_tags {
float: left;
padding-left: 10px;
width: 300px;
}
}
*/
@media screen and (max-width: 35em) {
/* Hide the title of event name */
#list_events tbody tr.events td.cell_0 b.ui-table-cell-label {
@ -1149,6 +1033,8 @@ li.ui-btn {
.groups_sublist li {
border-radius: 0px;
margin-top: 5px !important;
margin-bottom: 5px !important;
}
.center {
@ -1188,7 +1074,6 @@ li.ui-btn {
/* For tablets */
@media screen and (min-width: 750px) {
.ui-content > .ui-btn {
width: 31%;
display: inline-block;
margin: 8px 5px;
height: 40px;
@ -1278,42 +1163,61 @@ table.tactical_bars {
font-weight: bold;
}
/*INIT-----------Icons styles---------------------------------------*/
/*INIT-----------Icons styles--------------------------------------- 1.3.1*/
.ui-icon-tactical_view {
.ui-icon-tactical_view:after {
background-image: url(../../../images/op_monitoring.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
background-size: 21px 21px !important;
}
.ui-icon-events {
.ui-icon-events:after {
background-image: url(../../../images/op_events.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
}
.ui-icon-groups {
.ui-icon-groups:after {
background-image: url(../../../images/group.menu.png) !important;
background-color: #333 !important;
background-size: 20px 20px !important;
}
.ui-icon-alerts {
.ui-icon-alerts:after {
background-image: url(../../../images/op_alerts.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
}
.ui-icon-agents {
.ui-icon-agents:after {
background-image: url(../../../images/agent_mc.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
}
.ui-icon-modules {
.ui-icon-modules:after {
background-image: url(../../../images/brick.menu.png) !important;
background-color: #333 !important;
background-size: 20px 20px !important;
}
.ui-icon-network_maps {
.ui-icon-network_maps:after {
background-image: url(../../../images/op_network.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
}
.ui-icon-visual_console {
.ui-icon-visual_console:after {
background-image: url(../../../images/visual_console.menu.png) !important;
background-color: #333 !important;
background-size: 20px 20px !important;
}
.ui-icon-dashboard {
.ui-icon-dashboard:after {
background-image: url(../../../images/dashboard.menu.png) !important;
background-position: unset !important;
background-color: #333 !important;
}
.ui-icon-tactical_view,
@ -1325,10 +1229,13 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
background-color: #333 !important;
background-position: center;
border-radius: 15px !important;
-webkit-border-radius: 15px !important;
display: flex !important;
align-items: center;
justify-content: center;
padding: 5px !important;
}
.ui-header.ui-bar-a .ui-btn-icon-notext .ui-btn-inner .ui-icon {
@ -1353,10 +1260,8 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
width: 22px !important;
height: 22px !important;
margin-top: -13px !important;
background-size: 16px 16px;
height: 28px !important;
margin-top: 0px !important;
}
}
/* For tablets */
@ -1370,18 +1275,20 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
width: 32px !important;
height: 32px !important;
margin-top: -17px !important;
}
}
/*END-----------Network maps styles---------------------------------------*/
#logout_dialog-button_close {
display: block;
display: flex;
margin: 0 auto;
margin-top: 20px;
align-items: center;
justify-content: center;
padding-top: 5px;
padding-bottom: 5px;
}
.ui-btn-active * {
@ -1506,3 +1413,13 @@ div.nodata_container {
.ui-popup-hidden {
display: none;
}
.ui-collapsible-inset.ui-collapsible-themed-content .ui-collapsible-content {
border-width: 0 !important;
}
.ui-listview > .ui-li-static,
.ui-listview > .ui-li-divider,
.ui-listview > li > a.ui-btn {
border-width: 0 !important;
}

View File

@ -731,7 +731,7 @@ class Ui
$html_title_close_button = "data-close-btn='yes'";
}
$dialogHtml = "<div id='".$dialog_id."' class='".$dialog_class."' data-role='dialog' ".$html_title_close_button.">\n";
$dialogHtml = "<div data-close-btn='right' id='".$dialog_id."' class='".$dialog_class."' data-role='dialog' ".$html_title_close_button.">\n";
$dialogHtml .= "<div data-role='header'>\n";
$dialogHtml .= "<h1 class='dialog_title'>".$title_text."</h1>\n";
$dialogHtml .= "</div>\n";
@ -785,10 +785,9 @@ class Ui
echo " <meta charset='UTF-8' />\n";
echo " <meta name='viewport' content='width=device-width, initial-scale=1'>\n";
echo " <link rel='stylesheet' href='include/style/main.css' />\n";
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.3.1.css' />\n";
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.4.5.css' />\n";
echo " <script src='include/javascript/jquery.js'></script>\n";
echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n";
echo " <script src='include/javascript/jquery.mobile-1.4.5.js'></script>\n";
echo " <script src='../include/javascript/pandora.js'></script>\n";
echo " <script src='../include/javascript/pandora_ui.js'></script>\n";

View File

@ -410,7 +410,7 @@ class Agent
});
function agent_filter_modules() {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.ajax ({
type: 'POST',
url: 'index.php',
@ -423,7 +423,7 @@ class Agent
'filter': $('#filter-modules').val()
},
success: function(r) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
var className = $('#list_agent_Modules').attr('class');
if (document.getElementById('list_agent_Modules') == null) {
$($('p.empty_advice')[0]).parent().html(r);
@ -434,7 +434,7 @@ class Agent
$('#list_agent_Modules').addClass(className);
},
error: function(r, t, e) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
console.error(e);
}
});

View File

@ -893,7 +893,7 @@ class Events
'
<script type="text/javascript">
function openDetails(id_event) {
$.mobile.showPageLoadingMsg();
$.mobile.loading("show");
postvars = {};
postvars["action"] = "ajax";
@ -952,24 +952,24 @@ class Events
}
else {
//The event is validated.
$("#validate_button").hide();
$("#validate_button").hide();
}
$("#validate_button_loading").hide();
$("#validate_button_fail").hide();
$("#validate_button_correct").hide();
$.mobile.hidePageLoadingMsg();
$.mobile.loading( "hide" );
$("#detail_event_dialog_hook").click();
}
else {
$.mobile.hidePageLoadingMsg();
$.mobile.loading( "hide" );
$("#detail_event_dialog_error_hook").click();
}
},
error:
function (jqXHR, textStatus, errorThrown) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading( "hide" );
$("#detail_event_dialog_error_hook").click();
}
});

View File

@ -93,37 +93,46 @@ class Groups
$url_modules = 'index.php?page=modules&group=%s&status=%s';
foreach ($this->groups as $group) {
// Calculate entire row color
// Calculate entire row color.
if ($group['_monitors_alerts_fired_'] > 0) {
$color_class = 'group_view_alrm';
$color = ' #f7931e';
$status_image = ui_print_status_image('agent_alertsfired_ball.png', '', true);
} else if ($group['_monitors_critical_'] > 0) {
$color_class = 'group_view_crit';
$color = ' #f85858';
$status_image = ui_print_status_image('agent_critical_ball.png', '', true);
} else if ($group['_monitors_warning_'] > 0) {
$color_class = 'group_view_warn';
$color = '#ffea59';
$status_image = ui_print_status_image('agent_warning_ball.png', '', true);
} else if ($group['_monitors_ok_'] > 0) {
$color_class = 'group_view_ok';
$color = '#6eb432';
$status_image = ui_print_status_image('agent_ok_ball.png', '', true);
} else if (($group['_monitors_unknown_'] > 0) || ($group['_agents_unknown_'] > 0)) {
$color_class = 'group_view_unk';
$color = '#999999';
$status_image = ui_print_status_image('agent_no_monitors_ball.png', '', true);
} else {
$color_class = '';
$color = '';
$status_image = ui_print_status_image('agent_no_data_ball.png', '', true);
}
$group['icon'] = ($group['icon'] == '') ? 'world' : $group['icon'];
$group['_iconImg_'] = ($group['_iconImg_'] == '') ? 'world.png' : $group['_iconImg_'];
$ui->contentAddHtml(
'
<style type="text/css">
.ui-icon-group_'.$count.' {
background: url("../images/groups_small/'.$group['icon'].'.png") no-repeat scroll 0 0 #F3F3F3 !important;
width: 24px;
height: 24px;
margin-top: -12px !important;
}
background-color: '.$color.' !important;
}
.ui-icon-group_'.$count.':after {
background-color = #333 !important;
background: url("../images/groups_small/'.$group['_iconImg_'].'") no-repeat scroll 0 0 #F3F3F3 !important;
background-size: 22px 22px !important;
}
</style>
'
);

View File

@ -120,6 +120,7 @@ class Tactical
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -982,7 +982,6 @@ if (!empty($table->data)) {
<script type="text/javascript">
$(document).ready (function () {
$("[class^='left']").mouseenter (function () {
console.log($(this));
$(".agent"+$(this)[0].className).css('visibility', '');
}).mouseleave(function () {
$(".agent"+$(this)[0].className).css('visibility', 'hidden');

View File

@ -391,7 +391,7 @@ $sql_conditions_tags = '';
if (!users_is_admin()) {
$sql_conditions_tags = tags_get_acl_tags(
$config['id_user'],
$ag_group,
($recursion) ? $all_groups : $ag_group,
'AR',
'module_condition',
'AND',
@ -769,39 +769,42 @@ if ($not_condition !== '') {
$check_not_condition = true;
}
$table->data[4][0] .= __('Not condition');
$table->data[4][1] .= '<div class="w120px mrgn_top_20px">';
$table->data[4][1] .= html_print_input(
$table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true);
$table->data[4][1] = html_print_div(
[
'type' => 'switch',
'name' => 'not_condition',
'return' => false,
'checked' => $check_not_condition,
'value' => 'NOT',
'id' => 'not_condition_switch',
'onclick' => 'changeNotConditionStatus(this)',
]
'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px',
'content' => html_print_input(
[
'type' => 'switch',
'name' => 'not_condition',
'return' => false,
'checked' => $check_not_condition,
'value' => 'NOT',
'id' => 'not_condition_switch',
'onclick' => 'changeNotConditionStatus(this)',
]
),
],
true
);
$table->data[4][1] .= ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true);
$table->data[4][1] .= '</div>';
$table_custom_fields = new stdClass();
$table_custom_fields->class = 'filters';
$table_custom_fields->width = '100%';
$table_custom_fields->style = [];
$table_custom_fields->style[0] = 'font-weight: bold;';
if (is_metaconsole()) {
// Style is different in metaconsole.
if (is_metaconsole() === false) {
$table_custom_fields->style[0] = 'font-weight: bold; width: 150px;';
}
if (is_metaconsole() === true) {
$table_custom_fields->styleTable = 'margin-left:0px; margin-top:15px;';
$table_custom_fields->cellpadding = '0';
$table_custom_fields->cellspacing = '0';
}
$table_custom_fields->style = [];
if (!is_metaconsole()) {
$table_custom_fields->style[0] = 'font-weight: bold; width: 150px;';
} else {
$table_custom_fields->style[0] = 'font-weight: bold;';
}
$table_custom_fields->colspan = [];
$table_custom_fields->data = [];
@ -815,9 +818,9 @@ $table->data[4][0] .= __('Not condition');
$row[0] = $custom_field['name'];
$custom_field_value = '';
if (!empty($ag_custom_fields)) {
if (empty($ag_custom_fields) === false) {
$custom_field_value = $ag_custom_fields[$custom_field['id_field']];
if (empty($custom_field_value)) {
if (empty($custom_field_value) === true) {
$custom_field_value = '';
}
}
@ -830,7 +833,7 @@ $table->data[4][0] .= __('Not condition');
$filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">';
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$table->colspan[5][0] = 7;
$table->cellstyle[5][0] = 'padding: 10px;';
$table->data[5][0] = ui_toggle(

View File

@ -98,6 +98,7 @@ $data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -91,7 +91,7 @@ if (is_ajax()) {
if ($get_agents_group_json) {
$id_group = (int) get_parameter('id_group');
$recursion = (get_parameter_switch('recursion', 'false') === 'true');
$recursion = filter_var(get_parameter_switch('recursion', 'false'), FILTER_VALIDATE_BOOLEAN);
$id_os = get_parameter('id_os', '');
$agent_name = get_parameter('name', '');
@ -801,7 +801,7 @@ if (is_ajax()) {
}
} else {
$sql = sprintf(
'SELECT DISTINCT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
'SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
%s WHERE %s AND t1.delete_pending = 0
AND t1.id_agente IN ('.implode(',', $idAgents).')

View File

@ -479,7 +479,7 @@ if ($load_filter_id === 0) {
// Do not load the user filter if we come from the 24h event graph.
$from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']);
if ($loaded_filter !== false && $from_event_graph != 1) {
if ($loaded_filter !== false && $from_event_graph != 1 && !isset($fb64)) {
$filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) {
$id_group = $filter['id_group'];

View File

@ -90,6 +90,7 @@ $incident_creator = get_parameter('creator');
$incident_status = (int) get_parameter('status');
$incident_title = events_get_field_value_by_event_id($event_id, get_parameter('incident_title'));
$incident_content = events_get_field_value_by_event_id($event_id, get_parameter('incident_content'));
$file_description = get_parameter('file_description');
// Separator conversions.
$incident_title = str_replace(',', ':::', $incident_title);
@ -100,7 +101,11 @@ if ($create_incident === true) {
// Call Integria IMS API method to create an incident.
$result_api_call = integria_api_call(null, null, null, null, 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status], false, '', ',');
// Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value.
if ($userfile !== '' && $result_api_call !== false) {
integriaims_upload_file('userfile', $result_api_call, $file_description);
}
// Necessary to explicitly set true if not false because function returns result of api call in case of success instead of true value.
$incident_created_ok = ($result_api_call != false) ? true : false;
ui_print_result_message(
@ -112,6 +117,10 @@ if ($create_incident === true) {
// Call Integria IMS API method to update an incident.
$result_api_call = integria_api_call(null, null, null, null, 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, 0, $incident_status, $incident_owner, 0, $incident_type], false, '', ',');
if ($userfile !== '') {
integriaims_upload_file('userfile', $incident_id_edit, $file_description);
}
// Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value.
$incident_updated_ok = ($result_api_call != false) ? true : false;
@ -153,6 +162,7 @@ $table->style[1] = 'width: 33%; padding-right: 50px; padding-left: 50px;';
$table->style[2] = 'width: 33%; padding-right: 100px; padding-left: 50px;';
$table->colspan[0][0] = 2;
$table->colspan[3][0] = 3;
$table->colspan[5][0] = 3;
$help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : '';
@ -303,8 +313,20 @@ $table->data[3][0] .= '<div class="label_select_parent">'.html_print_textarea(
true
).'</div>';
$table->data[4][0] = '<div class="label_select"><p class="input_label">'.__('File name').':</p>';
$table->data[4][0] .= html_print_input_file('userfile', true);
$table->data[5][0] = '<div class="label_select"><p class="input_label">'.__('Attachment description').':</p>';
$table->data[5][0] .= html_print_textarea(
'file_description',
3,
20,
'',
'',
true
);
// Print forms and stuff.
echo '<form id="create_integria_incident_form" name="create_integria_incident_form" method="POST">';
echo '<form id="create_integria_incident_form" name="create_integria_incident_form" method="POST" enctype="multipart/form-data">';
html_print_table($table);
if (!$update) {

View File

@ -90,7 +90,7 @@ $resolution_text = integriaims_get_details('resolution', $resolution);
$type_text = integriaims_get_details('type', $type);
// Incident file management.
$upload_file = get_parameter('upload_file');
$upload_file = (bool) get_parameter('upload_file');
$delete_file_id = get_parameter('delete_file');
$download_file_id = get_parameter('download_file');
$download_file_name = get_parameter('download_file_name');
@ -121,47 +121,10 @@ $table_files->head[5] = __('Delete');
$table_files->data = [];
// Upload file.
if ($upload_file && ($_FILES['userfile']['name'] != '')) {
$filedescription = get_parameter('file_description', __('No description available'));
$filedescription = get_parameter('file_description', __('No description available'));
$filename = io_safe_input($_FILES['userfile']['name']);
$filesize = io_safe_input($_FILES['userfile']['size']);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$invalid_extensions = '/^(bat|exe|cmd|sh|php|php1|php2|php3|php4|php5|pl|cgi|386|dll|com|torrent|js|app|jar|iso|
pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|
htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh)$/i';
if (!preg_match($invalid_extensions, $extension)) {
// The following is if you have clamavlib installed.
// (php5-clamavlib) and enabled in php.ini
// http://www.howtoforge.com/scan_viruses_with_php_clamavlib
if (extension_loaded('clamav')) {
cl_setlimits(5, 1000, 200, 0, 10485760);
$malware = cl_scanfile($_FILES['file']['tmp_name']);
if ($malware) {
$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
die($error);
// On malware, we die because it's not good to handle it
}
}
$filecontent = base64_encode(file_get_contents($_FILES['userfile']['tmp_name']));
$result_api_call = integria_api_call(null, null, null, null, 'attach_file', [$incident_id, $filename, $filesize, $filedescription, $filecontent], false, '', '|;|');
// API method returns '0' string if success.
$file_added = ($result_api_call === '0') ? true : false;
ui_print_result_message(
$file_added,
__('File successfully added'),
__('File could not be added')
);
} else {
ui_print_error_message(__('File has an invalid extension'));
}
if ($upload_file === true) {
integriaims_upload_file('userfile', $incident_id, $filedescription);
}
// Delete file.
@ -242,7 +205,7 @@ foreach ($files as $key => $value) {
$table_files_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('File name').':</p>';
$table_files_section->data[0][0] .= html_print_input_file('userfile', true);
$table_files_section->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
$table_files_section->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Attachment description').':</p>';
$table_files_section->data[1][0] .= html_print_textarea(
'file_description',
3,
@ -256,7 +219,7 @@ $table_files_section->data[2][0] .= '<div class="w100p right">'.html_print_submi
$upload_file_form = '<div class="w100p">';
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true);
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', true, true);
$upload_file_form .= '<h4>'.__('Attached files').'</h4>'.html_print_table($table_files, true).'</form></div>';

View File

@ -60,6 +60,223 @@ $created_to = (string) get_parameter('created_to', '');
$offset = (int) get_parameter('offset');
$delete_incident = get_parameter('delete_incident');
// Sorting.
$sort_field = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = true;
$select_incident_id_up = false;
$select_incident_id_down = false;
$select_title_up = false;
$select_title_down = false;
$select_group_company_up = false;
$select_group_company_down = false;
$select_status_resolution_up = false;
$select_status_resolution_down = false;
$select_priority_up = false;
$select_priority_down = false;
$select_creator_up = false;
$select_creator_down = false;
$select_owner_up = false;
$select_owner_down = false;
$order[] = [
'field' => 'incident_id',
'order' => 'ASC',
];
switch ($sort_field) {
case 'incident_id':
switch ($sort) {
case 'up':
$select_incident_id_up = $selected;
$order = [
'field' => 0,
'order' => 'ASC',
];
break;
case 'down':
$select_incident_id_down = $selected;
$order = [
'field' => 0,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'title':
switch ($sort) {
case 'up':
$select_title_up = $selected;
$order = [
'field' => 3,
'order' => 'ASC',
];
break;
case 'down':
$select_title_down = $selected;
$order = [
'field' => 3,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'group_company':
switch ($sort) {
case 'up':
$select_group_company_up = $selected;
$order = [
'field' => 'group_company',
'order' => 'ASC',
];
break;
case 'down':
$select_group_company_down = $selected;
$order = [
'field' => 'group_company',
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'status_resolution':
switch ($sort) {
case 'up':
$select_status_resolution_up = $selected;
$order = [
'field' => 'status_resolution',
'order' => 'ASC',
];
break;
case 'down':
$select_status_resolution_down = $selected;
$order = [
'field' => 'status_resolution',
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'priority':
switch ($sort) {
case 'up':
$select_priority_up = $selected;
$order = [
'field' => 7,
'order' => 'ASC',
];
break;
case 'down':
$select_priority_down = $selected;
$order = [
'field' => 7,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'creator':
switch ($sort) {
case 'up':
$select_creator_up = $selected;
$order = [
'field' => 10,
'order' => 'ASC',
];
break;
case 'down':
$select_creator_down = $selected;
$order = [
'field' => 10,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'owner':
switch ($sort) {
case 'up':
$select_owner_up = $selected;
$order = [
'field' => 5,
'order' => 'ASC',
];
break;
case 'down':
$select_owner_down = $selected;
$order = [
'field' => 5,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
default:
$select_incident_id_up = $selected;
$select_incident_id_down = false;
$select_title_up = false;
$select_title_down = false;
$select_group_company_up = false;
$select_group_company_down = false;
$select_status_resolution_up = false;
$select_status_resolution_down = false;
$select_priority_up = false;
$select_priority_down = false;
$select_creator_up = false;
$select_creator_down = false;
$select_owner_up = false;
$select_owner_down = false;
$order = [
'field' => 'id_user',
'order' => 'ASC',
];
break;
}
if ($delete_incident) {
// Call Integria IMS API method to delete an incident.
$result_api_call_delete = integria_api_call(
@ -80,12 +297,6 @@ if ($delete_incident) {
);
}
// Full url with all filters.
$url = ui_get_full_url(
'index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&incident_text='.$incident_text.'&incident_status='.$incident_status.'&incident_group='.$incident_group.'&incident_owner='.$incident_owner.'&incident_creator='.$incident_creator.'&incident_priority='.$incident_priority.'&incident_resolution='.$incident_resolution.'&created_from='.$created_from.'&created_to='.$created_to.'&offset='.$offset
);
// ---- FILTERS ----
// API calls to fill the filters.
$status_incident = integriaims_get_details('status');
@ -204,6 +415,10 @@ $tickets_filters = [
// Data to export to csv file.
$decode_csv = base64_encode(json_encode($tickets_filters));
// Full url with all filters.
$url = ui_get_full_url(
'index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&incident_text='.$incident_text.'&incident_status='.$incident_status.'&incident_group='.$incident_group.'&incident_owner='.$incident_owner.'&incident_creator='.$incident_creator.'&incident_priority='.$incident_priority.'&incident_resolution='.$incident_resolution.'&created_from='.$created_from.'&created_to='.$created_to.'&offset='.$offset.'&sort_field='.$sort_field.'&sort='.$sort
);
// ---- PRINT TABLE FILTERS ----
$integria_incidents_form = '<form method="post" action="'.$url.'" class="pdd_0px">';
@ -241,6 +456,37 @@ ui_toggle($integria_incidents_form, __('Filter'), '', '', false);
// Get list of incidents.
$array_get_incidents = get_tickets_integriaims($tickets_filters);
$props = [
'order' => $order,
'group_incident' => $group_incident,
'status_incident' => $status_incident,
'resolution_incident' => $resolution_incident,
];
usort(
$array_get_incidents,
function ($a, $b) use ($props) {
$order_field = $props['order']['field'];
$item_a = $a[$order_field];
$item_b = $b[$order_field];
if ($order_field === 'group_company') {
$item_a = $props['group_incident'][$a[8]];
$item_b = $props['group_incident'][$b[8]];
} else if ($order_field === 'status_resolution') {
$item_a = $props['status_incident'][$a[6]].' / '.$props['resolution_incident'][$a[12]];
$item_b = $props['status_incident'][$b[6]].' / '.$props['resolution_incident'][$b[12]];
}
if ($props['order']['order'] === 'DESC') {
return $item_a < $item_b;
} else {
return $item_a > $item_b;
}
}
);
// Prepare pagination.
$incidents_limit = $config['block_size'];
$incidents_paginated = array_slice($array_get_incidents, $offset, $incidents_limit, true);
@ -251,14 +497,29 @@ $table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('ID');
$table->head[1] = __('Ticket');
$table->head[2] = __('Group/Company');
$table->head[3] = __('Status/Resolution');
$table->head[4] = __('Prior');
$url_incident_id_up = $url.'&sort_field=incident_id&sort=up';
$url_incident_id_down = $url.'&sort_field=incident_id&sort=down';
$url_title_up = $url.'&sort_field=title&sort=up';
$url_title_down = $url.'&sort_field=title&sort=down';
$url_group_company_up = $url.'&sort_field=group_company&sort=up';
$url_group_company_down = $url.'&sort_field=group_company&sort=down';
$url_status_resolution_up = $url.'&sort_field=status_resolution&sort=up';
$url_status_resolution_down = $url.'&sort_field=status_resolution&sort=down';
$url_priority_up = $url.'&sort_field=priority&sort=up';
$url_priority_down = $url.'&sort_field=priority&sort=down';
$url_creator_up = $url.'&sort_field=creator&sort=up';
$url_creator_down = $url.'&sort_field=creator&sort=down';
$url_owner_up = $url.'&sort_field=owner&sort=up';
$url_owner_down = $url.'&sort_field=owner&sort=down';
$table->head[0] = __('ID').ui_get_sorting_arrows($url_incident_id_up, $url_incident_id_down, $select_incident_id_up, $select_incident_id_down);
$table->head[1] = __('Title').ui_get_sorting_arrows($url_title_up, $url_title_down, $select_title_up, $select_title_down);
$table->head[2] = __('Group/Company').ui_get_sorting_arrows($url_group_company_up, $url_group_company_down, $select_group_company_up, $select_group_company_down);
$table->head[3] = __('Status/Resolution').ui_get_sorting_arrows($url_status_resolution_up, $url_status_resolution_down, $select_status_resolution_up, $select_status_resolution_down);
$table->head[4] = __('Priority').ui_get_sorting_arrows($url_priority_up, $url_priority_down, $select_priority_up, $select_priority_down);
$table->head[5] = __('Updated/Started');
$table->head[6] = __('Creator');
$table->head[7] = __('Owner');
$table->head[6] = __('Creator').ui_get_sorting_arrows($url_creator_up, $url_creator_down, $select_creator_up, $select_creator_down);
$table->head[7] = __('Owner').ui_get_sorting_arrows($url_owner_up, $url_owner_down, $select_owner_up, $select_owner_down);
$table->head[8] = '';
$table->data = [];
@ -324,4 +585,4 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
});
});
</script>
</script>

View File

@ -427,11 +427,18 @@ if (check_acl($config['id_user'], 0, 'ER')
<script type="text/javascript">
function openSoundEventWindow() {
url = '<?php echo ui_get_full_url('operation/events/sound_events.php'); ?>';
// devicePixelRatio knows how much zoom browser applied.
var windowScale = parseFloat(window.devicePixelRatio);
var defaultWidth = 600;
var defaultHeight = 450;
// If the scale is 1, no zoom has been applied.
var windowWidth = windowScale <= 1 ? defaultWidth : windowScale*defaultWidth;
var windowHeight = windowScale <= 1 ? defaultHeight : windowScale*defaultHeight + (defaultHeight*0.1);
window.open(
url,
'<?php __('Sound Alerts'); ?>',
'width=600, height=450, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no'
'width='+windowWidth+', height='+windowHeight+', resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no'
);
}
</script>
@ -545,7 +552,7 @@ if (is_array($config['extensions'])) {
if (array_key_exists('fatherId', $extension_menu)) {
// Check that extension father ID exists previously on the menu.
if ((strlen($extension_menu['fatherId']) > 0)) {
if (array_key_exists('subfatherId', $extension_menu)) {
if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) {
if ((strlen($extension_menu['subfatherId']) > 0)) {
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = $extension_menu['name'];

View File

@ -549,13 +549,13 @@ $table_ichanges = '<div class="autorefresh_select">
</div>
<div class="autorefresh_select_arrows" style="display:grid">
<a href="javascript:">'.html_print_image(
'images/darrowright_green.png',
true,
[
'id' => 'right_autorefreshlist',
'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'),
]
'images/darrowright_green.png',
true,
[
'id' => 'right_autorefreshlist',
'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'),
]
).'</a>
<a href="javascript:">'.html_print_image(
'images/darrowleft_green.png',

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.758
%define release 211112
%define release 211122
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.758
%define release 211112
%define release 211122
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.758
%define release 211112
%define release 211122
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -570,16 +570,31 @@ CREATE TABLE IF NOT EXISTS `talert_template_module_actions` (
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_calendar`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
`id_group` INT(10) NOT NULL DEFAULT 0,
`description` text,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_special_days`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_special_days` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_calendar` int(10) unsigned NOT NULL DEFAULT 1,
`id_group` INT(10) NOT NULL DEFAULT 0,
`date` date NOT NULL DEFAULT '1970-01-01',
`same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday',
`day_code` tinyint(2) NOT NULL,
`description` text,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
FOREIGN KEY (`id_calendar`) REFERENCES talert_calendar(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
@ -3850,6 +3865,7 @@ CREATE TABLE `tagent_repository` (
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`deployment_timeout` INT UNSIGNED DEFAULT 600,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,

View File

@ -2777,3 +2777,5 @@ INSERT INTO `tncm_script` VALUES
(5,5,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;term&#x0d;&#x0a;end&#x0d;&#x0a;end&#x0d;&#x0a;exit&#x0d;&#x0a;');
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5);
INSERT INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');

View File

@ -0,0 +1,140 @@
<?php
/**
* Calendar: edit page
*
* @category View
* @package Pandora FMS
* @subpackage Alert
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Extras required.
\ui_require_css_file('wizard');
\enterprise_include_once('meta/include/functions_alerts_meta.php');
\enterprise_hook('open_meta_frame');
if (\is_metaconsole() === true) {
\alerts_meta_print_header($tabs);
} else {
// Header.
\ui_print_page_header(
// Title.
__('Calendars Edit'),
// Icon.
'images/gm_alerts.png',
// Return.
false,
// Help.
'alert_special_days',
// Godmode.
true,
// Options.
$tabs
);
}
$is_management_allowed = \is_management_allowed();
if ($is_management_allowed === false) {
if (\is_metaconsole() === false) {
$url_link = '<a target="_blank" href="'.ui_get_meta_url($url).'">';
$url_link .= __('metaconsole');
$url_link .= '</a>';
} else {
$url_link = __('any node');
}
\ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert calendar information is read only. Go to %s to manage it.',
$url_link
)
);
}
if (empty($message) === false) {
echo $message;
}
$inputs = [];
// Name.
$inputs[] = [
'label' => __('Name'),
'arguments' => [
'type' => 'text',
'name' => 'name',
'required' => true,
'value' => $calendar->name(),
],
];
// Group.
$inputs[] = [
'label' => __('Group'),
'arguments' => [
'type' => 'select_groups',
'returnAllGroup' => true,
'name' => 'id_group',
'selected' => $calendar->id_group(),
'required' => true,
],
];
// Description.
$inputs[] = [
'label' => __('Description'),
'arguments' => [
'type' => 'textarea',
'name' => 'description',
'required' => false,
'value' => $calendar->description(),
'rows' => 50,
'columns' => 30,
],
];
if ($is_management_allowed === true) {
// Submit.
$inputs[] = [
'arguments' => [
'name' => 'button',
'label' => (($create === true) ? __('Create') : __('Update')),
'type' => 'submit',
'attributes' => 'class="sub next"',
],
];
}
// Print form.
HTML::printForm(
[
'form' => [
'action' => $url.'&op=edit&action=save&id='.$calendar->id(),
'method' => 'POST',
],
'inputs' => $inputs,
],
false,
true
);
\enterprise_hook('close_meta_frame');

Some files were not shown because too many files have changed in this diff Show More