2012-08-17 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_api.php: fixed the error messages althought you
	have event data.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6875 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-08-17 11:39:25 +00:00
parent cb962963b4
commit 2694f6bd73
21 changed files with 463 additions and 281 deletions

View File

@ -1,15 +1,31 @@
2012-08-16 Vanessa Gil <vanessa.gil@artica.es>
2012-08-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: fixed the error messages althought you
have event data.
* pandoradb.oracle.sql
pandoradb.postgreSQL.sql
pandoradb.sql
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Changed
type 'subnet' and 'field1' to trecon_task table.
* godmode/servers/manage_recontask_form.php: Added help tip:
several networks to recon task.
2012-08-16 Miguel de Dios <miguel.dedios@artica.es>
* extensions/plugin_registration.php, extensions/insert_data.php,
operation/users/user_edit.php, operation/events/events_list.php,
operation/events/events.php, operation/events/export_csv.php,
operation/incidents/incident_detail.php,
operation/visual_console/render_view.php, extras/pandora_diag.php,
mobile/operation/agents/view_agents.php,
godmode/servers/manage_recontask.php,
godmode/reporting/visual_console_builder.wizard.php,
include/functions_api.php: cleaned source code style.
* godmode/setup/setup_visuals.php, operation/gis_maps/ajax.php,
operation/gis_maps/index.php, operation/gis_maps/render_view.php,
include/functions_config.php, include/functions_gis.php,
include/javascript/openlayers.pandora.js: added the feature to
hidden the names of agents in the map, and when it is set the
default icon in the setup and the agent haven't the icon, then this
is show in the map. Some code from the files "functions_config.php"
and "setup_visuals.php" are modifications of Sancho Lerena from the
branch 4.0.
MERGED FROM BRANCH PANDORA 4.0
2012-08-16 Sergio Martin <sergio.martin@artica.es>

View File

@ -191,7 +191,10 @@ function mainInsertData() {
page: "operation/agentes/exportdata",
"search_agents_2": 1,
"q": term,
id_group: function() { return $("#id_group").val(); }};
id_group: function() {
return $("#id_group").val();
}
};
jQuery.ajax ({
data: data_params,

View File

@ -89,9 +89,9 @@ function pluginreg_extension_main () {
unlink ($config["attachment_store"] . "/plugin_definition.ini");
return;
}
// Verify if a plugin with the same name is already registered
$sql0 = "SELECT COUNT(*) FROM tplugin WHERE name = '" . io_safe_input ($ini_array["plugin_definition"]["name"]) . "'";
$result = db_get_sql ($sql0);
@ -99,9 +99,9 @@ function pluginreg_extension_main () {
if ($result> 0) {
echo "<h2 class=error>".__("Plugin already registered. Aborting!")."</h2>";
unlink ($config["attachment_store"] . "/plugin_definition.ini");
return;;
return;
}
$values = array(
'name' => io_safe_input ($ini_array["plugin_definition"]["name"]),
'description' => io_safe_input ($ini_array["plugin_definition"]["description"]),

View File

@ -52,7 +52,7 @@ if (!isset($argc))
if ($console_mode == 1) {
echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n";
if ($argc == 1 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
echo "\nThis command line script gives information about Pandora FMS database.
This program only can be executed from console, and need a parameter, the
@ -76,9 +76,9 @@ full path to Pandora FMS 'config.php' file.
else {
if (file_exists("../include/config.php"))
include "../include/config.php";
global $config;
// Not from console, this is a web session
if ((!isset($config["id_user"])) OR (!check_acl ($config["id_user"], 0, "PM"))) {
echo "<h2>You don't have privileges to use diagnostic tool</h2>";
@ -121,43 +121,90 @@ render_info ("tsesion");
switch ($config["dbtype"]) {
case "mysql":
render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';", "Update Key");
render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'", "Current Update #");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'customer_key';", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'current_update'", "Current Update #");
break;
case "postgresql":
render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",db_get_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT \"value\"
FROM tconfig WHERE \"token\" = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';", "Update Key");
render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'", "Current Update #");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'customer_key';", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'current_update'", "Current Update #");
break;
case "oracle":
render_info_data ("SELECT value FROM tconfig WHERE token = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT value FROM tconfig WHERE token = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT value FROM tconfig WHERE token = 'enterprise_installed'", "Enterprise installed");
render_row (db_get_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"), "PandoraDB Last run");
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'enterprise_installed'", "Enterprise installed");
render_row (db_get_sql ("SELECT value
FROM tconfig
WHERE token = 'db_maintance'"), "PandoraDB Last run");
render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'customer_key'", "Update Key");
render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'current_update'", "Current Update #");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'customer_key'", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'keygen_path'", "Keygen path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'current_update'", "Current Update #");
break;
}
if ($console_mode == 0) {
echo "</table>";
}
?>
?>

View File

@ -124,7 +124,7 @@ $table->data["all_3"][0] = __('Agents');
$table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true),
'id_agents[]', 0, false, '', '', true, true);
$table->data["all_3"][2] = ' <span style="vertical-align: top;">' . __('Modules') . '</span>';
$table->data["all_3"][2] = ' <span style="vertical-align: top;">' . __('Modules') . '</span>';
$table->data["all_3"][3] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);

View File

@ -276,7 +276,7 @@ if ($result !== false) {
// PORTS
if ($row["id_recon_script"] == 0) {
$data[7] = substr($row["recon_ports"],0,15);
$data[7] = substr($row["recon_ports"],0,15);
}
else {
$data[7] = "-";

View File

@ -37,6 +37,7 @@ enterprise_include ('godmode/setup/setup_visuals.php');
*/
require_once ('include/functions_themes.php');
require_once ('include/functions_gis.php');
// Header
ui_print_page_header (__('Visual configuration'), "", false, "", true);
@ -139,9 +140,47 @@ $table->data[20][0] = __('Item title size text') . ui_print_help_tip(__('When th
$table->data[20][1] = html_print_input_text ('item_title_size_text', $config["item_title_size_text"], '', 3, 3, true);
$table->data[21][0] = __('GIS Labels') . ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true);
$table->data[21][1] = __('Yes').'&nbsp;'.html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).'&nbsp;&nbsp;';
$table->data[21][1] .= __('No').'&nbsp;'.html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true);
$listIcons = gis_get_array_list_icons();
$arraySelectIcon = array();
foreach ($listIcons as $index => $value) $arraySelectIcon[$index] = $index;
$path = 'images/gis_map/icons/'; //TODO set better method the path
$table->data[22][0] = __('Default icon in GIS') . ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true);
$gis_default_icon = $config["gis_default_icon"];
if ($gis_default_icon == '') {
$display_icons = 'none';
// Hack to show no icon. Use any given image to fix not found image errors
$path_without = "images/spinner.png";
$path_default = "images/spinner.png";
$path_ok = "images/spinner.png";
$path_bad = "images/spinner.png";
$path_warning = "images/spinner.png";
}
else {
$display_icons = '';
$path_without = $path . $gis_default_icon . ".default.png";
$path_default = $path . $gis_default_icon . ".default.png";
$path_ok = $path . $gis_default_icon . ".ok.png";
$path_bad = $path . $gis_default_icon . ".bad.png";
$path_warning = $path . $gis_default_icon . ".warning.png";
}
$table->data[22][1] = html_print_select($arraySelectIcon, "gis_default_icon", $gis_default_icon, "changeIcons();", __('None'), '', true) . '&nbsp;' . html_print_image($path_ok, true, array("id" => "icon_ok", "style" => "display:".$display_icons.";")) . '&nbsp;' . html_print_image($path_bad, true, array("id" => "icon_bad", "style" => "display:".$display_icons.";")) . '&nbsp;' . html_print_image($path_warning, true, array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);
html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>';

View File

@ -784,7 +784,7 @@ function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
* @param $thrash3 Don't use.
*/
function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$where = '';
if (isset($other['data'][0])){
@ -795,22 +795,22 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
}
if (isset($other['data'][1])){
// Filter by group
if ($other['data'][1] != ""){
if ($other['data'][1] != "") {
$where .= " AND id_grupo = " . $other['data'][1];
}
}
if (isset($other['data'][3])){
if (isset($other['data'][3])) {
// Filter by name
if ($other['data'][3] != ""){
$where .= " AND nombre LIKE ('%" . $other['data'][3] . "%')";
}
}
}
if (isset($other['data'][4])){
if (isset($other['data'][4])) {
// Filter by policy
if ($other['data'][4] != ""){
if ($other['data'][4] != "") {
$filter_by_policy = enterprise_hook('policies_get_filter_by_agent', array($other['data'][4]));
if ($filter_by_policy !== ENTERPRISE_NOT_HOOK){
$where .= $filter_by_policy;
$where .= $filter_by_policy;
}
}
}
@ -824,9 +824,9 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$result_agents = array();
// Filter by state
$sql = "SELECT id_agente, nombre, direccion, comentarios, tconfig_os.name, url_address FROM tagente, tconfig_os WHERE tagente.id_os = tconfig_os.id_os AND disabled = 0 " . $where;
$all_agents = db_get_all_rows_sql($sql);
$all_agents = db_get_all_rows_sql($sql);
// Filter by status: unknown, warning, critical, without modules
if (isset($other['data'][2])){
if ($other['data'][2] != "") {
@ -837,12 +837,12 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$modules = db_get_all_rows_filter('tagente_modulo', $filter_modules, 'id_agente_modulo');
$result_modules = array();
// Skip non init modules
foreach ($modules as $module){
foreach ($modules as $module) {
if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){
$result_modules[] = $module;
}
}
}
// Without modules NO_MODULES
if ($other['data'][2] == 'no_modules'){
if (empty($result_modules) and $other['data'][2] == 'no_modules'){
@ -853,27 +853,27 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
else {
$status = agents_get_status($agent['id_agente'], true);
// Filter by status
switch ($other['data'][2]){
switch ($other['data'][2]) {
case 'warning':
if ($status == 2){
if ($status == 2) {
$result_agents[] = $agent;
}
break;
break;
case 'critical':
if ($status == 1){
if ($status == 1) {
$result_agents[] = $agent;
}
break;
case 'unknown':
if ($status == 3){
$result_agents[] = $agent;
if ($status == 3) {
$result_agents[] = $agent;
}
break;
case 'normal':
if ($status == 0){
$result_agents[] = $agent;
if ($status == 0) {
$result_agents[] = $agent;
}
break;
break;
}
}
}
@ -886,13 +886,13 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$result_agents = $all_agents;
}
if (count($result_agents) > 0 and $result_agents !== false){
if (count($result_agents) > 0 and $result_agents !== false) {
$data = array('type' => 'array', 'data' => $result_agents);
returnData('csv', $data, $separator);
returnData('csv', $data, $separator);
}
else {
returnError('error_all_agents', 'No agents retrieved.');
returnError('error_all_agents', 'No agents retrieved.');
}
}
@ -910,13 +910,15 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
* @param $thrash3 Don't use.
*/
function api_get_agent_modules($thrash1, $thrash2, $other, $thrash3) {
$sql = sprintf("SELECT id_agente, id_agente_modulo, nombre
FROM tagente_modulo WHERE id_agente = %d AND disabled = 0 AND delete_pending = 0", $other['data'][0]);
$all_modules = db_get_all_rows_sql($sql);
if (count($all_modules) > 0 and $all_modules !== false){
FROM tagente_modulo
WHERE id_agente = %d AND disabled = 0
AND delete_pending = 0", $other['data'][0]);
$all_modules = db_get_all_rows_sql($sql);
if (count($all_modules) > 0 and $all_modules !== false) {
$data = array('type' => 'array', 'data' => $all_modules);
returnData('csv', $data, ';');
@ -940,14 +942,16 @@ function api_get_agent_modules($thrash1, $thrash2, $other, $thrash3) {
* @param $thrash3 Don't use.
*/
function api_get_group_agent($thrash1, $thrash2, $other, $thrash3) {
$sql = sprintf("SELECT groups.nombre nombre
FROM tagente agents, tgrupo groups WHERE id_agente = %d AND agents.disabled = 0 AND groups.disabled = 0
AND agents.id_grupo = groups.id_grupo", $other['data'][0]);
$group_names = db_get_all_rows_sql($sql);
if (count($group_names) > 0 and $group_names !== false){
FROM tagente agents, tgrupo groups
WHERE id_agente = %d AND agents.disabled = 0
AND groups.disabled = 0
AND agents.id_grupo = groups.id_grupo", $other['data'][0]);
$group_names = db_get_all_rows_sql($sql);
if (count($group_names) > 0 and $group_names !== false) {
$data = array('type' => 'array', 'data' => $group_names);
returnData('csv', $data, ';');
@ -971,21 +975,23 @@ function api_get_group_agent($thrash1, $thrash2, $other, $thrash3) {
* @param $thrash3 Don't use.
*/
function api_get_policies($thrash1, $thrash2, $other, $thrash3) {
$where = '';
if ($other['data'][0] != ""){
if ($other['data'][0] != "") {
$where .= ' AND id_agent = ' . $other['data'][0];
$sql = sprintf("SELECT policy.id, name, id_agent FROM tpolicies policy, tpolicy_agents pol_agents
WHERE policy.id = pol_agents.id %s", $where);
} else {
$sql = "SELECT id, name FROM tpolicies policy";
$sql = sprintf("SELECT policy.id, name, id_agent
FROM tpolicies policy, tpolicy_agents pol_agents
WHERE policy.id = pol_agents.id %s", $where);
}
else {
$sql = "SELECT id, name FROM tpolicies policy";
}
$policies = db_get_all_rows_sql($sql);
if (count($policies) > 0 and $policies !== false){
$policies = db_get_all_rows_sql($sql);
if (count($policies) > 0 and $policies !== false) {
$data = array('type' => 'array', 'data' => $policies);
returnData('csv', $data, ';');
@ -1012,14 +1018,15 @@ function api_get_policy_modules($thrash1, $thrash2, $other, $thrash3) {
$where = '';
if ($other['data'][0] == ""){
if ($other['data'][0] == "") {
returnError('error_policy_modules', 'Error retrieving policy modules. Id_policy cannot be left blank.');
return;
}
$policies = enterprise_hook('policies_get_modules_api', array($other['data'][0], $other['data'][1]));
$policies = enterprise_hook('policies_get_modules_api',
array($other['data'][0], $other['data'][1]));
if ($policies === ENTERPRISE_NOT_HOOK){
if ($policies === ENTERPRISE_NOT_HOOK) {
returnError('error_policy_modules', 'Error retrieving policy modules.');
return;
}
@ -1291,7 +1298,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3){
}
}
$plugin_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
$plugin_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target',
'tcp_port', 'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
'custom_id', 'descripcion', 'id_plugin', 'plugin_user', 'plugin_pass', 'plugin_parameter');
@ -1696,49 +1703,49 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
*/
function api_set_new_network_component($id, $thrash1, $other, $thrash2) {
if ($id == ""){
if ($id == "") {
returnError('error_set_new_network_component', __('Error creating network component. Network component name cannot be left blank.'));
return;
return;
}
if ($other['data'][0] < 6 or $other['data'][0] > 18){
if ($other['data'][0] < 6 or $other['data'][0] > 18) {
returnError('error_set_new_network_component', __('Error creating network component. Incorrect value for Network component type field.'));
return;
return;
}
if ($other['data'][17] == ""){
if ($other['data'][17] == "") {
returnError('error_set_new_network_component', __('Error creating network component. Network component group cannot be left blank.'));
return;
}
return;
}
$values = array (
'description' => $other['data'][1],
'module_interval' => $other['data'][2],
'max' => $other['data'][3],
'min' => $other['data'][4],
'snmp_community' => $other['data'][5],
'id_module_group' => $other['data'][6],
'id_modulo' => 2,
'max_timeout' => $other['data'][7],
'history_data' => $other['data'][8],
'min_warning' => $other['data'][9],
'max_warning' => $other['data'][10],
'str_warning' => $other['data'][11],
'min_critical' => $other['data'][12],
'max_critical' => $other['data'][13],
'str_critical' => $other['data'][14],
'min_ff_event' => $other['data'][15],
'post_process' => $other['data'][16]);
'description' => $other['data'][1],
'module_interval' => $other['data'][2],
'max' => $other['data'][3],
'min' => $other['data'][4],
'snmp_community' => $other['data'][5],
'id_module_group' => $other['data'][6],
'id_modulo' => 2,
'max_timeout' => $other['data'][7],
'history_data' => $other['data'][8],
'min_warning' => $other['data'][9],
'max_warning' => $other['data'][10],
'str_warning' => $other['data'][11],
'min_critical' => $other['data'][12],
'max_critical' => $other['data'][13],
'str_critical' => $other['data'][14],
'min_ff_event' => $other['data'][15],
'post_process' => $other['data'][16]);
$name_check = db_get_value ('name', 'tnetwork_component', 'name', $id);
if ($name_check !== false){
if ($name_check !== false) {
returnError('error_set_new_network_component', __('Error creating network component. This network component already exists.'));
return;
return;
}
$id = network_components_create_network_component ($id, $other['data'][0], $other['data'][17], $values);
if (!$id)
returnError('error_set_new_network_component', 'Error creating network component.');
else
@ -1764,54 +1771,54 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) {
*/
function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) {
if ($id == ""){
if ($id == "") {
returnError('error_set_new_plugin_component', __('Error creating plugin component. Plugin component name cannot be left blank.'));
return;
return;
}
if ($other['data'][7] == ""){
if ($other['data'][7] == "") {
returnError('error_set_new_plugin_component', __('Error creating plugin component. Incorrect value for Id plugin.'));
return;
return;
}
if ($other['data'][21] == ""){
if ($other['data'][21] == "") {
returnError('error_set_new_plugin_component', __('Error creating plugin component. Plugin component group cannot be left blank.'));
return;
}
return;
}
$values = array (
'description' => $other['data'][1],
'module_interval' => $other['data'][2],
'max' => $other['data'][3],
'min' => $other['data'][4],
'tcp_port' => $other['data'][5],
'id_module_group' => $other['data'][6],
'id_modulo' => 4,
'id_plugin' => $other['data'][7],
'plugin_user' => $other['data'][8],
'plugin_pass' => $other['data'][9],
'plugin_parameter' => $other['data'][10],
'max_timeout' => $other['data'][11],
'history_data' => $other['data'][12],
'min_warning' => $other['data'][13],
'max_warning' => $other['data'][14],
'str_warning' => $other['data'][15],
'min_critical' => $other['data'][16],
'max_critical' => $other['data'][17],
'str_critical' => $other['data'][18],
'min_ff_event' => $other['data'][19],
'post_process' => $other['data'][20]);
'description' => $other['data'][1],
'module_interval' => $other['data'][2],
'max' => $other['data'][3],
'min' => $other['data'][4],
'tcp_port' => $other['data'][5],
'id_module_group' => $other['data'][6],
'id_modulo' => 4,
'id_plugin' => $other['data'][7],
'plugin_user' => $other['data'][8],
'plugin_pass' => $other['data'][9],
'plugin_parameter' => $other['data'][10],
'max_timeout' => $other['data'][11],
'history_data' => $other['data'][12],
'min_warning' => $other['data'][13],
'max_warning' => $other['data'][14],
'str_warning' => $other['data'][15],
'min_critical' => $other['data'][16],
'max_critical' => $other['data'][17],
'str_critical' => $other['data'][18],
'min_ff_event' => $other['data'][19],
'post_process' => $other['data'][20]);
$name_check = db_get_value ('name', 'tnetwork_component', 'name', $id);
if ($name_check !== false){
if ($name_check !== false) {
returnError('error_set_new_plugin_component', __('Error creating plugin component. This plugin component already exists.'));
return;
return;
}
$id = network_components_create_network_component ($id, $other['data'][0], $other['data'][21], $values);
if (!$id)
returnError('error_set_new_plugin_component', 'Error creating plugin component.');
else
@ -1838,40 +1845,40 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) {
*/
function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
if ($id == ""){
if ($id == "") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. SNMP component name cannot be left blank.'));
return;
return;
}
if ($other['data'][0] < 15 or $other['data'][0] > 17){
if ($other['data'][0] < 15 or $other['data'][0] > 17) {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. Incorrect value for Snmp component type field.'));
return;
return;
}
if ($other['data'][25] == ""){
if ($other['data'][25] == "") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. Snmp component group cannot be left blank.'));
return;
}
return;
}
# SNMP version 3
if ($other['data'][16] == "3"){
if ($other['data'][16] == "3") {
if ($other['data'][22] != "AES" and $other['data'][22] != "DES"){
if ($other['data'][22] != "AES" and $other['data'][22] != "DES") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return;
}
if ($other['data'][25] != "authNoPriv" and $other['data'][25] != "authPriv" and $other['data'][25] != "noAuthNoPriv"){
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return;
}
return;
}
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA"){
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return;
}
return;
}
$values = array (
'description' => $other['data'][1],
'module_interval' => $other['data'][2],
@ -3792,7 +3799,7 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
$homeurl = '../';
$ttl = 1;
global $config;
$config['flash_charts'] = 0;
@ -5006,7 +5013,7 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db = nul
return;
}
if ($other['type'] == 'string') {
if ($other['data'] != '') {
returnError('error_parameter', 'Error in the parameters.');
@ -5018,18 +5025,20 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db = nul
}
else if ($other['type'] == 'array') {
$separator = $other['data'][0];
$filterString = otherParameter2Filter($other);
}
$dataRows = db_get_all_rows_filter('tevento', $filterString);
$last_error = error_get_last();
if (!empty($last_error)) {
returnError('ERROR_API_PANDORAFMS', $returnType);
return;
if (empty($dataRows)) {
if (!empty($last_error)) {
returnError('ERROR_API_PANDORAFMS', $returnType);
return;
}
}
$data['type'] = 'array';
$data['data'] = $dataRows;

View File

@ -232,6 +232,9 @@ function config_update_config () {
config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium'));
config_update_value ('description_size_text', get_parameter('description_size_text'));
config_update_value ('item_title_size_text', get_parameter('item_title_size_text'));
config_update_value ('gis_label', get_parameter ('gis_label'));
config_update_value ('gis_default_icon', get_parameter ('gis_default_icon'));
/////////////
break;
case 'enterprise/godmode/setup/setup_history':
@ -271,13 +274,13 @@ function config_process_config () {
/* Compatibility fix */
foreach ($configs as $c) {
$config[$c['token']] = $c['value'];
$config[$c['token']] = $c['value'];
}
if (!isset ($config['language'])) {
config_update_value ('language', 'en');
}
if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') {
$config['homeurl'] = '/'.$config['homeurl'];
}
@ -703,7 +706,15 @@ function config_process_config () {
if (!isset($config['item_title_size_text'])) {
config_update_value ('item_title_size_text', 45);
}
if (!isset($config['gis_label'])) {
config_update_value ('gis_label', 0);
}
if (!isset($config['gis_default_icon'])) {
config_update_value ('gis_default_icon', "marker");
}
/* Finally, check if any value was overwritten in a form */
config_update_config();
}
@ -713,7 +724,7 @@ function config_check () {
// At this first version I'm passing errors using session variables, because the error management
// is done by an AJAX request. Better solutions could be implemented in the future :-)
// Check default password for "admin"
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
if ($is_admin) {

View File

@ -36,7 +36,6 @@ function gis_add_parent_lines() {
js_refreshParentLines('" . __('Hierarchy of agents') . "');
});";
echo "</script>";
}
/**
@ -358,6 +357,10 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) {
function gis_add_agent_point($layerName, $pointName, $lat, $lon, $icon = null, $width = 20,
$height = 20, $point_id = '', $status = -1, $type_string = '', $idParent = 0) {
global $config;
if (!$config['gis_label'])
$pointName = '';
?>
<script type="text/javascript">
$(document).ready (
@ -458,10 +461,18 @@ function gis_get_layers($idMap) {
}
function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
$row = db_get_row_sql('SELECT id_grupo, icon_path FROM tagente WHERE id_agente = ' . $idAgent);
global $config;
$row = db_get_row_sql('SELECT id_grupo, icon_path
FROM tagente WHERE id_agente = ' . $idAgent);
if (($row['icon_path'] === null) || (strlen($row['icon_path']) == 0)) {
$icon = "images/groups_small/" . groups_get_icon($row['id_grupo']);
if ($config['gis_default_icon'] != "") {
$icon = "images/gis_map/icons/" . $config['gis_default_icon'];
}
else {
$icon = "images/groups_small/" . groups_get_icon($row['id_grupo']);
}
}
else {
$icon = "images/gis_map/icons/" . $row['icon_path'];

View File

@ -122,13 +122,13 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
var option = {
controls: controlsList,
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)
};
map = new OpenLayers.Map(id_div, option);
var baseLayer = null;
@ -203,10 +203,10 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
),
new OpenLayers.Size(objBaseLayers[baselayerIndex]['image_width'], objBaseLayers[baselayerIndex]['image_height']),
{projection: new OpenLayers.Projection("EPSG:4326"),
numZoomLevels: objBaseLayers[baselayerIndex]['num_zoom_levels']
numZoomLevels: objBaseLayers[baselayerIndex]['num_zoom_levels']
}
);
map.addLayer(baseLayer);
map.addLayer(baseLayer);
break;
}
}
@ -214,7 +214,7 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
var lonLat = new OpenLayers.LonLat(center_longitude, center_latitude)
.transform(map.displayProjection, map.getProjectionObject());
map.setCenter (lonLat, initial_zoom);
}
@ -500,10 +500,10 @@ function showHideLayer(name, action) {
function js_addAgentPoint(layerName, pointName, lon, lat, id, type_string, statusAgent, idParent) {
var point = new OpenLayers.Geometry.Point(lon, lat)
.transform(map.displayProjection, map.getProjectionObject());
var layer = map.getLayersByName(layerName);
layer = layer[0];
feature = new OpenLayers.Feature.Vector(point,{id_parent: idParent, status: statusAgent, nombre: pointName, id: id, type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) });
if (isHideFeatureByStatus(statusAgent)) {

View File

@ -31,7 +31,7 @@ class ViewAgents {
$this->user = $user;
$this->system = $system;
$this->filterText = $this->system->getRequest('filter_text', '');
$this->filterGroup = $this->system->getRequest('filter_group', 0);;
$this->filterGroup = $this->system->getRequest('filter_group', 0);
}
private function showForm() {
@ -48,7 +48,7 @@ class ViewAgents {
public function show() {
$this->showForm();
// Show only selected groups
// Show only selected groups
if ($this->filterGroup > 0) {
$groups = $this->filterGroup;
$agent_names = agents_get_group_agents ($this->filterGroup, array('string' => $this->filterText), "upper");
@ -286,12 +286,30 @@ class ViewAgent {
if ($module["id_tipo_modulo"] == 24) { // log4x
switch($module["datos"]) {
case 10: $salida = "TRACE"; $style="font-weight:bold; color:darkgreen;"; break;
case 20: $salida = "DEBUG"; $style="font-weight:bold; color:darkgreen;"; break;
case 30: $salida = "INFO"; $style="font-weight:bold; color:darkgreen;"; break;
case 40: $salida = "WARN"; $style="font-weight:bold; color:darkorange;"; break;
case 50: $salida = "ERROR"; $style="font-weight:bold; color:red;"; break;
case 60: $salida = "FATAL"; $style="font-weight:bold; color:red;"; break;
case 10:
$salida = "TRACE";
$style="font-weight:bold; color:darkgreen;";
break;
case 20:
$salida = "DEBUG";
$style="font-weight:bold; color:darkgreen;";
break;
case 30:
$salida = "INFO";
$style="font-weight:bold; color:darkgreen;";
break;
case 40:
$salida = "WARN";
$style="font-weight:bold; color:darkorange;";
break;
case 50:
$salida = "ERROR";
$style="font-weight:bold; color:red;";
break;
case 60:
$salida = "FATAL";
$style="font-weight:bold; color:red;";
break;
}
$salida = "<span style='$style'>$salida</span>";
}
@ -428,10 +446,10 @@ class viewGraph {
$columns = array(
//"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center" ),
"Sev" => array("severity", "format_data", "align" => "center", "width" => "70px"),
"Message" => array("message", "modules_format_verbatim", "align" => "left", "width" => "45%"),
"StackTrace" => array("stacktrace", "modules_format_verbatim", "align" => "left", "width" => "50%")
//"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center" ),
"Sev" => array("severity", "format_data", "align" => "center", "width" => "70px"),
"Message" => array("message", "modules_format_verbatim", "align" => "left", "width" => "45%"),
"StackTrace" => array("stacktrace", "modules_format_verbatim", "align" => "left", "width" => "50%")
);
}
else if (preg_match ("/string/", $moduletype_name)) {
@ -439,9 +457,9 @@ class viewGraph {
WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $this->idAgentModule, (get_system_time () - $this->period));
$columns = array(
//"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center"),
"Data" => array("datos", "format_data", "align" => "center"),
"Time" => array("utimestamp", "modules_format_time", "align" => "center")
//"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center"),
"Data" => array("datos", "format_data", "align" => "center"),
"Time" => array("utimestamp", "modules_format_time", "align" => "center")
);
}
else {
@ -450,8 +468,8 @@ class viewGraph {
ORDER BY utimestamp DESC", $this->idAgentModule, (get_system_time () - $this->period));
$columns = array(
"Data" => array("datos", "format_data", "align" => "center"),
"Time" => array("utimestamp", "modules_format_time", "align" => "center")
"Data" => array("datos", "format_data", "align" => "center"),
"Time" => array("utimestamp", "modules_format_time", "align" => "center")
);
}

View File

@ -170,7 +170,7 @@ if (is_ajax ()) {
echo '';
else
echo ui_print_truncate_text(strip_tags($event["user_comment"]));
}
}
return;
}
@ -214,7 +214,7 @@ $url = "index.php?sec=eventos&amp;sec2=operation/events/events&amp;search=" .
if ($config["pure"] == 0) {
$pss = get_user_info($config['id_user']);
$hashup = md5($config['id_user'] . $pss['password']);
// Fullscreen
$fullscreen['active'] = false;
$fullscreen['text'] = '<a href="'.$url.'&amp;pure=1">' .
@ -279,7 +279,7 @@ if ($config["pure"] == 0) {
function openURLTagWindow(url) {
window.open(url, '','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no');
}
}
</script>
<?php
@ -617,15 +617,15 @@ $(document).ready( function() {
current_row_id = row_id_name + "-" + row_id_number;
selected_row_id = row_id_name + "-" + row_id_number + "-0";
next_row_id = row_id_name + '-' + row_id_number_next;
$("#"+previous_row_id).css('display', 'none');
$("#"+current_row_id).css('display', 'none');
$("#"+selected_row_id).css('display', 'none');
$("#"+next_row_id).css('display', 'none');
}
});
}
});
}
} // Add comment
else if (select_validate == 3){
// Get event comment

View File

@ -99,21 +99,21 @@ if (is_ajax()) {
$values['tag'] = get_parameter('tag');
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$result = db_process_sql_update('tevent_filter', $values, array('id_filter' => $id));
if ($result === false){
echo 'error';
}
else {
echo 'ok';
}
}
}
if ($get_event_filters){
if ($get_event_filters) {
$event_filter = events_get_event_filter_select();
echo json_encode($event_filter);
echo json_encode($event_filter);
}
return;
@ -433,12 +433,14 @@ if ($group_rep == 0) {
case "mysql":
$sql = "SELECT *
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
break;
case "postgresql":
$sql = "SELECT *
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
break;
case "oracle":
$set = array();
@ -446,7 +448,8 @@ if ($group_rep == 0) {
$set['offset'] = $offset;
$sql = "SELECT *
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC";
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC";
$sql = oracle_recode_query ($sql, $set);
break;
}
@ -455,8 +458,11 @@ else {
switch ($config["dbtype"]) {
case "mysql":
db_process_sql ('SET group_concat_max_len = 9999999');
$sql = "SELECT *, MAX(id_evento) AS id_evento, GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
MIN(estado) AS min_estado, MAX(estado) AS max_estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
$sql = "SELECT *, MAX(id_evento) AS id_evento,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
MIN(estado) AS min_estado,
MAX(estado) AS max_estado,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
FROM tevento
WHERE 1=1 ".$sql_post."
GROUP BY evento, id_agentmodule

View File

@ -51,12 +51,9 @@ $tag = get_parameter("tag", "");
$filter = array ();
if ($ev_group > 1)
$filter['id_grupo'] = $ev_group;
/*if ($status == 1)
$filter['estado'] = 1;
if ($status == 0)
$filter['estado'] = 0; */
$filter_state = '';
switch($status) {
switch ($status) {
case 0:
case 1:
case 2:
@ -65,14 +62,14 @@ switch($status) {
case 3:
$filter_state = " AND (estado = 0 OR estado = 2)";
break;
}
}
if ($search != "")
$filter[] = 'evento LIKE "%'.io_safe_input($search).'%"';
if (($event_type != "all") OR ($event_type != 0))
$filter['event_type'] = $event_type;
if ($severity != -1)
$filter[] = 'criticity >= '.$severity;
if ($id_agent == -2) {
$text_agent = (string) get_parameter("text_agent", __("All"));
@ -103,14 +100,14 @@ else {
break;
}
}
if ($id_agent != -1)
$filter['id_agente'] = $id_agent;
if ($id_event != -1)
$filter['id_evento'] = $id_event;
$timestamp_filter = '';
if ($event_view_hr > 0) {
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR); //Put hours in seconds
@ -138,7 +135,7 @@ echo chr (13);
$fields = array ('id_grupo', 'id_agente', 'evento', 'estado', 'id_usuario',
'event_type', 'criticity', 'timestamp');
$sql = db_get_all_rows_filter ('tevento', $filter, $fields, 'AND', true, true);
$sql = db_get_all_rows_filter('tevento', $filter, $fields, 'AND', true, true);
// If filter is empty and there are others filters not empty append "WHERE" clause
if (empty($filter) and (!empty($filter_state) or !empty($timestamp_filter)))
@ -170,5 +167,4 @@ while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
echo $event["criticity"];
echo chr (13);
}
?>
?>

View File

@ -18,6 +18,8 @@ require_once ("include/config.php");
check_login ();
global $config;
require_once ('include/functions_gis.php');
require_once ('include/functions_ui.php');
require_once ('include/functions_agents.php');
@ -30,7 +32,8 @@ switch ($opt) {
$returnJSON['correct'] = 1;
$idConection = get_parameter('id_conection');
$row = db_get_row_filter('tgis_map_connection', array('id_tmap_connection' => $idConection));
$row = db_get_row_filter('tgis_map_connection',
array('id_tmap_connection' => $idConection));
$returnJSON['content'] = $row;
@ -113,6 +116,9 @@ switch ($opt) {
foreach ($agentsGISStatus as $row) {
$status = agents_get_status($row['tagente_id_agente']);
if (!$config['gis_label'])
$row['nombre'] = '';
$agents[$row['tagente_id_agente']] = array(
'icon_path' => gis_get_agent_icon_map($row['tagente_id_agente'], true, $status),
'name' => $row['nombre'],
@ -158,19 +164,19 @@ switch ($opt) {
else
{
$returnJSON['content'] .= __('Position (Long, Lat, Alt)') . ': (' . $agentDataGIS['stored_longitude'] . ', ' . $agentDataGIS['stored_latitude'] . ', ' . $agentDataGIS['stored_altitude'] . ') <br />';
}
}
$agent_ip_address = agents_get_address ($id_agente);
if ($agent_ip_address || $agent_ip_address != '') {
$returnJSON['content'] .= __('IP Address').': '.agents_get_address ($id_agente).'<br />';
}
$returnJSON['content'] .= __('OS').': ' . ui_print_os_icon($row['id_os'], true, true);
$osversion_offset = strlen($row["os_version"]);
if ($osversion_offset > 15) {
$osversion_offset = $osversion_offset - 15;
$osversion_offset = $osversion_offset - 15;
}
else {
$osversion_offset = 0;
$osversion_offset = 0;
}
$returnJSON['content'] .= '&nbsp;( <i><span title="'.$row["os_version"].'">'.substr($row["os_version"],$osversion_offset,15).'</span></i>)<br />';
$agent_description = $row['comentarios'];
@ -181,7 +187,7 @@ switch ($opt) {
$returnJSON['content'] .= __('Agent Version').': '.$row["agent_version"].'<br />';
$returnJSON['content'] .= __('Last contact') . ": ";
if ($row["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
$returnJSON['content'] .=__('Never') ." <br />";
$returnJSON['content'] .=__('Never') ." <br />";
}
else {
$returnJSON['content'] .= $row["ultimo_contacto_remoto"] ." <br />";
@ -189,13 +195,12 @@ switch ($opt) {
$returnJSON['content'] .= __('Remote').': '. $row["ultimo_contacto"];
echo json_encode($returnJSON);
break;
case 'get_map_connection_data':
$idConnection = get_parameter('id_connection');
$returnJSON = array();
$returnJSON['correct'] = 1;
$returnJSON['content'] = db_get_row_sql('SELECT * FROM tgis_map_connection WHERE id_tmap_connection = ' . $idConnection);

View File

@ -43,7 +43,7 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
else
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
if ($maps !== false) {
foreach ($maps as $map) {
if ($rowPair)

View File

@ -98,14 +98,15 @@ else {
if (check_acl ($config["id_user"], $map['group_id'], "IW"))
$buttons [] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '&nbsp; Agent&nbsp;-&nbsp;test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . '&nbsp;</a></li><li class="nomn_high"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=sla&amp;id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=inventory&amp;id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . '&nbsp;</a>';
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' .
html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '&nbsp; Agent&nbsp;-&nbsp;test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . '&nbsp;</a></li><li class="nomn_high"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=sla&amp;id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=inventory&amp;id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . '&nbsp;</a>';
$times = array(
5 => __('5 seconds'),
10 => __('10 seconds'),
30 => __('30 seconds'),
SECONDS_1MINUTE => __('1 minute'),
SECONDS_2MINUTE => __('2 minutes'),
SECONDS_2MINUTES => __('2 minutes'),
SECONDS_5MINUTES => __('5 minutes'),
SECONDS_10MINUTES => __('10 minutes'),
SECONDS_1HOUR => __('1 hour'),
@ -178,10 +179,12 @@ if ($layers != false) {
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
break;
case "postgresql":
$timestampLastOperation = db_get_value_sql("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
$timestampLastOperation = db_get_value_sql(
"SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
break;
case "oracle":
$timestampLastOperation = db_get_value_sql("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) from dual");
$timestampLastOperation = db_get_value_sql(
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) FROM dual");
break;
}

View File

@ -220,7 +220,8 @@ echo "<script type=\"text/javascript\">
$('#add_note').slideDown('slow');
return false;
});
});</script>";
});
</script>";
if (isset ($id_inc)) { //If $id_inc is set (when $_GET["id"] is set, not $_GET["insert_form"]
ui_print_page_header (__('Incident details'). ' #'.$id_inc, "images/book_edit.png", false, "", false, "");
@ -233,21 +234,31 @@ else {
}
echo '<table cellpadding="4" cellspacing="4" class="databox" width="98%">';
echo '<tr><td class="datos"><b>'.__('Incident').'</b></td><td colspan="3" class="datos">';
echo '<tr>
<td class="datos"><b>'.__('Incident').'</b></td>
<td colspan="3" class="datos">';
if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR
($usuario == $config["id_user"])) {
html_print_input_text ("titulo", $titulo,'', 70);
}
else {
html_print_input_text_extended ("titulo", $titulo, "", "", 70, "", false, "", "readonly");
}
echo '</td></tr>';
echo '</td>
</tr>';
echo '<tr><td class="datos2"><b>'.__('Opened at').'</b></td><td class="datos2"><i>'.date ($config['date_format'], $inicio).'</i></td>';
echo '<td class="datos2"><b>'.__('Updated at').'</b><td class="datos2"><i>'.date ($config['date_format'], $actualizacion).'</i></td></tr>';
echo '<tr>
<td class="datos2"><b>'.__('Opened at').'</b></td>
<td class="datos2"><i>'.date ($config['date_format'], $inicio).'</i></td>
<td class="datos2"><b>'.__('Updated at').'</b></td>
<td class="datos2"><i>'.date ($config['date_format'], $actualizacion).'</i></td>
</tr>';
echo '<tr><td class="datos"><b>'.__('Owner').'</b></td><td class="datos">';
echo '<tr>
<td class="datos"><b>'.__('Owner').'</b></td>
<td class="datos">';
if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135");
@ -255,7 +266,9 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf
else {
html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135", true);
}
echo '</td><td class="datos"><b>'.__('Status').'</b></td><td class="datos">';
echo '</td>
<td class="datos"><b>'.__('Status').'</b></td>
<td class="datos">';
if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135');
@ -263,9 +276,12 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf
else {
html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true);
}
echo '</td></tr>';
echo '</td>
</tr>';
echo '<tr><td class="datos2"><b>'.__('Source').'</b></td><td class="datos2">';
echo '<tr>
<td class="datos2"><b>'.__('Source').'</b></td>
<td class="datos2">';
$fields = array ();
$return = db_get_all_rows_sql ("SELECT origen FROM torigen ORDER BY origen");

View File

@ -397,7 +397,6 @@ function show_data_section () {
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
}
}
}
</script>
</script>

View File

@ -57,14 +57,14 @@ if (! check_acl ($config["id_user"], $id_group, "AR")) {
$options = array();
if (check_acl ($config["id_user"], $id_group, "AW")) {
$hash = md5($config["dbpass"]. $id_layout. $config["id_user"]);
$options['public_link']['text'] = '<a href="'.$config["homeurl"].'/operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"].'">'.
html_print_image ("images/camera.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false;
$options['setup']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=editor&action=edit&id_visual_console='.$id_layout.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
$options['setup']['active'] = false;
}
@ -146,8 +146,11 @@ $(document).ready (function () {
?>
t = new Date();
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
$("#countdown").countdown({
until: t,
format: 'MS',
description: '<?php echo __('Until refresh'); ?>'
});
<?php
}
?>