2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
* ajax.php: fixed PHP warning when the HTTP_REFERER not set. * godmode/agentes/module_manager_editor_prediction.php, include/functions_ui.php, operation/agentes/ver_agente.php, operation/agentes/stat_win.php: improved the source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8137 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5c808b7266
commit
84d628326f
|
@ -1,3 +1,11 @@
|
||||||
|
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* ajax.php: fixed PHP warning when the HTTP_REFERER not set.
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor_prediction.php,
|
||||||
|
include/functions_ui.php, operation/agentes/ver_agente.php,
|
||||||
|
operation/agentes/stat_win.php: improved the source code style.
|
||||||
|
|
||||||
2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
|
2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/alerts/alert_commands.php: fixed the ajax of
|
* godmode/alerts/alert_commands.php: fixed the ajax of
|
||||||
|
|
|
@ -74,10 +74,12 @@ if (file_exists ('./include/languages/'.$user_language.'.mo')) {
|
||||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||||
$l10n->load_tables();
|
$l10n->load_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not cool way of know if we are executing from metaconsole or normal console
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||||
if (strpos($_SERVER['HTTP_REFERER'], ENTERPRISE_DIR . '/meta/') !== false)
|
// Not cool way of know if we are executing from metaconsole or normal console
|
||||||
define ('METACONSOLE', true);
|
if (strpos($_SERVER['HTTP_REFERER'], ENTERPRISE_DIR . '/meta/') !== false)
|
||||||
|
define ('METACONSOLE', true);
|
||||||
|
}
|
||||||
session_write_close ();
|
session_write_close ();
|
||||||
|
|
||||||
if (file_exists ($page)) {
|
if (file_exists ($page)) {
|
||||||
|
|
|
@ -132,8 +132,11 @@ if($id_agente) {
|
||||||
$sql = "SELECT id_agente_modulo, nombre
|
$sql = "SELECT id_agente_modulo, nombre
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE delete_pending = 0
|
WHERE delete_pending = 0
|
||||||
AND history_data = 1 AND id_agente = " . $id_agente_clean . " AND id_agente_modulo <> " . $id_agente_modulo;
|
AND history_data = 1
|
||||||
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true);
|
AND id_agente = " . $id_agente_clean . "
|
||||||
|
AND id_agente_modulo <> " . $id_agente_modulo;
|
||||||
|
$data[1] .= html_print_select_from_sql($sql, 'prediction_module',
|
||||||
|
$prediction_module, false, __('Select Module'), 0, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
||||||
|
@ -191,9 +194,10 @@ unset ($table_advanced->data[3]);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
<?php
|
<?php
|
||||||
enterprise_hook('setup_services_synth', array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow, $ops));
|
enterprise_hook('setup_services_synth',
|
||||||
?>
|
array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow, $ops));
|
||||||
});
|
?>
|
||||||
|
});
|
||||||
</script>
|
</script>
|
|
@ -72,6 +72,7 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($numChars == 0) {
|
if ($numChars == 0) {
|
||||||
if ($return == true) {
|
if ($return == true) {
|
||||||
return $text;
|
return $text;
|
||||||
|
@ -83,12 +84,15 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
||||||
|
|
||||||
$text = io_safe_output($text);
|
$text = io_safe_output($text);
|
||||||
if (mb_strlen($text, "UTF-8") > ($numChars)) {
|
if (mb_strlen($text, "UTF-8") > ($numChars)) {
|
||||||
$half_length = intval(($numChars - 3) / 2); // '/2' because [...] is in the middle of the word.
|
// '/2' because [...] is in the middle of the word.
|
||||||
|
$half_length = intval(($numChars - 3) / 2);
|
||||||
|
|
||||||
// Depending on the strange behavior of mb_strimwidth() itself,
|
// Depending on the strange behavior of mb_strimwidth() itself,
|
||||||
// the 3rd parameter is not to be $numChars but the length of original text (just means 'large enough').
|
// the 3rd parameter is not to be $numChars but the length of
|
||||||
|
// original text (just means 'large enough').
|
||||||
$truncateText2 = mb_strimwidth($text,
|
$truncateText2 = mb_strimwidth($text,
|
||||||
(mb_strlen($text, "UTF-8") - $half_length), mb_strlen($text, "UTF-8"), "", "UTF-8" );
|
(mb_strlen($text, "UTF-8") - $half_length),
|
||||||
|
mb_strlen($text, "UTF-8"), "", "UTF-8" );
|
||||||
|
|
||||||
$truncateText = mb_strimwidth($text, 0,
|
$truncateText = mb_strimwidth($text, 0,
|
||||||
($numChars - $half_length), "", "UTF-8") . $suffix;
|
($numChars - $half_length), "", "UTF-8") . $suffix;
|
||||||
|
@ -100,10 +104,11 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
||||||
$truncateText = $truncateText;
|
$truncateText = $truncateText;
|
||||||
}
|
}
|
||||||
else if ($style !== false) {
|
else if ($style !== false) {
|
||||||
$truncateText = '<span style="' . $style . '" title="'.$text.'">'.$truncateText.'</span>';
|
$truncateText = '<span style="' . $style . '" title="' . $text . '">' .
|
||||||
|
$truncateText . '</span>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$truncateText = '<span title="'.$text.'">'.$truncateText.'</span>';
|
$truncateText = '<span title="' . $text . '">' . $truncateText . '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($showTextInAToopTip) {
|
if ($showTextInAToopTip) {
|
||||||
|
@ -111,7 +116,7 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($style !== false) {
|
if ($style !== false) {
|
||||||
$truncateText = '<span style="' . $style . '">'.$truncateText.'</span>';
|
$truncateText = '<span style="' . $style . '">' . $truncateText . '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,6 +297,7 @@ $label = base64_decode(get_parameter('label', ''));
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
|
||||||
switch ($graph_type) {
|
switch ($graph_type) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
case 'sparse':
|
case 'sparse':
|
||||||
|
|
|
@ -300,9 +300,11 @@ if (is_ajax ()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($nameModules as $nameModule) {
|
foreach ($nameModules as $nameModule) {
|
||||||
if (empty($serialized))
|
if (empty($serialized))
|
||||||
$result[io_safe_output($nameModule['nombre'])] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
|
$result[io_safe_output($nameModule['nombre'])] =
|
||||||
|
ui_print_truncate_text(
|
||||||
|
io_safe_output($nameModule['nombre']), 'module_medium', false, true);
|
||||||
else
|
else
|
||||||
$result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
|
$result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue