Merge remote-tracking branch 'origin/develop' into 1827-Graficas_TIP_eje_x_no_mantiene_ratio

This commit is contained in:
daniel 2018-06-12 15:46:41 +02:00
commit 25942907cf
39 changed files with 1811 additions and 1109 deletions

View File

@ -25,7 +25,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
$xmlTemplate = "<?xml version='1.0' encoding='UTF-8'?> $xmlTemplate = "<?xml version='1.0' encoding='UTF-8'?>
<agent_data description='' group='' os_name='%s' " . <agent_data description='' group='' os_name='%s' " .
" os_version='%s' interval='%d' version='%s' timestamp='%s' agent_name='%s' timezone_offset='%d'> " os_version='%s' interval='%d' version='%s' timestamp='%s' agent_name='%s' timezone_offset='0'>
<module> <module>
<name><![CDATA[%s]]></name> <name><![CDATA[%s]]></name>
<description><![CDATA[%s]]></description> <description><![CDATA[%s]]></description>
@ -34,20 +34,22 @@ function createXMLData($agent, $agentModule, $time, $data) {
</module> </module>
</agent_data>"; </agent_data>";
$xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), $xml = sprintf(
io_safe_output($agent['os_version']), $agent['intervalo'], $xmlTemplate,
io_safe_output($agent['agent_version']), $time, io_safe_output(get_os_name($agent['id_os'])),
io_safe_output($agent['os_version']),
$agent['intervalo'],
io_safe_output($agent['agent_version']),
$time,
io_safe_output($agent['nombre']), io_safe_output($agent['nombre']),
$agent['timezone_offset'], io_safe_output($agentModule['nombre']),
io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); io_safe_output($agentModule['descripcion']),
modules_get_type_name($agentModule['id_tipo_modulo']),
$data
if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['alias']) . '.' . strtotime($time) . '.data', $xml)) { );
return false;
} $file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
else { return (bool) @file_put_contents($file_name, $xml);
return true;
}
} }
function mainInsertData() { function mainInsertData() {
@ -61,18 +63,12 @@ function mainInsertData() {
return; return;
} }
$save = (bool)get_parameter('save', false); $save = (bool) get_parameter("save");
$id_agent = (string)get_parameter('id_agent', ''); $agent_id = (int) get_parameter("agent_id");
$agent_name = (string) get_parameter("agent_name");
foreach ($_POST as $key => $value) { $id_agent_module = (int) get_parameter("id_agent_module");
if(strpos($key,"agent_autocomplete_idagent")!== false){ $data = (string) get_parameter('data');
$id_agente = $value;
}
}
$id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
$date = (string) get_parameter('date', date(DATE_FORMAT)); $date = (string) get_parameter('date', date(DATE_FORMAT));
$time = (string) get_parameter('time', date(TIME_FORMAT)); $time = (string) get_parameter('time', date(TIME_FORMAT));
if (isset($_FILES['csv'])) { if (isset($_FILES['csv'])) {
@ -89,12 +85,11 @@ function mainInsertData() {
if ($save) { if ($save) {
if (!check_acl($config['id_user'], agents_get_agent_group(agents_get_agent_id($id_agent)), "AW")) { if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), "AW")) {
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.')); ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
} }
else { else {
$agent = db_get_row_filter('tagente', array('id_agente' => $agent_id));
$agent = db_get_row_filter('tagente', array('id_agente' => $id_agente));
$agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$done = 0; $done = 0;
@ -104,7 +99,9 @@ function mainInsertData() {
foreach ($file as $line) { foreach ($file as $line) {
$tokens = explode(';', $line); $tokens = explode(';', $line);
$result = createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1])); $utimestamp = strtotime(trim($tokens[0])) - get_fixed_offset();
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
$result = createXMLData($agent, $agentModule, $timestamp, trim($tokens[1]));
if ($result) { if ($result) {
$done++; $done++;
@ -115,7 +112,9 @@ function mainInsertData() {
} }
} }
else { else {
$result = createXMLData($agent, $agentModule, $date . ' ' . $time, $data); $utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
$result = createXMLData($agent, $agentModule, $timestamp, $data);
if ($result) { if ($result) {
$done++; $done++;
@ -159,25 +158,26 @@ function mainInsertData() {
$params = array(); $params = array();
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'id_agent'; $params['input_name'] = 'agent_name';
$params['value'] = $id_agent; $params['value'] = $agent_name;
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function'; $params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = ''; $params['javascript_code_function_select'] = '';
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent'; $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_value'] = $id_agente; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][0] = __('Module'); $table->data[1][0] = __('Module');
$modules = array (); $modules = array ();
if ($id_agente){ if ($agent_id){
$modules = agents_get_modules ($id_agente, false, array("delete_pending" => 0)); $modules = agents_get_modules ($agent_id, false, array("delete_pending" => 0));
} }
$table->data[1][1] = html_print_select ($modules, 'id_agent_module', $id_agent_module, true, $table->data[1][1] = html_print_select ($modules, 'id_agent_module', $id_agent_module, true,
__('Select'), 0, true, false, true, '', ($id_agente === '')); __('Select'), 0, true, false, true, '', empty($agent_id));
$table->data[2][0] = __('Data'); $table->data[2][0] = __('Data');
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true); $table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date'); $table->data[3][0] = __('Date');

View File

@ -228,19 +228,19 @@ if (!empty($all_data)) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp $sql = sprintf ("SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
FROM tsesion FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ") WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]); AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp $sql = sprintf ("SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp
FROM tsesion FROM tsesion
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ") WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ")
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]); AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
break; break;
case "oracle": case "oracle":
$sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp $sql = sprintf ("SELECT id_usuario, accion, ip_origen, descripcion, utimestamp
FROM tsesion FROM tsesion
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ") WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ")
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]); AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
@ -270,7 +270,8 @@ if (!empty($all_data)) {
$data[0] = '<strong>' . $session_id_usuario . '</strong>'; $data[0] = '<strong>' . $session_id_usuario . '</strong>';
$data[1] = ui_print_session_action_icon ($session['accion'], true) . ' ' . $session['accion']; $data[1] = ui_print_session_action_icon ($session['accion'], true) . ' ' . $session['accion'];
$data[2] = ui_print_help_tip($session['fecha'], true) . human_time_comparation($session['utimestamp'], 'tiny'); $data[2] = ui_print_help_tip(date($config["date_format"], $session['utimestamp']), true)
. human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen; $data[3] = $session_ip_origen;
$description = str_replace(array(',', ', '), ', ', $session['descripcion']); $description = str_replace(array(',', ', '), ', ', $session['descripcion']);
$data[4] = '<div >' . io_safe_output($description) . '</div>'; $data[4] = '<div >' . io_safe_output($description) . '</div>';
@ -292,4 +293,4 @@ if (!empty($all_data)) {
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -232,7 +232,8 @@ foreach ($result as $row) {
$data = array(); $data = array();
$data[0] = $row["id_usuario"]; $data[0] = $row["id_usuario"];
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"]; $data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip($row["fecha"], true) . ui_print_timestamp($row["utimestamp"], true); $data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"]; $data[3] = $row["ip_origen"];
$data[4] = $row["descripcion"]; $data[4] = $row["descripcion"];

View File

@ -60,15 +60,19 @@ $type_downtime = (string) get_parameter('type_downtime', 'quiet');
$type_execution = (string) get_parameter('type_execution', 'once'); $type_execution = (string) get_parameter('type_execution', 'once');
$type_periodicity = (string) get_parameter('type_periodicity', 'weekly'); $type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
$once_date_from = (string) get_parameter ('once_date_from', date(DATE_FORMAT)); $utimestamp = get_system_time();
$once_time_from = (string) get_parameter ('once_time_from', date(TIME_FORMAT)); // Fake utimestamp to retrieve the string date of the system
$once_date_to = (string) get_parameter ('once_date_to', date(DATE_FORMAT)); $system_time = $utimestamp - get_fixed_offset();
$once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT, time() + SECONDS_1HOUR));
$once_date_from = (string) get_parameter ('once_date_from', date(DATE_FORMAT, $utimestamp));
$once_time_from = (string) get_parameter ('once_time_from', date(TIME_FORMAT, $utimestamp));
$once_date_to = (string) get_parameter ('once_date_to', date(DATE_FORMAT, $utimestamp));
$once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT, $utimestamp + SECONDS_1HOUR));
$periodically_day_from = (int) get_parameter ('periodically_day_from', 1); $periodically_day_from = (int) get_parameter ('periodically_day_from', 1);
$periodically_day_to = (int) get_parameter ('periodically_day_to', 31); $periodically_day_to = (int) get_parameter ('periodically_day_to', 31);
$periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT)); $periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT, $system_time));
$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT, time() + SECONDS_1HOUR)); $periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT, $system_time + SECONDS_1HOUR));
$monday = (bool) get_parameter ('monday'); $monday = (bool) get_parameter ('monday');
$tuesday = (bool) get_parameter ('tuesday'); $tuesday = (bool) get_parameter ('tuesday');
@ -542,6 +546,7 @@ $table->data[5][1] = "
</div> </div>
<div id='periodically_time' style='display: none;'> <div id='periodically_time' style='display: none;'>
<table> <table>
<tr><td>" . ui_get_using_system_timezone_warning() . "</td></tr>
<tr> <tr>
<td>" . __('Type Periodicity:') . "&nbsp;". <td>" . __('Type Periodicity:') . "&nbsp;".
html_print_select(array( html_print_select(array(
@ -1226,7 +1231,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
// Warning message about the problems caused updating a past planned downtime // Warning message about the problems caused updating a past planned downtime
var type_execution = "<?php echo $type_execution; ?>"; var type_execution = "<?php echo $type_execution; ?>";
var datetime_from = <?php echo json_encode(strtotime($once_date_from . ' ' . $once_time_from)); ?>; var datetime_from = <?php echo json_encode(strtotime($once_date_from . ' ' . $once_time_from)); ?>;
var datetime_now = <?php echo json_encode(strtotime(date(DATE_FORMAT). ' ' . date(TIME_FORMAT))); ?>; var datetime_now = <?php echo json_encode($utimestamp); ?>;
var create = <?php echo json_encode($create); ?>; var create = <?php echo json_encode($create); ?>;
if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) { if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) {
$("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) { $("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) {

View File

@ -782,6 +782,10 @@ else {
} }
} }
if ($step == 2) {
echo ui_get_using_system_timezone_warning();
}
/* If it's the last step it will redirect to template lists */ /* If it's the last step it will redirect to template lists */
if ($step >= LAST_STEP) { if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'">';

View File

@ -167,8 +167,7 @@ $stackeds = array(
CUSTOM_GRAPH_GAUGE => __('Gauge'), CUSTOM_GRAPH_GAUGE => __('Gauge'),
CUSTOM_GRAPH_HBARS => __('Horizontal bars'), CUSTOM_GRAPH_HBARS => __('Horizontal bars'),
CUSTOM_GRAPH_VBARS => __('Vertical bars'), CUSTOM_GRAPH_VBARS => __('Vertical bars'),
CUSTOM_GRAPH_PIE => __('Pie'), CUSTOM_GRAPH_PIE => __('Pie')
CUSTOM_GRAPH_THERMOMETER => __('Thermometer')
); );
html_print_select ($stackeds, 'stacked', $stacked); html_print_select ($stackeds, 'stacked', $stacked);

View File

@ -202,7 +202,7 @@ switch ($action) {
$dyn_height = $style['dyn_height']; $dyn_height = $style['dyn_height'];
$type = $item['type']; $type = $item['type'];
$name = $item['name']; $name = $item['name'];
switch ($type) { switch ($type) {
case 'event_report_log': case 'event_report_log':
$period = $item['period']; $period = $item['period'];
@ -839,6 +839,7 @@ You can of course remove the warnings, that's why we include the source and do n
<?php echo __('Working time');?> <?php echo __('Working time');?>
</td> </td>
<td> <td>
<?php echo ui_get_using_system_timezone_warning(); ?>
<table border="0"> <table border="0">
<tr> <tr>
<td> <td>

View File

@ -87,7 +87,7 @@ foreach ($servers as $server) {
//Status //Status
$data[1] = ui_print_status_image (STATUS_SERVER_OK, '', true); $data[1] = ui_print_status_image (STATUS_SERVER_OK, '', true);
if (($server['status'] == 0) || (($date - strtotime($server['keepalive'])) > ($server['server_keepalive'])*2)) { if (($server['status'] == 0) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive'])*2)) {
$data[1] = ui_print_status_image (STATUS_SERVER_DOWN, '', true); $data[1] = ui_print_status_image (STATUS_SERVER_DOWN, '', true);
} }

View File

@ -36,10 +36,11 @@ if (isset ($_POST["create"])) { // If create
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
$modal = get_parameter ("modal"); $modal = get_parameter ("modal");
$expire = get_parameter ("expire"); $expire = get_parameter ("expire");
$expire_date = get_parameter ("expire_date"); $expire_date = get_parameter("expire_date");
$expire_date = date('Y-m-d', strtotime($expire_date)); $expire_time = get_parameter("expire_time");
$expire_time = get_parameter ("expire_time"); // Change the user's timezone to the system's timezone
$expire_timestamp = "$expire_date $expire_time"; $expire_timestamp = strtotime("$expire_date $expire_time") - get_fixed_offset();
$expire_timestamp = date("Y-m-d H:i:s", $expire_timestamp);
$values = array('subject' => $subject, $values = array('subject' => $subject,
'text' => $text, 'text' => $text,
@ -64,10 +65,11 @@ if (isset ($_POST["update"])) { // if update
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
$modal = get_parameter ("modal"); $modal = get_parameter ("modal");
$expire = get_parameter ("expire"); $expire = get_parameter ("expire");
$expire_date = get_parameter ("expire_date"); $expire_date = get_parameter("expire_date");
$expire_date = date('Y-m-d', strtotime($expire_date)); $expire_time = get_parameter("expire_time");
$expire_time = get_parameter ("expire_time"); // Change the user's timezone to the system's timezone
$expire_timestamp = "$expire_date $expire_time"; $expire_timestamp = strtotime("$expire_date $expire_time") - get_fixed_offset();
$expire_timestamp = date("Y-m-d H:i:s", $expire_timestamp);
//NOW() column exists in any table and always displays the current date and time, so let's get the value from a row in a table which can't be deleted. //NOW() column exists in any table and always displays the current date and time, so let's get the value from a row in a table which can't be deleted.
//This way we prevent getting no value for this variable //This way we prevent getting no value for this variable
@ -117,10 +119,10 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
if ($expire) { if ($expire) {
$expire_timestamp = $result["expire_timestamp"]; $expire_timestamp = $result["expire_timestamp"];
$expire_utimestamp = strtotime($expire_timestamp); $expire_utimestamp = time_w_fixed_tz($expire_timestamp);
} }
else { else {
$expire_utimestamp = time() + SECONDS_1WEEK; $expire_utimestamp = get_system_time() + SECONDS_1WEEK;
} }
$expire_date = date('Y/m/d', $expire_utimestamp); $expire_date = date('Y/m/d', $expire_utimestamp);
@ -138,8 +140,8 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
$id_group = 0; $id_group = 0;
$modal = 0; $modal = 0;
$expire = 0; $expire = 0;
$expire_date = date('Y/m/d', time() + SECONDS_1WEEK); $expire_date = date('Y/m/d', get_system_time() + SECONDS_1WEEK);
$expire_time = date('H:i:s', time()); $expire_time = date('H:i:s', get_system_time());
} }
// Create news // Create news
@ -246,10 +248,10 @@ else {
} }
echo "<td class='$tdcolor'>".$row["author"]."</b></td>"; echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
$utimestamp = strtotime($row["timestamp"]); $utimestamp = time_w_fixed_tz($row["timestamp"]);
echo "<td class='$tdcolor'>" . date($config['date_format'], strtotime($row["timestamp"])) . "</b></td>"; echo "<td class='$tdcolor'>" . date($config['date_format'], $utimestamp) . "</b></td>";
if ($row["expire"]) { if ($row["expire"]) {
$expire_utimestamp = strtotime($row["expire_timestamp"]); $expire_utimestamp = time_w_fixed_tz($row["expire_timestamp"]);
$expire_in_secs = $expire_utimestamp - $utimestamp; $expire_in_secs = $expire_utimestamp - $utimestamp;
if( $expire_in_secs <= 0) { if( $expire_in_secs <= 0) {

View File

@ -126,6 +126,7 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['comments'] = ''; $user_info['comments'] = '';
$user_info['is_admin'] = 0; $user_info['is_admin'] = 0;
$user_info['language'] = 'default'; $user_info['language'] = 'default';
$user_info['timezone'] = '';
$user_info["not_login"] = false; $user_info["not_login"] = false;
$user_info["strict_acl"] = false; $user_info["strict_acl"] = false;
$user_info["session_time"] = 0; $user_info["session_time"] = 0;
@ -164,6 +165,7 @@ if ($create_user) {
$values['comments'] = (string) get_parameter ('comments'); $values['comments'] = (string) get_parameter ('comments');
$values['is_admin'] = (int) get_parameter ('is_admin', 0); $values['is_admin'] = (int) get_parameter ('is_admin', 0);
$values['language'] = get_parameter ('language', 'default'); $values['language'] = get_parameter ('language', 'default');
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_event_filter'] = (int) get_parameter('default_event_filter');
$dashboard = get_parameter('dashboard', ''); $dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', ''); $visual_console = get_parameter('visual_console', '');
@ -222,7 +224,7 @@ if ($create_user) {
} }
else { else {
$info = $info =
'{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"'; '{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] .'","Timezone":"' . $values['timezone'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"';
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$info .= ',"Skin":"' . $values['id_skin'].'"}'; $info .= ',"Skin":"' . $values['id_skin'].'"}';
@ -287,6 +289,7 @@ if ($update_user) {
$values['comments'] = (string) get_parameter ('comments'); $values['comments'] = (string) get_parameter ('comments');
$values['is_admin'] = get_parameter ('is_admin', 0 ); $values['is_admin'] = get_parameter ('is_admin', 0 );
$values['language'] = (string) get_parameter ('language'); $values['language'] = (string) get_parameter ('language');
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_event_filter'] = (int) get_parameter('default_event_filter');
$dashboard = get_parameter('dashboard', ''); $dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', ''); $visual_console = get_parameter('visual_console', '');
@ -376,6 +379,7 @@ if ($update_user) {
"Comments":"' . $values['comments'] . '", "Comments":"' . $values['comments'] . '",
"Is_admin":"' . $values['is_admin'] . '", "Is_admin":"' . $values['is_admin'] . '",
"Language":"' . $values['language'] . '", "Language":"' . $values['language'] . '",
"Timezone":"' . $values['timezone'] . '",
"Block size":"' . $values['block_size'] . '", "Block size":"' . $values['block_size'] . '",
"Flash Chats":"' . $values['flash_chart'] . '", "Flash Chats":"' . $values['flash_chart'] . '",
"Section":"' . $values['section'].'"'; "Section":"' . $values['section'].'"';
@ -522,6 +526,9 @@ $table->data[2][0] = __('Language');
$table->data[2][1] = html_print_select_from_sql ('SELECT id_language, name FROM tlanguage', $table->data[2][1] = html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
'language', $user_info['language'], '', __('Default'), 'default', true); 'language', $user_info['language'], '', __('Default'), 'default', true);
$table->data[3][0] = __('Timezone');
$table->data[3][1] = html_print_timezone_select("timezone", $user_info["timezone"]);
if ($config['user_can_update_password']) { if ($config['user_can_update_password']) {
$table->data[4][0] = __('Password'); $table->data[4][0] = __('Password');
$table->data[4][1] = html_print_input_text_extended ('password_new', '', '', '', $table->data[4][1] = html_print_input_text_extended ('password_new', '', '', '',

View File

@ -118,13 +118,14 @@ if ($get_module_detail) {
$conexion = false; $conexion = false;
} }
$selection_mode = get_parameter('selection_mode', 'fromnow');
$date_from = (string) get_parameter ('date_from', date ('Y-m-j'));
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
$date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
$time_to = (string) get_parameter ('time_to', date ('h:iA'));
$freesearch = (string) get_parameter ('freesearch', ''); $freesearch = (string) get_parameter ('freesearch', '');
$free_checkbox = (bool) get_parameter ('free_checkbox', false); $free_checkbox = (bool) get_parameter ('free_checkbox', false);
$selection_mode = get_parameter('selection_mode', 'fromnow');
$utimestamp = get_system_time();
$date_from = (string) get_parameter ('date_from', date(DATE_FORMAT, $utimestamp - SECONDS_1DAY));
$time_from = (string) get_parameter ('time_from', date(TIME_FORMAT, $utimestamp - SECONDS_1DAY));
$date_to = (string) get_parameter ('date_to', date(DATE_FORMAT, $utimestamp));
$time_to = (string) get_parameter ('time_to', date(TIME_FORMAT, $utimestamp));
$formtable->width = '98%'; $formtable->width = '98%';
$formtable->class = "databox"; $formtable->class = "databox";

View File

@ -133,8 +133,6 @@ if ($correctLogin) {
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"'); $id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
html_debug($id_os);
if($id_os == 100){ if($id_os == 100){
returnError('not_allowed_operation_cluster', $returnType); returnError('not_allowed_operation_cluster', $returnType);
return false; return false;

View File

@ -444,7 +444,6 @@ define("CUSTOM_GRAPH_LINE", 2);
define("CUSTOM_GRAPH_STACKED_LINE", 3); define("CUSTOM_GRAPH_STACKED_LINE", 3);
define("CUSTOM_GRAPH_BULLET_CHART", 4); define("CUSTOM_GRAPH_BULLET_CHART", 4);
define("CUSTOM_GRAPH_GAUGE", 5); define("CUSTOM_GRAPH_GAUGE", 5);
define("CUSTOM_GRAPH_THERMOMETER", 10);
define("CUSTOM_GRAPH_HBARS", 6); define("CUSTOM_GRAPH_HBARS", 6);
define("CUSTOM_GRAPH_VBARS", 7); define("CUSTOM_GRAPH_VBARS", 7);
define("CUSTOM_GRAPH_PIE", 8); define("CUSTOM_GRAPH_PIE", 8);

View File

@ -313,7 +313,7 @@ function human_time_comparation ($timestamp, $units = 'large') {
global $config; global $config;
if (!is_numeric ($timestamp)) { if (!is_numeric ($timestamp)) {
$timestamp = strtotime ($timestamp); $timestamp = time_w_fixed_tz($timestamp);
} }
$seconds = get_system_time () - $timestamp; $seconds = get_system_time () - $timestamp;
@ -2371,7 +2371,11 @@ function print_audit_csv ($data) {
__('Source IP') . ';' . __('Source IP') . ';' .
__('Comments') ."\n"; __('Comments') ."\n";
foreach ($data as $line) { foreach ($data as $line) {
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n"; echo io_safe_output($line['id_usuario']) . ';'
. io_safe_output($line['accion']) . ';'
. date($config["date_format"], $line['utimestamp']) . ';'
. $line['ip_origen'] . ';'
. io_safe_output($line['descripcion']). "\n";
} }
exit; exit;
@ -2824,6 +2828,62 @@ function validate_address($address){
return true; return true;
} }
/**
* Used to get the offset in seconds to the UTC date.
*
* @param string Timezone identifier.
*/
function get_utc_offset ($timezone) {
if (empty($timezone)) return 0;
$dtz = new DateTimeZone($timezone);
$dt = new DateTime("now", $dtz);
return $dtz->getOffset($dt);
}
function get_system_utc_offset () {
global $config;
return get_utc_offset($config["timezone"]);
}
function get_current_utc_offset () {
return get_utc_offset(date_default_timezone_get());
}
function get_fixed_offset () {
return get_current_utc_offset() - get_system_utc_offset();
}
/**
* Used to transform the dates without timezone information (like '2018/05/23 10:10:10')
* to a unix timestamp compatible with the user custom timezone.
*
* @param string Date without timezone information.
* @param number Offset between the date timezone and the user's default timezone.
*/
function time_w_fixed_tz ($date, $timezone_offset = null) {
if ($timezone_offset === null) $timezone_offset = get_fixed_offset();
return strtotime($date) + $timezone_offset;
}
/**
* Used to transform the dates without timezone information (like '2018/05/23 10:10:10')
* to a date compatible with the user custom timezone.
*
* @param string Date without timezone information.
* @param string Date format.
* @param number Offset between the date timezone and the user's default timezone.
*/
function date_w_fixed_tz ($date, $format = null, $timezone_offset = null) {
global $config;
if ($format === null) $format = $config["date_format"];
return date($format, time_w_fixed_tz($date, $timezone_offset));
}
function color_graph_array(){ function color_graph_array(){
global $config; global $config;
@ -3218,4 +3278,5 @@ function get_copyright_notice () {
} }
return $stored_name; return $stored_name;
} }
?> ?>

View File

@ -697,20 +697,13 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
} }
function agents_get_next_contact($idAgent, $maxModules = false) { function agents_get_next_contact($idAgent, $maxModules = false) {
$agent = db_get_row_sql("SELECT * $agent = db_get_row("tagente", "id_agente", $idAgent);
FROM tagente $last_contact = time_w_fixed_tz($agent["ultimo_contacto"]);
WHERE id_agente = " . $idAgent); $difference = time() - $last_contact;
return ($agent["intervalo"] > 0 && $last_contact > 0)
$difference = get_system_time () - strtotime ($agent["ultimo_contacto"]); ? round ($difference / ($agent["intervalo"] / 100))
: 0;
if ($agent["intervalo"] > 0 && strtotime($agent["ultimo_contacto"]) > 0) {
return round ($difference / ($agent["intervalo"] / 100));
}
else {
return 0;
}
} }
/** /**
@ -1454,7 +1447,7 @@ function agents_get_interval ($id_agent) {
function agents_get_interval_status ($agent) { function agents_get_interval_status ($agent) {
$return = ''; $return = '';
$last_time = strtotime ($agent["ultimo_contacto"]); $last_time = time_w_fixed_tz($agent["ultimo_contacto"]);
$now = time (); $now = time ();
$diferencia = $now - $last_time; $diferencia = $now - $last_time;
$time = ui_print_timestamp ($last_time, true, array('style' => 'font-size:6.5pt')); $time = ui_print_timestamp ($last_time, true, array('style' => 'font-size:6.5pt'));
@ -2670,7 +2663,10 @@ function agents_generate_name ($alias, $address = '') {
*/ */
function agents_get_all_groups_agent ($id_agent, $group = false) { function agents_get_all_groups_agent ($id_agent, $group = false) {
// Get the group if is not defined // Get the group if is not defined
if ($group === false) $group = agents_get_group_agents($id_agent); if ($group === false) $group = agents_get_agent_group($id_agent);
// If cannot retrieve the group, it means that agent does not exist
if (!$group) return array();
$secondary_groups = enterprise_hook('agents_get_secondary_groups', array($id_agent)); $secondary_groups = enterprise_hook('agents_get_secondary_groups', array($id_agent));
@ -2682,4 +2678,42 @@ function agents_get_all_groups_agent ($id_agent, $group = false) {
return $secondary_groups['plain']; return $secondary_groups['plain'];
} }
/**
* @brief Get the total agents with a filter and an access bit
*
* @param Array filter agentes array. It is the same that agents_get_agents function
* @param string ACL bit
*
* @return int Total agents retrieved with the filter
*/
function agents_count_agents_filter ($filter = array(), $access = "AR") {
$total_agents = agents_get_agents(
array ('id_group' => $id_group),
array ('COUNT(DISTINCT id_agente) as total'),
$access
);
return ($total_agents !== false)
? $total_agents[0]['total']
: 0;
}
/**
* @brief Check if an agent is accessible by the user
*
* @param int Id agent
* @param string ACL access bit
*
* @return True if user has access, false if user has not permissions and
* null if id agent does not exist
*/
function agents_check_access_agent ($id_agent, $access = "AR") {
global $config;
if (users_access_to_agent($id_agent, $access)) return true;
// If agent exist return false
if (agents_check_agent_exists($id_agent)) return false;
// Return null otherwise
return null;
}
?> ?>

View File

@ -1603,10 +1603,10 @@ function get_alert_type ($id_type) {
*/ */
function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) { function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time();
} }
$datelimit = $date - $period; $datelimit = $date - $period;
@ -1635,10 +1635,10 @@ function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) { function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time();
} }
$datelimit = $date - $period; $datelimit = $date - $period;

File diff suppressed because it is too large Load Diff

View File

@ -1275,7 +1275,7 @@ function events_get_agent ($id_agent, $period, $date = 0,
global $config; global $config;
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time ();
@ -1922,7 +1922,7 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
if (strpos($target, '_event_date_') !== false) { if (strpos($target, '_event_date_') !== false) {
$target = str_replace( $target = str_replace(
'_event_date_', '_event_date_',
date ($config["date_format"], strtotime($event["timestamp"])), date ($config["date_format"], $event["utimestamp"]),
$target $target
); );
} }
@ -2155,12 +2155,12 @@ function events_page_details ($event, $server = "") {
$data = array(); $data = array();
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last contact').'</div>'; $data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last contact').'</div>';
$data[1] = $agent["ultimo_contacto"] == "1970-01-01 00:00:00" ? '<i>'.__('N/A').'</i>' : $agent["ultimo_contacto"]; $data[1] = $agent["ultimo_contacto"] == "1970-01-01 00:00:00" ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent["ultimo_contacto"]);
$table_details->data[] = $data; $table_details->data[] = $data;
$data = array(); $data = array();
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last remote contact').'</div>'; $data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last remote contact').'</div>';
$data[1] = $agent["ultimo_contacto_remoto"] == "1970-01-01 00:00:00" ? '<i>'.__('N/A').'</i>' : $agent["ultimo_contacto_remoto"]; $data[1] = $agent["ultimo_contacto_remoto"] == "1970-01-01 00:00:00" ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent["ultimo_contacto_remoto"]);
$table_details->data[] = $data; $table_details->data[] = $data;
$data = array(); $data = array();
@ -2469,11 +2469,12 @@ function events_page_general ($event) {
$data = array(); $data = array();
$data[0] = __('Timestamp'); $data[0] = __('Timestamp');
if ($group_rep == 1 && $event["event_rep"] > 1) { if ($group_rep == 1 && $event["event_rep"] > 1) {
$data[1] = __('First event').': '.date ($config["date_format"], $event['timestamp_first']).'<br>'.__('Last event').': '.date ($config["date_format"], $event['timestamp_last']); $data[1] = __('First event').': '.date ($config["date_format"], $event['timestamp_first']).'<br>'.__('Last event').': '.date ($config["date_format"], $event['timestamp_last']);
} }
else { else {
$data[1] = date ($config["date_format"], strtotime($event["timestamp"])); $data[1] = date ($config["date_format"], $event["utimestamp"]);
} }
$table_general->data[] = $data; $table_general->data[] = $data;
@ -2717,7 +2718,7 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
//date //date
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time ();
@ -2872,7 +2873,7 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
//date //date
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time ();
@ -3017,7 +3018,7 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
} }
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time ();
@ -3159,7 +3160,7 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
//date //date
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = time_w_fixed_tz($date);
} }
if (empty ($date)) { if (empty ($date)) {
$date = get_system_time (); $date = get_system_time ();

View File

@ -1968,95 +1968,6 @@ function graphic_combined_module (
); );
} }
break;
case CUSTOM_GRAPH_THERMOMETER:
$datelimit = $params['date'] - $params['period'];
$i = 0;
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id ($module_item['server']);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta)
$module = $module_item['module'];
else
$module = $module_item;
$temp[$module] = modules_get_agentmodule($module);
$query_last_value = sprintf('
SELECT datos
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp < %d
ORDER BY utimestamp DESC',
$module, $params['date']);
$temp_data = db_get_value_sql($query_last_value);
if ( $temp_data ) {
if (is_numeric($temp_data))
$value = $temp_data;
else
$value = count($value);
}
else {
$value = false;
}
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
$temp[$module]['value'] = $value;
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
if ($temp[$module]['unit'] == '%') {
$temp[$module]['min'] = 0;
$temp[$module]['max'] = 100;
}
else {
$min = $temp[$module]['min'];
if ($temp[$module]['max'] == 0)
$max = reporting_get_agentmodule_data_max($module,$params['period'],$params['date']);
else
$max = $temp[$module]['max'];
$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
}
$temp[$module]['gauge'] = uniqid('gauge_');
if ($config['metaconsole']) {
// Automatic custom graph from the report template in metaconsole
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
}
$i++;
$color = color_graph_array();
$graph_values = $temp;
return stacked_thermometers(
$flash_charts,
$graph_values,
$width,
$height,
$color,
$module_name_list,
$long_index,
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
"",
"",
$water_mark,
$config['fontpath'],
$fixed_font_size,
"",
$ttl,
$homeurl,
$background_color
);
}
break; break;
case CUSTOM_GRAPH_PIE: case CUSTOM_GRAPH_PIE:
$total_modules = 0; $total_modules = 0;

View File

@ -2336,4 +2336,130 @@ function html_print_autocomplete_modules($name = 'module',
echo $output; echo $output;
} }
} }
/**
* @param string Select form name
* @param string Current selected value
*
* @return string HTML code
*/
function html_print_timezone_select ($name, $selected = "") {
$timezones = array(
"Pacific/Midway" => "(GMT-11:00) " . __("Midway Island"),
"US/Samoa" => "(GMT-11:00) " . __("Samoa"),
"US/Hawaii" => "(GMT-10:00) " . __("Hawaii"),
"US/Alaska" => "(GMT-09:00) " . __("Alaska"),
"US/Pacific" => "(GMT-08:00) " . __("Pacific Time (US & Canada)"),
"America/Tijuana" => "(GMT-08:00) " . __("Tijuana"),
"US/Arizona" => "(GMT-07:00) " . __("Arizona"),
"US/Mountain" => "(GMT-07:00) " . __("Mountain Time (US & Canada)"),
"America/Chihuahua" => "(GMT-07:00) " . __("Chihuahua"),
"America/Mazatlan" => "(GMT-07:00) " . __("Mazatlan"),
"America/Mexico_City" => "(GMT-06:00) " . __("Mexico City"),
"America/Monterrey" => "(GMT-06:00) " . __("Monterrey"),
"Canada/Saskatchewan" => "(GMT-06:00) " . __("Saskatchewan"),
"US/Central" => "(GMT-06:00) " . __("Central Time (US & Canada)"),
"US/Eastern" => "(GMT-05:00) " . __("Eastern Time (US & Canada)"),
"US/East-Indiana" => "(GMT-05:00) " . __("Indiana (East)"),
"America/Bogota" => "(GMT-05:00) " . __("Bogota"),
"America/Lima" => "(GMT-05:00) " . __("Lima"),
"America/Caracas" => "(GMT-04:30) " . __("Caracas"),
"Canada/Atlantic" => "(GMT-04:00) " . __("Atlantic Time (Canada)"),
"America/La_Paz" => "(GMT-04:00) " . __("La Paz"),
"America/Santiago" => "(GMT-04:00) " . __("Santiago"),
"Canada/Newfoundland" => "(GMT-03:30) " . __("Newfoundland"),
"America/Buenos_Aires" => "(GMT-03:00) " . __("Buenos Aires"),
"Greenland'" => "(GMT-03:00) " . __("Greenland"),
"Atlantic/Stanley" => "(GMT-02:00) " . __("Stanley"),
"Atlantic/Azores" => "(GMT-01:00) " . __("Azores"),
"Atlantic/Cape_Verde" => "(GMT-01:00) " . __("Cape Verde Is."),
"Africa/Casablanca" => "(GMT+00:00) " . __("Casablanca"),
"Europe/Dublin" => "(GMT+00:00) " . __("Dublin"),
"Europe/Lisbon" => "(GMT+00:00) " . __("Lisbon"),
"Europe/London" => "(GMT+00:00) " . __("London"),
"Africa/Monrovia" => "(GMT+00:00) " . __("Monrovia"),
"Europe/Amsterdam" => "(GMT+01:00) " . __("Amsterdam"),
"Europe/Belgrade" => "(GMT+01:00) " . __("Belgrade"),
"Europe/Berlin" => "(GMT+01:00) " . __("Berlin"),
"Europe/Bratislava" => "(GMT+01:00) " . __("Bratislava"),
"Europe/Brussels" => "(GMT+01:00) " . __("Brussels"),
"Europe/Budapest" => "(GMT+01:00) " . __("Budapest"),
"Europe/Copenhagen" => "(GMT+01:00) " . __("Copenhagen"),
"Europe/Ljubljana" => "(GMT+01:00) " . __("Ljubljana"),
"Europe/Madrid" => "(GMT+01:00) " . __("Madrid"),
"Europe/Paris" => "(GMT+01:00) " . __("Paris"),
"Europe/Prague" => "(GMT+01:00) " . __("Prague"),
"Europe/Rome" => "(GMT+01:00) " . __("Rome"),
"Europe/Sarajevo" => "(GMT+01:00) " . __("Sarajevo"),
"Europe/Skopje" => "(GMT+01:00) " . __("Skopje"),
"Europe/Stockholm" => "(GMT+01:00) " . __("Stockholm"),
"Europe/Vienna" => "(GMT+01:00) " . __("Vienna"),
"Europe/Warsaw" => "(GMT+01:00) " . __("Warsaw"),
"Europe/Zagreb" => "(GMT+01:00) " . __("Zagreb"),
"Europe/Athens" => "(GMT+02:00) " . __("Athens"),
"Europe/Bucharest" => "(GMT+02:00) " . __("Bucharest"),
"Africa/Cairo" => "(GMT+02:00) " . __("Cairo"),
"Africa/Harare" => "(GMT+02:00) " . __("Harare"),
"Europe/Helsinki" => "(GMT+02:00) " . __("Helsinki"),
"Europe/Istanbul" => "(GMT+02:00) " . __("Istanbul"),
"Asia/Jerusalem" => "(GMT+02:00) " . __("Jerusalem"),
"Europe/Kiev" => "(GMT+02:00) " . __("Kyiv"),
"Europe/Minsk" => "(GMT+02:00) " . __("Minsk"),
"Europe/Riga" => "(GMT+02:00) " . __("Riga"),
"Europe/Sofia" => "(GMT+02:00) " . __("Sofia"),
"Europe/Tallinn" => "(GMT+02:00) " . __("Tallinn"),
"Europe/Vilnius" => "(GMT+02:00) " . __("Vilnius"),
"Asia/Baghdad" => "(GMT+03:00) " . __("Baghdad"),
"Asia/Kuwait" => "(GMT+03:00) " . __("Kuwait"),
"Africa/Nairobi" => "(GMT+03:00) " . __("Nairobi"),
"Asia/Riyadh" => "(GMT+03:00) " . __("Riyadh"),
"Europe/Moscow" => "(GMT+03:00) " . __("Moscow"),
"Asia/Tehran" => "(GMT+03:30) " . __("Tehran"),
"Asia/Baku" => "(GMT+04:00) " . __("Baku"),
"Europe/Volgograd" => "(GMT+04:00) " . __("Volgograd"),
"Asia/Muscat" => "(GMT+04:00) " . __("Muscat"),
"Asia/Tbilisi" => "(GMT+04:00) " . __("Tbilisi"),
"Asia/Yerevan" => "(GMT+04:00) " . __("Yerevan"),
"Asia/Kabul" => "(GMT+04:30) " . __("Kabul"),
"Asia/Karachi" => "(GMT+05:00) " . __("Karachi"),
"Asia/Tashkent" => "(GMT+05:00) " . __("Tashkent"),
"Asia/Kolkata" => "(GMT+05:30) " . __("Kolkata"),
"Asia/Kathmandu" => "(GMT+05:45) " . __("Kathmandu"),
"Asia/Yekaterinburg" => "(GMT+06:00) " . __("Ekaterinburg"),
"Asia/Almaty" => "(GMT+06:00) " . __("Almaty"),
"Asia/Dhaka" => "(GMT+06:00) " . __("Dhaka"),
"Asia/Novosibirsk" => "(GMT+07:00) " . __("Novosibirsk"),
"Asia/Bangkok" => "(GMT+07:00) " . __("Bangkok"),
"Asia/Jakarta" => "(GMT+07:00) " . __("Jakarta"),
"Asia/Krasnoyarsk" => "(GMT+08:00) " . __("Krasnoyarsk"),
"Asia/Chongqing" => "(GMT+08:00) " . __("Chongqing"),
"Asia/Hong_Kong" => "(GMT+08:00) " . __("Hong Kong"),
"Asia/Kuala_Lumpur" => "(GMT+08:00) " . __("Kuala Lumpur"),
"Australia/Perth" => "(GMT+08:00) " . __("Perth"),
"Asia/Singapore" => "(GMT+08:00) " . __("Singapore"),
"Asia/Taipei" => "(GMT+08:00) " . __("Taipei"),
"Asia/Ulaanbaatar" => "(GMT+08:00) " . __("Ulaan Bataar"),
"Asia/Urumqi" => "(GMT+08:00) " . __("Urumqi"),
"Asia/Irkutsk" => "(GMT+09:00) " . __("Irkutsk"),
"Asia/Seoul" => "(GMT+09:00) " . __("Seoul"),
"Asia/Tokyo" => "(GMT+09:00) " . __("Tokyo"),
"Australia/Adelaide" => "(GMT+09:30) " . __("Adelaide"),
"Australia/Darwin" => "(GMT+09:30) " . __("Darwin"),
"Asia/Yakutsk" => "(GMT+10:00) " . __("Yakutsk"),
"Australia/Brisbane" => "(GMT+10:00) " . __("Brisbane"),
"Australia/Canberra" => "(GMT+10:00) " . __("Canberra"),
"Pacific/Guam" => "(GMT+10:00) " . __("Guam"),
"Australia/Hobart" => "(GMT+10:00) " . __("Hobart"),
"Australia/Melbourne" => "(GMT+10:00) " . __("Melbourne"),
"Pacific/Port_Moresby" => "(GMT+10:00) " . __("Port Moresby"),
"Australia/Sydney" => "(GMT+10:00) " . __("Sydney"),
"Asia/Vladivostok" => "(GMT+11:00) " . __("Vladivostok"),
"Asia/Magadan" => "(GMT+12:00) " . __("Magadan"),
"Pacific/Auckland" => "(GMT+12:00) " . __("Auckland"),
"Pacific/Fiji" => "(GMT+12:00) " . __("Fiji"),
);
return html_print_select($timezones, $name, $selected, "", __("None"), "", true, false, false);
}
?> ?>

View File

@ -752,10 +752,20 @@ function planned_downtimes_items ($filter) {
$downtime_agents = db_get_all_rows_filter('tplanned_downtime_agents',$filter, 'id_agent,id_downtime,all_modules'); $downtime_agents = db_get_all_rows_filter('tplanned_downtime_agents',$filter, 'id_agent,id_downtime,all_modules');
$downtime = db_get_row_filter('tplanned_downtime',array('id' => $filter['id_downtime']), 'type_downtime'); $downtime = db_get_row_filter('tplanned_downtime',array('id' => $filter['id_downtime']), 'type_downtime');
$return = array(
'id_agents' => array(),
'id_downtime' => $filter['id_downtime'],
'all_modules' => 0,
'modules' => array(),
);
foreach ( $downtime_agents as $key => $data ) { foreach ( $downtime_agents as $key => $data ) {
$return = $data; // Do not add the agent information if no permissions
$modules = array(); if (!agents_check_access_agent($data['id_agent'], "AR")) continue;
$return['id_agents'][] = $data['id_agent'];
$return['id_downtime'] = $data['id_downtime'];
$return['all_modules'] = $data['all_modules'];
if ($downtime['type_downtime'] === 'quiet') { if ($downtime['type_downtime'] === 'quiet') {
if (!$data['all_modules']) { if (!$data['all_modules']) {
$second_filter = array( $second_filter = array(
@ -765,14 +775,18 @@ function planned_downtimes_items ($filter) {
$downtime_modules = db_get_all_rows_filter('tplanned_downtime_modules',$second_filter, 'id_agent_module'); $downtime_modules = db_get_all_rows_filter('tplanned_downtime_modules',$second_filter, 'id_agent_module');
if ( $downtime_modules ) { if ( $downtime_modules ) {
foreach ( $downtime_modules as $data2 ) { foreach ( $downtime_modules as $data2 ) {
$modules[] = $data2['id_agent_module']; $return['modules'][$data2['id_agent_module']] = $data2['id_agent_module'];
} }
$return['modules'] = implode(',', $modules);
} }
} }
} }
} }
if (empty($return['id_agents'])) return false;
// Implode agents and modules
$return['id_agents'] = implode(',', $return['id_agents']);
$return['modules'] = implode(',', $return['modules']);
return $return; return $return;
} }

View File

@ -446,7 +446,7 @@ function ui_print_timestamp ($unixtime, $return = false, $option = array ()) {
} }
if (!is_numeric ($unixtime)) { if (!is_numeric ($unixtime)) {
$unixtime = strtotime ($unixtime); $unixtime = time_w_fixed_tz($unixtime);
} }
//prominent_time is either timestamp or comparation //prominent_time is either timestamp or comparation
@ -3916,6 +3916,20 @@ function ui_get_snapshot_link($params, $only_params = false) {
return "winopeng_var('" . implode("', '", $link_parts) . "')"; return "winopeng_var('" . implode("', '", $link_parts) . "')";
} }
function ui_get_using_system_timezone_warning ($tag = "h3", $return = true) {
global $config;
$user_offset = (-get_fixed_offset() / 60) / 60;
$message = sprintf(
__("These controls are using the timezone of the system (%s) instead of yours (%s). The difference with your time zone in hours is %s."),
$config["timezone"],
date_default_timezone_get(),
$user_offset > 0 ? "+" . $user_offset : $user_offset
);
return ui_print_info_message($message, '', $return, $tag);
}
/** /**
* Get the custom docs logo * Get the custom docs logo
* *

View File

@ -271,33 +271,6 @@ function stacked_bullet_chart($chart_data, $width, $height,
} }
function stacked_thermometers($flash_chart, $chart_data, $width, $height,
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
include_once('functions_d3.php');
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
return d3_thermometers(
$chart_data,
$width,
$height,
$color,
$legend,
$homeurl,
$unit,
$font,
$font_size + 2,
$no_data_image
);
}
function stacked_gauge($chart_data, $width, $height, function stacked_gauge($chart_data, $width, $height,
$color, $legend, $no_data_image, $font = '', $font_size = '', $color, $legend, $no_data_image, $font = '', $font_size = '',
$unit = '', $homeurl = '') { $unit = '', $homeurl = '') {

View File

@ -285,31 +285,6 @@ function d3_gauges($chart_data, $width, $height, $color, $legend,
return $output; return $output;
} }
function d3_thermometers($chart_data, $width, $height, $color, $legend,
$homeurl, $unit, $font, $font_size, $no_data_image) {
global $config;
foreach ($chart_data as $key => $value) {
$chart_data[$key]['agent_name'] = agents_get_alias($chart_data[$key]['id_agente']);
$chart_data[$key]['label'] = io_safe_output($chart_data[$key]['label']);
}
if (is_array($chart_data))
$data = json_encode($chart_data);
$output = include_javascript_d3(true);
$count = 0;
$output .= "<div id='thermometers_div' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
$output .= "<script language=\"javascript\" type=\"text/javascript\">
var data = $data;
createthermometers(data, '$width', '$height','$font_size','$no_data_image','$font');
</script>";
return $output;
}
function ux_console_phases_donut ($phases, $id, $return = false) { function ux_console_phases_donut ($phases, $id, $return = false) {
global $config; global $config;

View File

@ -1060,229 +1060,6 @@ function createGauges(data, width, height, font_size, no_data_image, font) {
} }
} }
function createthermometers(data, width, height, font_size, no_data_image, font) {
for (var variable in data) {
module_data = data[variable];
}
// var svg = d3.select('.databox,.filters td')
var svg = d3.select('#thermometers_div')
.append("svg")
.attr("width", 250)
.attr("height", 400);
var rect = svg.append("rect")
.attr("x", 50)
.attr("y", 50)
.attr("width", 150)
.attr("height", 330)
.attr("fill", "black")
.attr("stroke-width", 5)
.attr("stroke", "rgb(37,133,177)")
.attr("rx", "10")
.attr("ry", "10")
.attr("fill", "rgb(235,235,235)");
var circle = svg.append("circle")
.attr("cx", 130)
.attr("cy", 280)
.attr("r", 12)
.attr("height", 300)
.attr("fill", "rgb(74,185,197)");
var progress_back = svg.append('rect')
.attr('fill', 'rgb(51,51,53)')
.attr('height', 200)
.attr('width', 12)
.attr('x', 123)
.attr('y', 70);
var defs = svg.append("defs");
var gradient = defs.append("linearGradient")
.attr("id", "svgGradient")
.attr("x1", "0%")
.attr("x2", "0%")
.attr("y1", "100%")
.attr("y2", "0%");
gradient.append("stop")
.attr('class', 'start')
.attr("offset", "0%")
.attr("stop-color", "rgb(74,185,197)");
if(parseFloat(module_data.value) >= parseFloat(module_data.min_warning) && parseFloat(module_data.value) < parseFloat(module_data.min_critical)){
gradient.append("stop")
.attr('class', 'end')
.attr("offset", "100%")
.attr("stop-color", "yellow");
}
else if((module_data.min_critical != 0 && module_data.max_critical != 0) && parseFloat(module_data.value) >= parseFloat(module_data.min_critical) && (parseFloat(module_data.value) <= parseFloat(module_data.max_critical) || parseFloat(module_data.max_critical) == 0)){
gradient.append("stop")
.attr('class', 'end')
.attr("offset", "100%")
.attr("stop-color", "red");
}
else{
gradient.append("stop")
.attr('class', 'end')
.attr("offset", "100%")
.attr("stop-color", "rgb(130,185,46)");
}
var progress_front = svg.append('rect')
.attr('fill', 'red')
.attr('height', 0)
.attr('width', 12)
.attr('x', 123)
.attr('y', 270)
.attr("fill", "url(#svgGradient)");
if(module_data.value.toString().indexOf('.') != -1){
if(Math.trunc(module_data.value).toString().length > 1){
module_data.value = Math.trunc(module_data.value);
}
else {
module_data.value = parseFloat(module_data.value).toFixed(2);
}
}
if(module_data.value >= 1000){
module_data.value_label = Math.trunc(module_data.value/1000);
var text = svg.append("text")
.attr("x", 100)
.attr("y", 320)
.style("font-size", "1.5em")
.text(module_data.value_label+"k"+" ["+module_data.unit+"]");
}
else{
var text = svg.append("text")
.attr("x", 100)
.attr("y", 320)
.style("font-size", "1.5em")
.text(module_data.value+" ["+module_data.unit+"]");
}
agent_text = module_data.agent_name;
if(agent_text.length > 12){
agent_text = agent_text.substring(0, 10)+"...";
}
var text = svg.append("text")
.attr("x", 65)
.attr("y", 370)
.style("font-size", "1.5em")
.text(agent_text);
label_text = module_data.label;
if(label_text.length > 12){
label_text = label_text.substring(0, 10)+"...";
}
var text = svg.append("text")
.attr("x", 65)
.attr("y", 350)
.style("font-size", "1.5em")
.text(label_text);
var temp_sum = module_data.max-module_data.min;
var div_sum = (temp_sum/10);
var max_temp = module_data.max;
var min_temp = module_data.min;
var y = 75;
var count = 0;
var startPercent = 0;
var endPercent = module_data.value * 200 / max_temp;
var step = endPercent / 20;
while (max_temp >= min_temp) {
if(count != 9){
if(max_temp.toString().indexOf('.') != -1){
if(Math.trunc(max_temp).toString().length > 1){
max_temp = Math.trunc(max_temp);
}
else {
max_temp = parseFloat(max_temp).toFixed(2);
}
}
if(max_temp >= 1000){
max_temp_label = Math.trunc(max_temp/1000);
var text = svg.append("text")
.attr("x", 160)
.attr("y", y)
.style("font-size", "1.2em")
.text(max_temp_label+'k');
}
else{
var text = svg.append("text")
.attr("x", 160)
.attr("y", y)
.style("font-size", "1.2em")
.text(max_temp);
}
var line = svg.append("line")
.attr("x1", 142)
.attr("y1", y-4)
.attr("x2", 153)
.attr("y2", y-4)
.attr("stroke", "black")
.style("font-size", "1.2em")
.text(max_temp);
y += 20;
max_temp = max_temp-div_sum;
}
if(count==10){
max_temp = module_data.min;
}
count++;
}
function updateProgress(bar_progress) {
var bar_progress = Number(bar_progress);
progress_front.attr('height', (bar_progress));
progress_front.attr('y', (270-bar_progress));
}
var bar_progress = startPercent;
(function loops() {
updateProgress(bar_progress);
if (bar_progress < endPercent) {
bar_progress += step;
setTimeout(loops, 30);
}
else{
delete data[module_data['id_agente_modulo']];
if(Object.keys(data).length > 0){
createthermometers(data, width, height, font_size, no_data_image, font)
}
}
})();
}
function Gauge(placeholderName, configuration, font) function Gauge(placeholderName, configuration, font)
{ {

View File

@ -52,6 +52,8 @@ class User {
$system->setSessionBase('id_usuario', $this->user); $system->setSessionBase('id_usuario', $this->user);
$system->setSession('user', $this); $system->setSession('user', $this);
config_user_set_custom_config();
} }
} }

View File

@ -232,7 +232,7 @@ class Agents {
private function getListAgents($page = 0, $ajax = false) { private function getListAgents($page = 0, $ajax = false) {
$system = System::getInstance(); $system = System::getInstance();
$total = 0; $total = 0;
$agents = array(); $agents = array();
@ -351,8 +351,10 @@ class Agents {
'<span class="show_collapside" style="vertical-align: 0%; display: none; font-weight: bolder;">' . __('Modules') . ' </span>' . '<span class="show_collapside" style="vertical-align: 0%; display: none; font-weight: bolder;">' . __('Modules') . ' </span>' .
'<span class="agents_tiny_stats">' . reporting_tiny_stats($agent, true, 'agent', '&nbsp;') . ' </span>'; '<span class="agents_tiny_stats">' . reporting_tiny_stats($agent, true, 'agent', '&nbsp;') . ' </span>';
$last_time = strtotime ($agent["ultimo_contacto"]); $last_time = time_w_fixed_tz($agent["ultimo_contacto"]);
$now = time (); html_debug(date('r', $last_time), true);
html_debug(get_current_utc_offset(), true);
$now = get_system_time();
$diferencia = $now - $last_time; $diferencia = $now - $last_time;
$time = ui_print_timestamp ($last_time, true, array('style' => 'font-size: 12px; margin-left: 20px;', 'units' => 'tiny')); $time = ui_print_timestamp ($last_time, true, array('style' => 'font-size: 12px; margin-left: 20px;', 'units' => 'tiny'));
$style = ''; $style = '';

View File

@ -162,7 +162,7 @@ class Events {
$event['evento'] = io_safe_output($event['evento']); $event['evento'] = io_safe_output($event['evento']);
$event['clean_tags'] = events_clean_tags($event['tags']); $event['clean_tags'] = events_clean_tags($event['tags']);
$event["timestamp"] = date($system->getConfig("date_format"), strtotime($event["timestamp"])); $event["timestamp"] = date($system->getConfig("date_format"), $event["utimestamp"]);
if (empty($event["owner_user"])) { if (empty($event["owner_user"])) {
$event["owner_user"] = '<i>' . __('N/A') . '</i>'; $event["owner_user"] = '<i>' . __('N/A') . '</i>';
} }

View File

@ -473,16 +473,16 @@ if ($strict_user) {
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true); $agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
} }
else { else {
$total_agents = agents_get_agents(array ( $total_agents = agents_count_agents_filter(
'disabled' => 0, array (
'id_grupo' => $groups, 'disabled' => 0,
'search' => $search_sql, 'id_grupo' => $groups,
'search_custom' => $search_sql_custom, 'search' => $search_sql,
'status' => $status), 'search_custom' => $search_sql_custom,
array ('COUNT(DISTINCT id_agente) as total'), $access, false); 'status' => $status
$total_agents = isset ($total_agents[0]['total']) ? ), $access
$total_agents[0]['total'] : 0; );
$agents = agents_get_agents(array ( $agents = agents_get_agents(array (
'order' => 'nombre ' . $order_collation . ' ASC', 'order' => 'nombre ' . $order_collation . ' ASC',
'id_grupo' => $groups, 'id_grupo' => $groups,

View File

@ -239,7 +239,7 @@ if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
$data[1] .= __('Never'); $data[1] .= __('Never');
} }
else { else {
$data[1] .= $agent["ultimo_contacto_remoto"]; $data[1] .= date_w_fixed_tz($agent["ultimo_contacto_remoto"]);
} }
$table_contact->data[] = $data; $table_contact->data[] = $data;

View File

@ -71,13 +71,16 @@ if (!empty ($export_btn) && !empty ($module)) {
$sql_cache = array ('saved' => array()); $sql_cache = array ('saved' => array());
//Convert start time and end time to unix timestamps // Convert start time and end time to unix timestamps.
$start = strtotime ($start_date . " " . $start_time); // The date/time will have the user's timezone,
$end = strtotime ($end_date . " " . $end_time); // so we need to change it to the system's timezone.
$fixed_offset = get_fixed_offset();
$start = strtotime ($start_date . " " . $start_time) - $fixed_offset;
$end = strtotime ($end_date . " " . $end_time) - $fixed_offset;
$period = $end - $start; $period = $end - $start;
$data = array (); $data = array ();
//If time is negative or zero, don't process - it's invalid // If time is negative or zero, don't process - it's invalid
if ($start < 1 || $end < 1) { if ($start < 1 || $end < 1) {
ui_print_error_message (__('Invalid time specified')); ui_print_error_message (__('Invalid time specified'));
return; return;
@ -168,12 +171,16 @@ if (!empty ($export_btn) && !empty ($module)) {
$output .= $module['data']; $output .= $module['data'];
$output .= $divider; $output .= $divider;
switch($export_type) { switch($export_type) {
case "data": case "data":
$output .= date("Y-m-d G:i:s", $module['utimestamp']); // Change from the system's timezone to the user's timezone
break; $output .= date("Y-m-d G:i:s", $module['utimestamp'] + $fixed_offset);
case "avg": break;
$output .= date ("Y-m-d G:i:s", $work_start) . ' - ' . date ("Y-m-d G:i:s", $work_end); case "avg":
break; // Change from the system's timezone to the user's timezone
$output .= date ("Y-m-d G:i:s", $work_start + $fixed_offset)
. ' - '
. date ("Y-m-d G:i:s", $work_end + $fixed_offset);
break;
} }
$output .= $rowend; $output .= $rowend;
} }

View File

@ -33,7 +33,9 @@ ui_require_javascript_file('openlayers.pandora');
/* Get the parameters */ /* Get the parameters */
$period = (int)get_parameter ("period", SECONDS_1DAY); $period = (int)get_parameter ("period", SECONDS_1DAY);
$agentId = (int)get_parameter('id_agente'); $agentId = (int)get_parameter('id_agente');
$id_agente = $agentId;
$agent_name = agents_get_name($id_agente); $agent_name = agents_get_name($id_agente);
$agent_alias = agents_get_alias($id_agente);
$agentData = gis_get_data_last_position_agent($id_agente); $agentData = gis_get_data_last_position_agent($id_agente);
//Avoid the agents with characters that fails the div. //Avoid the agents with characters that fails the div.
@ -206,7 +208,7 @@ if ($result !== false) {
__("Manual placement")); __("Manual placement"));
$table->class = 'position_data_table'; $table->class = 'position_data_table';
$table->id = $agent_name.'_position_data_table'; $table->id = $agent_name.'_position_data_table';
$table->title = $agent_name_original . " " . __("positional data"); $table->title = $agent_alias . " " . __("positional data");
$table->titlestyle = "background-color:#799E48;"; $table->titlestyle = "background-color:#799E48;";
html_print_table($table); unset($table); html_print_table($table); unset($table);

View File

@ -209,27 +209,24 @@ if (($date_from == '') && ($date_to == '')) {
} }
} }
else { else {
if ($date_from != '') { // Some of this values will have the user's timezone,
if($time_from != '') { // so we need to reverse it to the system's timezone
$filter_resume['time_from'] = $date_from . " " . $time_from; // before using it into the db
$udate_from = strtotime($date_from . " " . $time_from); $fixed_offset = get_fixed_offset();
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
} else { if (!empty($date_from)) {
$filter_resume['time_from'] = $date_from; if (empty($time_from)) $time_from = "00:00:00";
$udate_from = strtotime($date_from . " 00:00:00");
$sql_post .= " AND (utimestamp >= " . $udate_from . ")"; $utimestamp_from = strtotime($date_from . " " . $time_from) - $fixed_offset;
} $filter_resume['time_from'] = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp_from);
$sql_post .= " AND (utimestamp >= " . $utimestamp_from . ")";
} }
if ($date_to != '') { if (!empty($date_to)) {
if($time_to != '') { if (empty($time_to)) $time_to = "23:59:59";
$filter_resume['time_to'] = $date_to . " " . $time_to;
$udate_to = strtotime($date_to . " " . $time_to); $utimestamp_to = strtotime($date_to . " " . $time_to) - $fixed_offset;
$sql_post .= " AND (utimestamp <= " . $udate_to . ")"; $filter_resume['time_to'] = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp_to);
} else { $sql_post .= " AND (utimestamp <= " . $utimestamp_to . ")";
$filter_resume['time_to'] = $date_to;
$udate_to = strtotime($date_to . " 23:59:59");
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
}
} }
} }

View File

@ -101,7 +101,23 @@ $now = date ("Y-m-d");
Header ("Content-type: text/txt"); Header ("Content-type: text/txt");
header ('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"'); header ('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
echo "timestamp, agent, group, event, status, user, event_type, severity, id"; echo "timestamp";
echo $config["csv_divider"];
echo "agent";
echo $config["csv_divider"];
echo "group";
echo $config["csv_divider"];
echo "event";
echo $config["csv_divider"];
echo "status";
echo $config["csv_divider"];
echo "user";
echo $config["csv_divider"];
echo "event_type";
echo $config["csv_divider"];
echo "severity";
echo $config["csv_divider"];
echo "id";
echo chr (13); echo chr (13);
$new = true; $new = true;
@ -113,22 +129,22 @@ while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
(!check_acl($config["id_user"], 0, "PM") && $event["event_type"] == 'system')) (!check_acl($config["id_user"], 0, "PM") && $event["event_type"] == 'system'))
continue; continue;
echo $event["timestamp"]; echo date($config["date_format"], $event["utimestamp"]);
echo ","; echo $config["csv_divider"];
echo io_safe_output($alias); echo io_safe_output($alias);
echo ","; echo $config["csv_divider"];
echo io_safe_output(groups_get_name($event["id_grupo"])); echo io_safe_output(groups_get_name($event["id_grupo"]));
echo ","; echo $config["csv_divider"];
echo io_safe_output($event["evento"]); echo io_safe_output($event["evento"]);
echo ","; echo $config["csv_divider"];
echo io_safe_output($event["estado"]); echo io_safe_output($event["estado"]);
echo ","; echo $config["csv_divider"];
echo io_safe_output($event["id_usuario"]); echo io_safe_output($event["id_usuario"]);
echo ","; echo $config["csv_divider"];
echo io_safe_output($event["event_type"]); echo io_safe_output($event["event_type"]);
echo ","; echo $config["csv_divider"];
echo $event["criticity"]; echo $event["criticity"];
echo ","; echo $config["csv_divider"];
echo $event["id_evento"]; echo $event["id_evento"];
echo chr (13); echo chr (13);
} }

View File

@ -325,7 +325,7 @@ switch ($opt) {
$row[] = __('Never'); $row[] = __('Never');
} }
else { else {
$row[] = $agent["ultimo_contacto"]; $row[] = date_w_fixed_tz($agent["ultimo_contacto"]);
} }
$table->data[] = $row; $table->data[] = $row;
@ -336,7 +336,7 @@ switch ($opt) {
$row[] = __('Never'); $row[] = __('Never');
} }
else { else {
$row[] = $agent["ultimo_contacto_remoto"]; $row[] = date_w_fixed_tz($agent["ultimo_contacto_remoto"]);
} }
$table->data[] = $row; $table->data[] = $row;

View File

@ -41,8 +41,8 @@ if (isset ($_GET["id"])) {
// Get values // Get values
$titulo = $row["titulo"]; $titulo = $row["titulo"];
$texto = $row["descripcion"]; $texto = $row["descripcion"];
$inicio = strtotime ($row["inicio"]); $inicio = time_w_fixed_tz($row["inicio"]);
$actualizacion = strtotime ($row["actualizacion"]); $actualizacion = time_w_fixed_tz($row["actualizacion"]);
$estado = $row["estado"]; $estado = $row["estado"];
$prioridad = $row["prioridad"]; $prioridad = $row["prioridad"];
$origen = $row["origen"]; $origen = $row["origen"];

View File

@ -124,12 +124,6 @@ if ($view_graph) {
$height = $graph["height"]; $height = $graph["height"];
} }
if ($stacked == CUSTOM_GRAPH_THERMOMETER ){
// Use the defined graph height, that's why
// the user can setup graph height.
$height = $graph["height"];
}
$name = $graph["name"]; $name = $graph["name"];
if (($graph["private"]==1) && ($graph["id_user"] != $id_user)) { if (($graph["private"]==1) && ($graph["id_user"] != $id_user)) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
@ -265,7 +259,6 @@ if ($view_graph) {
$stackeds[CUSTOM_GRAPH_HBARS] = __('Horizontal Bars'); $stackeds[CUSTOM_GRAPH_HBARS] = __('Horizontal Bars');
$stackeds[CUSTOM_GRAPH_VBARS] = __('Vertical Bars'); $stackeds[CUSTOM_GRAPH_VBARS] = __('Vertical Bars');
$stackeds[CUSTOM_GRAPH_PIE] = __('Pie'); $stackeds[CUSTOM_GRAPH_PIE] = __('Pie');
$stackeds[CUSTOM_GRAPH_THERMOMETER] = __('Thermometer');
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false); html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
echo "</td>"; echo "</td>";

View File

@ -111,8 +111,8 @@ else {
$cellName .= "</em>"; $cellName .= "</em>";
} }
$last_time = strtotime ($agent["ultimo_contacto"]); $last_time = time_w_fixed_tz($agent["ultimo_contacto"]);
$now = time (); $now = get_system_time();
$diferencia = $now - $last_time; $diferencia = $now - $last_time;
$time = ui_print_timestamp ($last_time, true); $time = ui_print_timestamp ($last_time, true);
$time_style = $time; $time_style = $time;

View File

@ -76,6 +76,7 @@ if (isset ($_GET["modified"]) && !$view_mode) {
$upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]); $upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]);
$upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]); $upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]);
$upd_info["language"] = get_parameter_post ("language", $user_info["language"]); $upd_info["language"] = get_parameter_post ("language", $user_info["language"]);
$upd_info["timezone"] = get_parameter_post ("timezone", "");
$upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]); $upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]);
$upd_info["id_filter"] = get_parameter ("event_filter",NULL); $upd_info["id_filter"] = get_parameter ("event_filter",NULL);
$upd_info["block_size"] = get_parameter ("block_size", $config["block_size"]); $upd_info["block_size"] = get_parameter ("block_size", $config["block_size"]);
@ -271,8 +272,10 @@ else
$usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user']; $id_usr = $config['id_user'];
$data = array();
if (!$meta) { if (!$meta) {
$data = array();
$data[0] = '<span style="width:50%;float:left;">'.__('Home screen'). ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true).'</span>'; $data[0] = '<span style="width:50%;float:left;">'.__('Home screen'). ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true).'</span>';
$values = array ( $values = array (
'Default' =>__('Default'), 'Default' =>__('Default'),
@ -326,10 +329,18 @@ if (!$meta) {
$data[1] .= $jump . '<span style="width:20%;float:left;">'. skins_print_select($id_usr,'skin', $user_info['id_skin'], '', __('None'), 0, true).'</span>'; $data[1] .= $jump . '<span style="width:20%;float:left;">'. skins_print_select($id_usr,'skin', $user_info['id_skin'], '', __('None'), 0, true).'</span>';
} }
} }
$table->rowclass[] = '';
$table->rowstyle[] = 'font-weight: bold;';
$table->data[] = $data;
} }
else {
$data[0] = "";
$data[1] = "";
}
$data[2] = '<span style="width:30%;float:left;">'.__('Timezone').'</span>';
$data[2] .= $jump . html_print_timezone_select("timezone", $user_info["timezone"]);
$table->rowclass[] = '';
$table->rowstyle[] = 'font-weight: bold;';
$table->data[] = $data;
// Double auth // Double auth
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);