ConsoleSuperviso - mailing support and minor fixes

Former-commit-id: 86db19d675aa2b7ea37af2839764245fde9ee3c4
This commit is contained in:
fbsanchez 2019-02-07 18:00:51 +01:00
parent dc9decde42
commit 681ad67028
5 changed files with 546 additions and 503 deletions

View File

@ -4,509 +4,487 @@
// ==================================================
// Copyright (c) 2005-2011 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; 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.
require_once ("include/functions_messages.php");
require_once ('include/functions_servers.php');
require_once ('include/functions_notifications.php');
require_once 'include/functions_messages.php';
require_once 'include/functions_servers.php';
require_once 'include/functions_notifications.php';
// Check permissions
// Global errors/warnings checking.
config_check();
?>
<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; margin-top: 0px; height: 100%" border="0">
<tr>
<td style="width:90%;">
<a href="index.php?sec=main">
<?php
$custom_logo = 'images/custom_logo/' . $config['custom_logo'];
<tr>
<td style="width:90%;">
<a href="index.php?sec=main">
<?php
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
if (!defined ('PANDORA_ENTERPRISE')) {
$logo_title = get_product_name() . ' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
}
else {
if (file_exists(ENTERPRISE_DIR . '/' . $custom_logo)) {
$custom_logo = ENTERPRISE_DIR . '/' . $custom_logo;
}
$logo_title = get_product_name() . ' Enterprise';
}
if (!defined('PANDORA_ENTERPRISE')) {
$logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
} else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
echo html_print_image($custom_logo, true,
array("alt" => $logo_title, "border" => '0'));
?>
</a>
</td>
<td style="min-width:200px;">
<?php
$table = new stdClass();
$table->id = "header_table";
$table->class = "none";
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->head = array ();
$table->data = array ();
$table->style[0] =
$table->style['clippy'] =
$table->style[1] =
$table->style[3] =
$table->style[4] =
$table->style[5] =
$table->style[6] =
$table->style[8] =
$table->style[9] =
$table->style['qr'] =
$table->style['notifications'] =
'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
$table->style[7] = 'width: 20px; padding-right: 9px;';
$table->style['searchbar'] = 'width: 180px; min-width: 180px;';
$table->style[11] = 'padding-left: 10px; padding-right: 5px;width: 16px;';
$table->width = "100%";
$table->styleTable = 'margin: auto; margin-top: 0px;';
$table->rowclass[0] = '';
$logo_title = get_product_name().' Enterprise';
}
$acl_head_search = true;
if ($config["acl_enterprise"] == 1 && !users_is_admin()) {
$acl_head_search = db_get_sql("SELECT sec FROM tusuario
echo html_print_image(
$custom_logo,
true,
[
'alt' => $logo_title,
'border' => '0',
]
);
?>
</a>
</td>
<td style="min-width:200px;">
<?php
$table = new stdClass();
$table->id = 'header_table';
$table->class = 'none';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->head = [];
$table->data = [];
$table->style[0] = $table->style['clippy'] = $table->style[1] = $table->style[3] = $table->style[4] = $table->style[5] = $table->style[6] = $table->style[8] = $table->style[9] = $table->style['qr'] = $table->style['notifications'] = 'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
$table->style[7] = 'width: 20px; padding-right: 9px;';
$table->style['searchbar'] = 'width: 180px; min-width: 180px;';
$table->style[11] = 'padding-left: 10px; padding-right: 5px;width: 16px;';
$table->width = '100%';
$table->styleTable = 'margin: auto; margin-top: 0px;';
$table->rowclass[0] = '';
$acl_head_search = true;
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
$acl_head_search = db_get_sql(
"SELECT sec FROM tusuario
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')");
}
if ($acl_head_search) {
$table->data[0][11] = ui_print_help_tip (__("Blank characters are used as AND conditions"), true);
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
);
}
// Search bar
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
if (!isset($config['search_keywords'])) {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
}
else {
if (strlen($config['search_keywords']) == 0)
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
else
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
}
if ($acl_head_search) {
$table->data[0][11] = ui_print_help_tip(__('Blank characters are used as AND conditions'), true);
$search_bar .= '<input type="text" id="keywords" name="keywords"';
if (!isset($config['search_keywords']))
$search_bar .= "value='" . __("Enter keywords to search") . "'";
else if (strlen($config['search_keywords']) == 0)
$search_bar .= "value='" . __("Enter keywords to search") . "'";
else
$search_bar .= "value='" . $config['search_keywords'] . "'";
// Search bar
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
if (!isset($config['search_keywords'])) {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
} else {
if (strlen($config['search_keywords']) == 0) {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
} else {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
}
}
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
$search_bar .= '<input type="text" id="keywords" name="keywords"';
if (!isset($config['search_keywords'])) {
$search_bar .= "value='".__('Enter keywords to search')."'";
} else if (strlen($config['search_keywords']) == 0) {
$search_bar .= "value='".__('Enter keywords to search')."'";
} else {
$search_bar .= "value='".$config['search_keywords']."'";
}
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
onkeyup="javascript: fieldKeyWordEmpty = false;"
style="margin-top:5px;" class="search_input" />';
//$search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>';
$table->data[0]['searchbar'] = $search_bar;
}
$table->data[0]['searchbar'] = $search_bar;
}
// Servers check
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['up'] == 0) {
// All Servers down or no servers at all
$servers_check_img = html_print_image('images/header_down.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
} else if ($servers['down'] != 0) {
// Some servers down
$servers_check_img = html_print_image('images/header_warning.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
} else {
// All servers up
$servers_check_img = html_print_image('images/header_ready.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
}
// Servers check
$servers = array();
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
$servers["up"] = (int) servers_check_status ();
$servers["down"] = $servers["all"] - $servers["up"];
if ($servers["up"] == 0) {
//All Servers down or no servers at all
$servers_check_img = html_print_image("images/header_down.png", true, array("alt" => 'cross', "class" => 'bot', 'title' => __('All systems').': '.__('Down')));
}
elseif ($servers["down"] != 0) {
//Some servers down
$servers_check_img = html_print_image("images/header_warning.png", true, array("alt" => 'error', "class" => 'bot', 'title' => $servers["down"].' '.__('servers down')));
}
else {
//All servers up
$servers_check_img = html_print_image("images/header_ready.png", true, array("alt" => 'ok', "class" => 'bot', 'title' => __('All systems').': '.__('Ready')));
}
unset ($servers); // Since this is the header, we don't like to trickle down variables.
unset($servers);
// Since this is the header, we don't like to trickle down variables.
$servers_link_open = '<a class="white" href="index.php?sec=gservers&amp;sec2=godmode/servers/modificar_server&amp;refr=60">';
$servers_link_close = '</a>';
$servers_link_open = '<a class="white" href="index.php?sec=gservers&amp;sec2=godmode/servers/modificar_server&amp;refr=60">';
$servers_link_close = '</a>';
if ($config['show_qr_code_header'] == 0) {
$show_qr_code_header = 'display: none;';
} else {
$show_qr_code_header = 'display: inline;';
}
if ($config['show_qr_code_header'] == 0){
$show_qr_code_header = 'display: none;';
}
else {
$show_qr_code_header = 'display: inline;';
}
$table->data[0]['qr'] = '<div style="'.$show_qr_code_header.'" id="qr_code_container" style="">'.'<a href="javascript: show_dialog_qrcode();">'.html_print_image(
'images/qrcode_icon.png',
true,
[
'alt' => __('QR Code of the page'),
'title' => __('QR Code of the page'),
]
).'</a>'.'</div>';
$table->data[0]['qr'] =
'<div style="' . $show_qr_code_header . '" id="qr_code_container" style="">' .
'<a href="javascript: show_dialog_qrcode();">' .
html_print_image(
"images/qrcode_icon.png",
true,
array("alt" => __('QR Code of the page'),
'title' => __('QR Code of the page'))) .
'</a>' .
'</div>';
echo "<div style='display: none;' id='qrcode_container' title='" . __('QR code of the page') . "'>";
echo "<div id='qrcode_container_image'></div>";
echo "</div>";
?>
<script type='text/javascript'>
$(document).ready(function() {
$( "#qrcode_container" ).dialog({
autoOpen: false,
modal: true
});
});
</script>
<?php
if ($config['tutorial_mode'] !== 'expert' && !$config['disable_help']) {
$table->data[0]['clippy'] =
'<a href="javascript: show_clippy();">' .
html_print_image(
"images/clippy_icon.png",
true,
array("id" => 'clippy',
"class" => 'clippy',
"alt" => __('%s assistant', get_product_name()),
'title' => __('%s assistant', get_product_name()))) .
'</a>';
}
echo "<div style='display: none;' id='qrcode_container' title='".__('QR code of the page')."'>";
echo "<div id='qrcode_container_image'></div>";
echo '</div>';
?>
<script type='text/javascript'>
$(document).ready(function() {
$( "#qrcode_container" ).dialog({
autoOpen: false,
modal: true
});
});
</script>
<?php
if ($config['tutorial_mode'] !== 'expert' && !$config['disable_help']) {
$table->data[0]['clippy'] = '<a href="javascript: show_clippy();">'.html_print_image(
'images/clippy_icon.png',
true,
[
'id' => 'clippy',
'class' => 'clippy',
'alt' => __('%s assistant', get_product_name()),
'title' => __(
'%s assistant',
get_product_name()
),
]
).'</a>';
}
$table->data[0][0] = $servers_link_open .
$servers_check_img . $servers_link_close;
$table->data[0][0] = $servers_link_open.$servers_check_img.$servers_link_close;
//======= Autorefresh code =============================
$autorefresh_txt = '';
$autorefresh_additional = '';
// ======= Autorefresh code =============================
$autorefresh_txt = '';
$autorefresh_additional = '';
$ignored_params = array ('agent_config' => false, 'code' => false);
$ignored_params = [
'agent_config' => false,
'code' => false,
];
if (!isset($_GET['sec2'])) {
$_GET['sec2'] = '';
}
if (!isset($_GET['refr'])) {
$_GET['refr'] = null;
}
if (!isset($_GET['sec2'])) {
$_GET['sec2'] = '';
}
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if (!isset($_GET['refr'])) {
$_GET['refr'] = null;
}
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($do_refresh) {
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
if ($_GET['refr']) {
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
}
if ($do_refresh) {
$autorefresh_img = html_print_image('images/header_refresh.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]);
$ignored_params['refr'] = '';
$values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
$autorefresh_additional .= '</span>';
unset ($values);
if ($_GET['refr']) {
$autorefresh_txt .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
}
$autorefresh_link_open_img =
'<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">';
$ignored_params['refr'] = '';
$values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
$autorefresh_additional .= '</span>';
unset($values);
if ($_GET['refr']) {
$autorefresh_link_open_txt =
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">';
}
else {
$autorefresh_link_open_txt = '<a>';
}
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
$autorefresh_link_close = '</a>';
}
else {
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
if ($_GET['refr']) {
$autorefresh_link_open_txt = '<a class="white autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
} else {
$autorefresh_link_open_txt = '<a>';
}
$ignored_params['refr'] = false;
$autorefresh_link_close = '</a>';
} else {
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
}
else {
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
$ignored_params['refr'] = false;
$ignored_params['refr'] = false;
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
} else {
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
$ignored_params['refr'] = false;
$table->data[0][1] = $autorefresh_link_open_img . $autorefresh_img . $autorefresh_link_close;
$table->data[0][2] = $autorefresh_link_open_txt . $autorefresh_txt . $autorefresh_link_close . $autorefresh_additional;
//======================================================
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
$table->data[0][1] = $autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close;
$table->data[0][2] = $autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional;
// ======================================================
$pandora_management = check_acl($config['id_user'], 0, 'PM');
$check_minor_release_available = false;
$pandora_management = check_acl($config['id_user'], 0, "PM");
echo '<div id="alert_messages" style="display: none"></div>';
$check_minor_release_available = db_check_minor_relase_available ();
if ($config['alert_cnt'] > 0) {
$maintenance_link = 'javascript:';
$maintenance_title = __('System alerts detected - Please fix as soon as possible');
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
if ($check_minor_release_available) {
if (users_is_admin($config['id_user'])) {
$maintenance_link_open_txt = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'" id="show_systemalert_dialog">';
$maintenance_link_open_img = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'">';
$maintenance_link_close = '</a>';
if (!$pandora_management) {
$maintenance_img = '';
} else {
$maintenance_img = $maintenance_link_open_img.html_print_image(
'images/header_yellow.png',
true,
[
'title' => __(
'You have %d warning(s)',
$config['alert_cnt']
),
'id' => 'yougotalert',
'class' => 'bot',
]
).$maintenance_link_close;
}
} else {
if (!$pandora_management) {
$maintenance_img = '';
} else {
$maintenance_img = html_print_image('images/header_ready.png', true, ['title' => __('There are not warnings'), 'id' => 'yougotalert', 'class' => 'bot']);
}
}
if($config['language'] == 'es'){
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
}
else{
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
}
}
}
echo '<div id="alert_messages" style="display: none"></div>';
$table->data[0][3] = $maintenance_img;
if ($config["alert_cnt"] > 0) {
$maintenance_link = 'javascript:';
$maintenance_title = __("System alerts detected - Please fix as soon as possible");
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
// Main help icon
if (!$config['disable_help']) {
$table->data[0][4] = '<a href="#" class="modalpopup" id="helpmodal">'.html_print_image(
'images/header_help.png',
true,
[
'title' => __('Main help'),
'id' => 'helpmodal',
'class' => 'modalpopup',
]
).'</a>';
}
$maintenance_link_open_txt =
'<a href="' . $maintenance_link . '" title="' . $maintenance_title . '" class="' . $maintenance_class . '" id="show_systemalert_dialog">';
$maintenance_link_open_img =
'<a href="' . $maintenance_link . '" title="' . $maintenance_title . '" class="' . $maintenance_class . '">';
$maintenance_link_close = '</a>';
if (!$pandora_management) {
$maintenance_img = '';
}
else {
$maintenance_img = $maintenance_link_open_img .
html_print_image("images/header_yellow.png",
true, array(
"title" => __('You have %d warning(s)',
$config["alert_cnt"]),
"id" => "yougotalert",
"class" => "bot")) . $maintenance_link_close;
}
}
else {
if (!$pandora_management) {
$maintenance_img = '';
}
else {
$maintenance_img = html_print_image ("images/header_ready.png", true, array ("title" => __('There are not warnings'), "id" => "yougotalert", "class" => "bot"));
}
}
// Logout
$table->data[0][5] = '<a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$table->data[0][5] .= html_print_image('images/header_logout.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
$table->data[0][5] .= '</a>';
$table->data[0][3] = $maintenance_img;
// User
if (is_user_admin($config['id_user']) == 1) {
$table->data[0][6] = html_print_image('images/header_user_admin.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
} else {
$table->data[0][6] = html_print_image('images/header_user.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
}
// Main help icon
if (!$config['disable_help']) {
$table->data[0][4] =
'<a href="#" class="modalpopup" id="helpmodal">' .
html_print_image("images/header_help.png", true, array(
"title" => __('Main help'),
"id" => "helpmodal",
"class" => "modalpopup")) .
'</a>';
}
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$table->data[0][6].'</a>';
// Logout
$table->data[0][5] = '<a class="white" href="' . ui_get_full_url('index.php?bye=bye') . '">';
$table->data[0][5] .= html_print_image("images/header_logout.png", true, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout')));
$table->data[0][5] .= '</a>';
$table->data[0][7] = '<a href="index.php?sec=workspace&amp;sec2=operation/users/user_edit" class="white_bold"> ('.$config['id_user'].')</a>';
// User
if (is_user_admin ($config["id_user"]) == 1)
$table->data[0][6] = html_print_image("images/header_user_admin.png" , true, array("title" => __('Edit my user'), "class" => 'bot', "alt" => 'user'));
else
$table->data[0][6] = html_print_image("images/header_user.png" , true, array("title" => __('Edit my user'), "class" => 'bot', "alt" => 'user'));
// Chat messages
$table->data[0][8] = "<span id='icon_new_messages_chat' style='display: none;'>";
$table->data[0][8] .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
$table->data[0][8] .= html_print_image('images/header_chat.png', true, ['title' => __('New chat message')]);
$table->data[0][8] .= '</a>';
$table->data[0][8] .= '</span>';
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">' . $table->data[0][6] . '</a>';
// Messages
$msg_cnt = messages_get_count($config['id_user']);
if ($msg_cnt > 0) {
echo '<div id="dialog_messages" style="display: none"></div>';
$table->data[0][7] = '<a href="index.php?sec=workspace&amp;sec2=operation/users/user_edit" class="white_bold"> (' . $config["id_user"] . ')</a>';
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="'.__('Message overview').'" id="show_messages_dialog">';
$table->data[0][9] .= html_print_image('images/header_email.png', true, ['title' => __('You have %d unread message(s)', $msg_cnt), 'id' => 'yougotmail', 'class' => 'bot', 'style' => 'width:24px;']);
$table->data[0][9] .= '</a>';
}
// Chat messages
$table->data[0][8] = "<span id='icon_new_messages_chat' style='display: none;'>";
$table->data[0][8] .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
$table->data[0][8] .= html_print_image('images/header_chat.png', true, array("title" => __('New chat message')));
$table->data[0][8] .= "</a>";
$table->data[0][8] .= "</span>";
$table->data[0]['notifications'] = notifications_print_ball();
// Messages
$msg_cnt = messages_get_count ($config["id_user"]);
if ($msg_cnt > 0) {
echo '<div id="dialog_messages" style="display: none"></div>';
html_print_table($table);
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="' . __("Message overview") . '" id="show_messages_dialog">';
$table->data[0][9] .= html_print_image ("images/header_email.png", true, array ("title" => __('You have %d unread message(s)', $msg_cnt), "id" => "yougotmail", "class" => "bot", 'style' => 'width:24px;'));
$table->data[0][9] .= '</a>';
}
unset($table);
?>
</td>
<!--
<td style="text-align:center">
<?php
echo "<a href='index.php?sec=main'>";
if (isset($config['custom_logo'])) {
echo html_print_image('images/custom_logo/'.$config['custom_logo'], true, ['height' => '60', 'width' => '139', 'alt' => 'Logo']);
}
$table->data[0]['notifications'] = notifications_print_ball();
html_print_table($table);
unset($table);
?>
</td>
<!--
<td style="text-align:center">
<?php
echo "<a href='index.php?sec=main'>";
if (isset($config["custom_logo"])) {
echo html_print_image("images/custom_logo/" . $config["custom_logo"], true, array("height" => '60', "width" => '139', "alt" => 'Logo'));
}
echo "</a>";
?>
</td>
-->
</tr>
echo '</a>';
?>
</td>
-->
</tr>
</table>
<script type="text/javascript">
/* <![CDATA[ */
/* <![CDATA[ */
<?php
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
$config_fixed_header = $config['fixed_header'];
}
?>
<?php
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
$config_fixed_header = $config['fixed_header'];
}
?>
var fixed_header = <?php echo json_encode((bool)$config_fixed_header); ?>;
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
var new_chat = <?php echo (int)$_SESSION['new_chat'];?>;
$(document).ready (function () {
<?php
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
$(document).ready (function () {
<?php
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET['refr']))) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
$new_dashboard = get_parameter('new_dashboard',0);
$new_dashboard = get_parameter('new_dashboard', 0);
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
$do_refresh = false;
}
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
$do_refresh = false;
}
if ($do_refresh) {
?>
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href");
<?php
if($select[0]['time_autorefresh']){
?>
var refresh = '<?php echo $select[0]["time_autorefresh"] ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
if ($do_refresh) {
?>
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href");
<?php
if ($select[0]['time_autorefresh']) {
?>
var refresh = '<?php echo $select[0]['time_autorefresh']; ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
<?php
}
}
?>
<?php
}
}
?>
if (fixed_header) {
$('div#head').addClass('fixed_header');
$('div#page')
.css('padding-top', $('div#head').innerHeight() + 'px')
.css('position', 'relative');
}
if (fixed_header) {
$('div#head').addClass('fixed_header');
$('div#page')
.css('padding-top', $('div#head').innerHeight() + 'px')
.css('position', 'relative');
}
check_new_chats_icon('icon_new_messages_chat');
check_new_chats_icon('icon_new_messages_chat');
/* Temporal fix to hide graphics when ui_dialog are displayed */
$("#yougotalert").click(function () {
$("#agent_access").css("display", "none");
});
$("#ui_close_dialog_titlebar").click(function () {
$("#agent_access").css("display","");
});
/* Temporal fix to hide graphics when ui_dialog are displayed */
$("#yougotalert").click(function () {
$("#agent_access").css("display", "none");
});
$("#ui_close_dialog_titlebar").click(function () {
$("#agent_access").css("display","");
});
function blinkmail(){
$("#yougotmail").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkmail);
}
function blinkalert(){
$("#yougotalert").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkalert);
}
function blinkpubli(){
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
}
<?php
if ($msg_cnt > 0) {
?>
blinkmail();
<?php
}
?>
function blinkmail(){
$("#yougotmail").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkmail);
}
function blinkalert(){
$("#yougotalert").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkalert);
}
function blinkpubli(){
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
}
<?php
if ($msg_cnt > 0) {
?>
blinkmail();
<?php
}
?>
<?php
if ($config["alert_cnt"] > 0) {
?>
blinkalert();
<?php
}
?>
blinkpubli();
<?php
if ($config['alert_cnt'] > 0) {
?>
blinkalert();
<?php
}
?>
blinkpubli();
<?php
if ($_GET["refr"]) {
?>
var refr_time = <?php echo (int) get_parameter("refr", 0); ?>;
var t = new Date();
t.setTime (t.getTime () +
parseInt(<?php echo $config["refr"] * 1000; ?>));
$("#refrcounter").countdown ({until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
href = $("a.autorefresh").attr ("href");
href = href + refr_time;
$(document).attr ("location", href);
}
});
<?php
}
?>
<?php
if ($_GET['refr']) {
?>
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
var t = new Date();
t.setTime (t.getTime () +
parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
href = $("a.autorefresh").attr ("href");
href = href + refr_time;
$(document).attr ("location", href);
}
});
<?php
}
?>
$("a.autorefresh").click (function () {
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
$("select#ref").change (function () {
href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + this.value);
});
$("a.autorefresh").click (function () {
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px');
$("select#ref").change (function () {
href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + this.value);
});
return false;
});
});
return false;
});
});
/* ]]> */
</script>

View File

@ -28,7 +28,7 @@
global $config;
require_once __DIR__.'/../functions.php';
require_once $config['homedir'].'/include/functions_db.php';
require_once $config['homedir'].'/include/functions_io.php';
require_once $config['homedir'].'/include/functions_notifications.php';
require_once $config['homedir'].'/include/functions_servers.php';
@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php';
// Enterprise includes.
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_license.php');
enterprise_include_once('extensions/cron/functions.php');
/**
* Base class to run scheduled tasks in cron extension
@ -172,12 +172,6 @@ class ConsoleSupervisor
include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php';
}
$time = get_system_time();
$scheduled_tasks = db_get_all_rows_in_table('tuser_task_scheduled');
if (!$scheduled_tasks) {
$scheduled_tasks = [];
}
// Automatic checks launched by supervisor.
$this->warn('running.');
@ -334,6 +328,13 @@ class ConsoleSupervisor
$this->checkUpdates();
/*
* Check if there're new minor updates available.
* NOTIF.UPDATEMANAGER.MINOR
*/
$this->checkMinorRelease();
if ($this->verbose === true) {
// Release the lock.
enterprise_hook('cron_supervisor_release_lock');
@ -345,12 +346,17 @@ class ConsoleSupervisor
/**
* Update targets for given notification using object targets.
*
* @param integer $notification_id Current notification.
* @param array $notification Current notification.
* @param boolean $update Only update db targets, no email.
*
* @return void
*/
public function updateTargets(int $notification_id)
{
public function updateTargets(
array $notification,
bool $update=false
) {
$notification_id = $notification['id_mensaje'];
if (is_array($this->targetUsers) === true
&& count($this->targetUsers) > 0
) {
@ -365,10 +371,18 @@ class ConsoleSupervisor
);
$insertion_string .= ',';
// Send mail.
if (isset($user['also_mail']) && $user['also_mail'] == 1) {
$this->warn('Mailing user: '.$user['id_user']."\n");
// TODO: Add sendmail sequence.
if ($update === false) {
// Send mail.
if (isset($user['also_mail']) && $user['also_mail'] == 1) {
enterprise_hook(
'send_email_user',
[
$user['id_user'],
io_safe_output($notification['mensaje']).'<br><hl><br>'.$notification['url'],
io_safe_output($notification['subject']),
]
);
}
}
}
@ -391,10 +405,19 @@ class ConsoleSupervisor
);
$insertion_string .= ',';
// Send mail.
if (isset($group['also_mail']) && $group['also_mail'] == 1) {
$this->warn('Mailing group: '.$group['id_group']."\n");
// TODO: Add sendmail sequence.
if ($update === false) {
// Send mail.
if (isset($group['also_mail']) && $group['also_mail'] == 1) {
$this->warn('Mailing group: '.$group['id_group']."\n");
enterprise_hook(
'send_email_group',
[
$group['id_group'],
io_safe_output($notification['mensaje']).'<br><hl><br>'.$notification['url'],
io_safe_output($notification['subject']),
]
);
}
}
}
@ -422,7 +445,7 @@ class ConsoleSupervisor
public function notify(
array $data,
int $source_id=0,
int $max_age=86400
int $max_age=0
) {
// Uses 'check failed' logic.
if (is_array($data) === false) {
@ -475,7 +498,7 @@ class ConsoleSupervisor
case 'NOTIF.NEWSLETTER.SUBSCRIPTION':
case 'NOTIF.UPDATEMANAGER.OPENSETUP':
case 'NOTIF.UPDATEMANAGER.UPDATE':
case 'NOTIF.UPDATEMANAGER.MINOR':
default:
// NOTIF.SERVER.STATUS.
// NOTIF.SERVER.STATUS.ID_SERVER.
@ -514,8 +537,7 @@ class ConsoleSupervisor
],
['id_mensaje' => $prev['id_mensaje']]
);
$this->updateTargets($prev['id_mensaje']);
$this->updateTargets($prev, true);
return;
}
@ -540,7 +562,7 @@ class ConsoleSupervisor
return;
}
$this->updateTargets($id);
$this->updateTargets($notification);
}
@ -2010,4 +2032,39 @@ class ConsoleSupervisor
}
/**
* Check if there're minor updates available.
*
* @return void
*/
public function checkMinorRelease()
{
global $config;
$check_minor_release_available = db_check_minor_relase_available();
if ($check_minor_release_available) {
$url = 'http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29';
if ($config['language'] == 'es') {
$url = 'http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29';
}
$this->notify(
[
'type' => 'NOTIF.UPDATEMANAGER.MINOR',
'title' => __('Minor release/s available'),
'message' => __(
'There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="%s">.About minor release update</a>.',
$url
),
'url' => $url,
]
);
} else {
$this->cleanNotifications('NOTIF.UPDATEMANAGER.MINOR');
}
}
}

View File

@ -2664,8 +2664,8 @@ function config_check()
include_once __DIR__.'/class/ConsoleSupervisor.php';
// Enterprise controlles supervisor using discovery cron task.
if (!license_free()) {
// Enterprise customers launch supervisor using discovery task.
if (license_free()) {
$supervisor = new ConsoleSupervisor(false);
$supervisor->run();
}

View File

@ -193,7 +193,7 @@ function get_notification_source_targets(int $id_source)
$i = 0;
foreach ($users as $user) {
$ret['users'][$i]['id_user'] = $user['id_user'];
$ret['users'][$i++]['also_mail'] = $also_mail;
$ret['users'][$i++]['also_mail'] = $user['also_mail'];
}
}

View File

@ -1278,3 +1278,11 @@ INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
("Official&#x20;communication", "icono_info_mr.png", 86400, 1, 1, 0),
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
--
-- Dumping data for table `tnotification_source_user`
--
INSERT INTO `tnotification_source_user`(`id_source`,`id_user`,`enabled`,`also_mail`) VALUES
((SELECT `id` FROM `tnotification_source` WHERE `description`="System&#x20;status"), "admin",1,0);