Merge branch 'ent-6864-guardia-10968-graficas-por-mail' into 'develop'

Pandora sendmail control write all data in socket

See merge request artica/pandorafms!3831
This commit is contained in:
Daniel Rodriguez 2021-02-12 15:30:44 +01:00
commit 51e7a6f593
2 changed files with 70 additions and 55 deletions

View File

@ -5296,6 +5296,7 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
} else {
$groups = users_get_groups($config['id_user'], 'LM', false);
}
if ($groups[$id_group] === null) {
returnError(
'error_create_alert_template',
@ -5428,12 +5429,14 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3)
} else {
$groups = users_get_groups($config['id_user'], 'LM', false);
}
$id_group_org = $result_template['id_group'];
if ($other['data'][27] === null) {
$id_group_new = $id_group_org;
} else {
$id_group_new = $other['data'][27];
}
if ($groups[$id_group_org] === null || $groups[$id_group_new] === null) {
returnError(
'error_create_alert_template',
@ -5573,6 +5576,7 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3)
} else {
$groups = users_get_groups($config['id_user'], 'LM', false);
}
$id_group = $result_template['id_group'];
if ($groups[$id_group] === null) {
returnError('forbidden', 'string');
@ -13939,7 +13943,8 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
'image_treshold' => $graph_threshold,
];
$graph_html = grafico_modulo_sparse($params);
// Format MIME RFC 2045 (line break 76 chars).
$graph_html = chunk_split(grafico_modulo_sparse($params));
if ($other['data'][1]) {
header('Content-type: text/html');

View File

@ -219,7 +219,17 @@ sub sendmail {
}
my @sockets = $Sel->can_write($mailcfg{'timeout'});
return 0 if (!@sockets);
syswrite($sockets[0], $$data) || return 0;
eval {
local $SIG{__DIE__};
# Split log data in chunks if case write is
my $data_sent = 0;
while ($data_sent < length($$data)) {
$data_sent += syswrite($sockets[0], $$data, length($$data) - $data_sent, $data_sent) || die $!;
}
};
if ($@) {
print STDERR "[sendmail] error: $!\n";
}
}
1;
}