diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ca97e5f4e2..4ec643f981 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,95 @@ +2008-08-11 Esteban Sanchez + + * include/functions_db.php: Added __ as an alias of lang_string(). + + * include/functions_reporting_pdf.php, + include/functions_reporting.php, include/functions.php, + include/functions_visual_map.php, index.php, + operation/incidents/incident.php, + operation/incidents/incident_detail.php, + operation/incidents/incident_note.php, + operation/incidents/incident_search.php, + operation/incidents/incident_statistics.php, + operation/snmpconsole/snmp_alert.php, + operation/snmpconsole/snmp_view.php, operation/users/user.php, + operation/users/user_edit.php, operation/users/user_statistics.php, + operation/events/event_statistics.php, operation/events/events.php, + operation/visual_console/render_view.php, + operation/visual_console/index.php, operation/extensions.php, + operation/agentes/estado_alertas.php, + operation/agentes/status_monitor.php, + operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, + operation/agentes/datos_agente.php, + operation/agentes/estado_ultimopaquete.php, + operation/agentes/estado_generalagente.php, + operation/agentes/estado_agente.php, operation/agentes/bulbs.php, + operation/agentes/status_events.php, operation/agentes/sla_view.php, + operation/agentes/exportdata.php, + operation/agentes/estado_monitores.php, + operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, + operation/agentes/tactical.php, operation/agentes/networkmap.php, + operation/messages/message.php, + operation/reporting/reporting_viewer.php, + operation/reporting/graph_viewer.php, + operation/reporting/custom_reporting.php, + operation/servers/view_server.php, + operation/servers/view_server_detail.php, operation/menu.php, + reporting/fgraph.php, reporting/stat_win.php, ajax.php, + general/logoff.php, general/pandora_help.php, general/footer.php, + general/noaccess.php, general/logon_failed.php, + general/links_menu.php, general/login_page.php, general/logon_ok.php, + general/header.php, general/main_menu.php, + godmode/groups/configure_group.php, godmode/groups/group_list.php, + godmode/setup/news.php, godmode/setup/links.php, + godmode/setup/setup.php, godmode/users/user_list.php, + godmode/users/configure_user.php, godmode/profiles/profile_list.php, + godmode/admin_access_logs.php, godmode/db/db_info_data.php, + godmode/db/db_main.php, godmode/db/db_audit.php, + godmode/db/db_sanity.php, godmode/db/db_refine.php, + godmode/db/db_info.php, godmode/db/db_event.php, + godmode/db/db_purge.php, godmode/extensions.php, + godmode/agentes/agent_template.php, + godmode/agentes/module_manager_editor_network.php, + godmode/agentes/module_manager_editor_wmi.php, + godmode/agentes/alert_manager.php, + godmode/agentes/module_manager_editor_plugin.php, + godmode/agentes/module_manager_editor_prediction.php, + godmode/agentes/alert_manager_editor.php, + godmode/agentes/manage_config.php, + godmode/agentes/module_manager_editor_data.php, + godmode/agentes/module_manager.php, + godmode/agentes/modificar_agente.php, + godmode/agentes/configurar_agente.php, + godmode/agentes/agent_disk_conf_editor.php, + godmode/agentes/planned_downtime.php, + godmode/agentes/manage_config_remote.php, + godmode/agentes/agent_manager.php, + godmode/modules/manage_network_components_form.php, + godmode/modules/manage_nc_groups_form.php, + godmode/modules/manage_network_templates.php, + godmode/modules/module_list.php, + godmode/modules/manage_network_templates_form.php, + godmode/modules/manage_network_components_form_network.php, + godmode/modules/manage_network_components_form_wmi.php, + godmode/modules/manage_network_components.php, + godmode/modules/manage_nc_groups.php, + godmode/reporting/reporting_builder.php, + godmode/reporting/map_builder.php, + godmode/reporting/graph_builder.php, godmode/servers/plugin.php, + godmode/servers/manage_recontask.php, + godmode/servers/modificar_server.php, + godmode/servers/manage_recontask_form.php, + godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, + godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a + instead of $lang_label to future use of gettext. Style + corrections. + + * godmode/agentes/planned_downtime.php: Rewritten to use Pandora + functions and adopt the UI style. Replaced lang_string with __(). + + * pandoradb.sql: Fields in tplanned_downtime renamed to fit + guidelines. + 2008-08-05 Sancho Lerena * AUTHORS: Added Evi to AUTHORS file. diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index 021a3d9221..c58b8bbca6 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -50,7 +50,6 @@ $page .= '.php'; $config["id_user"] = $_SESSION["id_usuario"]; session_write_close (); if (file_exists ($page)) { - $id_user = $_SESSION["id_usuario"]; require_once ($page); } else { echo "
Sorry! I can't find the page $page!"; diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 28edb7cc6c..ac70eb65e6 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -20,12 +20,12 @@ global $config; echo "
"; echo ' Pandora FMS '.$pandora_version.' - Build '.$build_version.'
'. -lang_string ("gpl_notice").'

'; +__('gpl_notice').'
'; if (isset($_SERVER['REQUEST_TIME'])) { $time = $_SERVER['REQUEST_TIME']; } else { $time = time(); } - echo "".$lang_label["gen_date"]." ".date("D F d, Y H:i:s", $time)." - Saved ".$sql_cache["saved"]." Queries
"; + echo "".__('gen_date')." ".date("D F d, Y H:i:s", $time)." - Saved ".$sql_cache["saved"]." Queries
"; echo "
"; ?> diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index a12770a50f..f109422c3a 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -35,36 +35,36 @@ if (isset ($_SESSION["id_usuario"])){ echo " "; else echo " "; - echo "".lang_string ("has_connected"). ' + echo "".__('has_connected'). ' ['. $_SESSION["id_usuario"]. ']'; // Second column echo ""; - echo " ". lang_string ("information").""; + echo " ". __('information').""; // Third column echo ""; // Autorefresh if ((isset($_GET["refr"]) AND $_GET["refr"] != 0) OR (isset($_POST["refr"]) AND $_POST["refr"] != 0)) { - echo " ". lang_string("Autorefresh").""; + echo " ". __('Autorefresh').""; } else { - echo " ". lang_string("Autorefresh").""; + echo " ". __('Autorefresh').""; } echo ""; - echo " ". lang_string ("logout").""; + echo " ". __('logout').""; echo ""; $server_status = check_server_status (); if ($server_status == 0) - echo " ". lang_string("Server status: DOWN").""; + echo " ". __('Server status: DOWN').""; else - echo " ". lang_string("System ready").""; + echo " ". __('System ready').""; echo ""; // Event - refresh - echo " ". lang_string("events").""; + echo " ". __('events').""; } diff --git a/pandora_console/general/links_menu.php b/pandora_console/general/links_menu.php index ea4188f815..4377094a48 100644 --- a/pandora_console/general/links_menu.php +++ b/pandora_console/general/links_menu.php @@ -19,7 +19,7 @@ $sql='SELECT link,name FROM tlink ORDER BY name'; $result = get_db_all_rows_sql ($sql); if ($result !== false){ ?> -
:: ::
+
:: ::
"; if ($sec2 == "godmode/agentes/manage_config_remote") { echo "
"; } else { echo ""; + echo "
"; // Manage groups if (give_acl($config['id_user'], 0, "PM")) { @@ -59,7 +59,7 @@ if (give_acl ($config['id_user'], 0, "AW")) { } else { echo ""; + echo ""; } // Planned downtimes @@ -69,7 +69,7 @@ if (give_acl ($config['id_user'], 0, "AW")) { } else echo ""; + echo ""; } } } @@ -79,14 +79,14 @@ if ((give_acl($config['id_user'], 0, "PM")==1)){ echo ''; if ($sec == "gmodules") { if ($sec2 == "godmode/modules/manage_nc_groups" || $sec2 == "godmode/modules/manage_nc_groups_form") echo "
"; else echo ""; + echo "
"; } if ($sec == "gmodules") { @@ -94,7 +94,7 @@ if ((give_acl($config['id_user'], 0, "PM")==1)){ echo ""; } // Network Profiles if ($sec == "gmodules") { @@ -102,7 +102,7 @@ if ((give_acl($config['id_user'], 0, "PM")==1)){ echo ""; } } @@ -112,7 +112,7 @@ if (give_acl ($config['id_user'], 0, "LM")) { } else echo ''; + echo ''; } if (give_acl ($config['id_user'], 0, "UM")) { @@ -120,14 +120,14 @@ if (give_acl ($config['id_user'], 0, "UM")) { echo '
'; } else echo ''; + echo '
'; } // Reporting if (give_acl ($config['id_user'], 0, "PM")) { echo ''; + echo ''; // Custom report builder if ($sec == "greporting") { @@ -136,7 +136,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { } else { echo ""; + echo ""; } // Custom graph builder @@ -146,7 +146,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { } else { echo ""; + echo ""; } // Custom map builder @@ -156,7 +156,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { } else { echo ""; + echo ""; } } @@ -167,7 +167,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo ''; // SERVERS if ($sec2 == "godmode/servers/modificar_server"){ @@ -175,14 +175,14 @@ if (give_acl ($config['id_user'], 0, "PM")) { } else echo ''; + echo ''; if ($sec == "gservers") { if ($sec2 == "godmode/servers/manage_recontask"|| $sec2 == "godmode/servers/manage_recontask_form") { echo ""; } if ($sec == "gservers") { if ($sec2 == "godmode/servers/plugin") { @@ -191,7 +191,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo ""; + echo ""; } // AUDIT @@ -200,7 +200,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo '
'; } else echo ''; + echo '
'; // Main SETUP // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -208,14 +208,14 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo '
'; } else echo ''; + echo '
'; if ($sec == "gsetup") { if ($sec2 == "godmode/setup/links") { echo "
"; } else echo ""; + echo "
"; } if ($sec == "gsetup"){ @@ -223,7 +223,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { echo "
"; } else echo ""; + echo "
"; } } if (give_acl ($config['id_user'], 0, "DM")) { @@ -237,7 +237,7 @@ if (give_acl ($config['id_user'], 0, "DM")) { } else { echo '
  • '; } - echo ''.lang_string ("db_maintenance").'
  • '; + echo ''.__('db_maintenance').''; if ($sec == "gdbman") { if ($sec2 == "godmode/db/db_info" || $sec2 == "godmode/db/db_info_data") { @@ -245,42 +245,42 @@ if (give_acl ($config['id_user'], 0, "DM")) { } else { echo ""; + echo ""; if ($sec2 == "godmode/db/db_purge") { echo "
    "; } else { echo ""; + echo "
    "; if ($sec2 == "godmode/db/db_refine") { echo "
    "; } else { echo ""; + echo "
    "; if ($sec2 == "godmode/db/db_audit") { echo "
    "; } else { echo ""; + echo "
    "; if ($sec2 == "godmode/db/db_event") { echo "
    "; } else { echo ""; + echo "
    "; if ($sec2 == "godmode/db/db_sanity") { echo "
    "; } else { echo ""; + echo "
    "; } } @@ -292,7 +292,7 @@ if (sizeof ($config['extensions'])) { } echo '"; if ($selected != '') { diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index f8c5832e88..439d8487e6 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -24,14 +24,11 @@ // Load global vars require("include/config.php"); -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; -else - $id_user = ""; +check_login (); -if (give_acl($id_user, 0, "PM")!=1) { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access SNMP Group Management"); +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access SNMP Group Management"); require ("general/noaccess.php"); exit; } @@ -43,9 +40,9 @@ if (isset($_GET["create"])){ // Create module VALUES ('$name', '$parent')"; $result=mysql_query($sql_insert); if (! $result) - echo "

    ".$lang_label["create_no"]."

    "; + echo "

    ".__('create_no')."

    "; else { - echo "

    ".$lang_label["create_ok"]."

    "; + echo "

    ".__('create_ok')."

    "; $id_sg = mysql_insert_id(); } } @@ -59,9 +56,9 @@ if (isset($_GET["update"])){ // if modified any parameter WHERE id_sg = '$id_sg'"; $result=mysql_query($sql_update); if (! $result) - echo "

    ".$lang_label["modify_no"]."

    "; + echo "

    ".__('modify_no')."

    "; else - echo "

    ".$lang_label["modify_ok"]."

    "; + echo "

    ".__('modify_ok')."

    "; } if (isset($_GET["delete"])){ // if delete @@ -69,19 +66,19 @@ if (isset($_GET["delete"])){ // if delete $sql_delete= "DELETE FROM tnetwork_component_group WHERE id_sg = ".$id_sg; $result=mysql_query($sql_delete); if (! $result) - echo "

    ".$lang_label["delete_no"]."

    "; + echo "

    ".__('delete_no')."

    "; else - echo "

    ".$lang_label["delete_ok"]."

    "; + echo "

    ".__('delete_ok')."

    "; $result=mysql_query($sql_delete); } -echo "

    ".$lang_label["module_management"]." > "; -echo $lang_label["network_component_group_management"]."

    "; +echo "

    ".__('module_management')." > "; +echo __('network_component_group_management')."

    "; echo ""; -echo ""; -echo ""; -echo ""; +echo ""; +echo ""; +echo ""; $sql1='SELECT * FROM tnetwork_component_group ORDER BY parent'; $result=mysql_query($sql1); $color=0; @@ -103,7 +100,7 @@ while ($row=mysql_fetch_array($result)){ @@ -114,7 +111,7 @@ echo "
    ".$lang_label["name"]."".$lang_label["parent"]."".$lang_label["delete"]."".__('name')."".__('parent')."".__('delete')."
    "; echo ''; echo '
    '; echo "
    "; -echo ""; +echo ""; echo "
    "; -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/modules/manage_nc_groups_form.php b/pandora_console/godmode/modules/manage_nc_groups_form.php index 1af758ef23..fd1703d305 100644 --- a/pandora_console/godmode/modules/manage_nc_groups_form.php +++ b/pandora_console/godmode/modules/manage_nc_groups_form.php @@ -24,14 +24,11 @@ // Load global vars require("include/config.php"); -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; -else - $id_user = ""; +check_login (); -if (give_acl($id_user, 0, "PM")!=1) { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access SNMO Groups Management"); +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access SNMO Groups Management"); require ("general/noaccess.php"); exit; } @@ -49,7 +46,7 @@ if (isset($_GET["edit"])){ // Edit mode $parent = ""; } -echo "

    ".$lang_label["network_component_group_management"]."

    "; +echo "

    ".__('network_component_group_management')."

    "; echo ''; // Different Form url if it's a create or if it's a update form @@ -59,11 +56,11 @@ else echo ""; echo ""; -echo ""; +echo ""; echo ""; echo ""; -echo ""; +echo ""; echo ""; -?> \ No newline at end of file + echo ""; + echo ""; + + echo ''; + } + echo "
    ".$lang_label["name"]."".__('name')."
    ".$lang_label["parent"]."".__('parent').""; echo "'; echo '
    '; if ($id_sg == -1) - echo ""; + echo ""; else - echo ""; + echo ""; echo "
    "; -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index bb28ebfbb6..eca26ff768 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -16,15 +16,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars -require("include/config.php"); -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; -else - $id_user = ""; +require ("include/config.php"); -if (give_acl($id_user, 0, "PM")!=1) { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access Agent Management"); +check_login (); + +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Agent Management"); require ("general/noaccess.php"); exit; } @@ -91,9 +89,9 @@ if (isset($_GET["create"])){ // Create module $result=mysql_query($sql_insert); if (! $result) - echo "

    ".$lang_label["create_no"]."

    "; + echo "

    ".__('create_no')."

    "; else { - echo "

    ".$lang_label["create_ok"]."

    "; + echo "

    ".__('create_ok')."

    "; $id_module = mysql_insert_id(); } } @@ -151,9 +149,9 @@ if (isset($_GET["update"])){ // if modified any parameter plugin_parameter = '$plugin_parameter', max_timeout = '$max_timeout' WHERE id_nc = '$id_nc'"; $result=mysql_query($sql_update); if (! $result) - echo "

    ".$lang_label["modify_no"]."

    "; + echo "

    ".__('modify_no')."

    "; else - echo "

    ".$lang_label["modify_ok"]."

    "; + echo "

    ".__('modify_ok')."

    "; } // ------------------ @@ -164,9 +162,9 @@ if (isset($_GET["delete"])){ // if delete $sql_delete= "DELETE FROM tnetwork_component WHERE id_nc = ".$id_nc; $result=mysql_query($sql_delete); if (! $result) - echo "

    ".$lang_label["delete_no"]."

    "; + echo "

    ".__('delete_no')."

    "; else - echo "

    ".$lang_label["delete_ok"]."

    "; + echo "

    ".__('delete_ok')."

    "; $sql_delete= "DELETE FROM tnetwork_profile_component WHERE id_nc = ".$id_nc; $result=mysql_query($sql_delete); } @@ -174,8 +172,8 @@ if (isset($_GET["delete"])){ // if delete // ------------------ // SHOW MODULES // ------------------ -echo "

    ".$lang_label["module_management"]." > "; -echo $lang_label["network_component_management"]."

    "; +echo "

    ".__('module_management')." > "; +echo __('network_component_management')."

    "; // Show group selector if (isset($_POST["ncgroup"])) { @@ -189,12 +187,12 @@ if (isset($_POST["ncgroup"])) { echo ""; echo ""; echo "
    "; echo "
    "; -echo $lang_label["group"] . " "; +echo __('group') . " "; echo "
    "; echo "
    "; echo " "; -echo ""; +echo ""; echo "
    "; if ($ncgroup != 0) { @@ -219,14 +217,14 @@ $result = mysql_query ($sql1); if ( $row = mysql_num_rows ($result)){ echo ''; echo ''; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - //echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + //echo ""; + echo ""; $color=1; while ($row=mysql_fetch_array($result)){ if ($color == 1){ @@ -269,7 +267,7 @@ if ( $row = mysql_num_rows ($result)){ echo $module_max." / ".$module_min; echo ""; + echo "".__("; echo ""; } echo "
    ".$lang_label["module_name"]."".$lang_label["type"]."".$lang_label["interval"]."".$lang_label["description"]."".$lang_label["nc.group"]."".$lang_label["module_group"]; - echo "".$lang_label["max_min"]."".$lang_label["action"]."".__('module_name')."".__('type')."".__('interval')."".__('description')."".__('nc.group')."".__('module_group'); + echo "".__('max_min')."".__('action').""; echo ""; - echo "".$lang_label["delete"]."
    "; diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 7336f00fdd..b5ea152190 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -16,16 +16,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars -require("include/config.php"); +require ("include/config.php"); -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; -else - $id_user = ""; +check_login (); -if (give_acl($id_user, 0, "PM")!=1) { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access Agent Management"); +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'],$REMOTE_ADDR, "ACL Violation", + "Trying to access Agent Management"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/modules/manage_network_components_form_network.php b/pandora_console/godmode/modules/manage_network_components_form_network.php index 25a152ff58..3b7f3895cf 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_network.php +++ b/pandora_console/godmode/modules/manage_network_components_form_network.php @@ -132,16 +132,13 @@ function type_change() ".$lang_label["network_component_management"].""; +echo "

    ".__('network_component_management')."

    "; echo ''; // Different Form url if it's a create or if it's a update form @@ -193,11 +190,11 @@ if ($id_nc != -1) { echo ""; } echo ""; -echo '"; +echo ""; echo ""; echo ""; -echo ""; +echo ""; echo ""; +echo ""; echo '"; -echo ' + - + - + - + - + - + - +
    '.$lang_label["module_name"]; +echo '
    '.__('module_name'); echo ""; //-- Module type combobox -echo "".$lang_label["module_type"]."".__('module_type').""; echo '"; echo "
    ".$lang_label["group"]."".__('group').""; echo ""; -echo "".$lang_label["module_group"]."".__('module_group')."'; echo '"; echo "
    '.$lang_label["module_interval"]; +echo ''.__('module_interval'); echo ''; echo ''; ?> -
    '.$lang_label["comments"]; +echo '
    '.__('comments'); echo ''; echo '"; echo "
    "; echo ""; - echo "
    "; + echo "
    "; echo ""; diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 1b198d5a73..9d6de76095 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -65,10 +65,10 @@ if ($create_layout) { $name, $id_group, $background, $height, $width); $result = mysql_query ($sql); if ($result) { - echo '

    '.lang_string ("create_ok").'

    '; + echo '

    '.__('create_ok').'

    '; $id_layout = mysql_insert_id (); } else { - echo '

    '.lang_string ("create_no").'

    '; + echo '

    '.__('create_no').'

    '; } if (defined ('AJAX')) { exit; @@ -81,9 +81,9 @@ if ($delete_layout) { $sql = sprintf ('DELETE FROM tlayout WHERE id = %d', $id_layout); $result = mysql_query ($sql); if ($result) { - echo '

    '.lang_string ("delete_ok").'

    '; + echo '

    '.__('delete_ok').'

    '; } else { - echo '

    '.lang_string ("delete_no").'

    '; + echo '

    '.__('delete_no').'

    '; } $id_layout = 0; } @@ -108,9 +108,9 @@ if ($update_layout) { $name, $background, $height, $width, $id_layout); $result = mysql_query ($sql); if ($result) { - echo '

    '.lang_string ("update_ok").'

    '; + echo '

    '.__('update_ok').'

    '; } else { - echo '

    '.lang_string ("update_no").'

    '; + echo '

    '.__('update_no').'

    '; } if (defined ('AJAX')) { exit; @@ -165,9 +165,9 @@ if ($create_layout_data) { $result = mysql_query ($sql); if ($result) { - echo '

    '.lang_string ("create_ok").'

    '; + echo '

    '.__('create_ok').'

    '; } else { - echo '

    '.lang_string ("create_no").'

    '; + echo '

    '.__('create_no').'

    '; } if (defined ('AJAX')) { exit; @@ -239,9 +239,9 @@ if ($update_layout_data) { $result = mysql_query ($sql); if ($result) { - echo '

    '.lang_string ("modify_ok").'

    '; + echo '

    '.__('modify_ok').'

    '; } else { - echo '

    '.lang_string ("modify_no").'

    '; + echo '

    '.__('modify_no').'

    '; } } @@ -255,14 +255,14 @@ if ($id_layout) { } if (! $edit_layout && ! $id_layout) { - echo "

    ".lang_string ("reporting")." > ".lang_string ("map_builder")."

    "; + echo "

    ".__('reporting')." > ".__('map_builder')."

    "; $table->width = '500px'; $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('map_name'); - $table->head[1] = lang_string ('group'); - $table->head[2] = lang_string ('delete'); + $table->head[0] = __('map_name'); + $table->head[1] = __('group'); + $table->head[2] = __('delete'); $table->align = array (); $table->align[2] = 'center'; @@ -282,12 +282,12 @@ if (! $edit_layout && ! $id_layout) { echo '
    '; echo '
    '; print_input_hidden ('edit_layout', 1); - print_submit_button (lang_string ('create'), '', false, 'class="sub wand"'); + print_submit_button (__('create'), '', false, 'class="sub wand"'); echo '
    '; echo '
    '; } else { - echo "

    ".lang_string ("reporting")." > "; - echo lang_string ("map_builder"); + echo "

    ".__('reporting')." > "; + echo __('map_builder'); pandora_help ("map_builder"); echo "

    "; @@ -297,17 +297,17 @@ if (! $edit_layout && ! $id_layout) { $table->width = '300px'; $table->data = array (); - $table->data[0][0] = lang_string ('name'); + $table->data[0][0] = __('name'); $table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true); - $table->data[1][0] = lang_string ('group'); + $table->data[1][0] = __('group'); $table->data[1][1] = print_select ($groups, 'id_group', $id_group, '', '', '', true); - $table->data[2][0] = lang_string ('background'); + $table->data[2][0] = __('background'); $table->data[2][1] = print_select ($backgrounds_list, 'background', $background, '', 'None', '', true); if ($id_layout) { - $table->data[3][0] = lang_string ('width'); + $table->data[3][0] = __('width'); $table->data[3][1] = print_input_text ('width', $width, '', 3, 5, true); - $table->data[4][0] = lang_string ('height'); + $table->data[4][0] = __('height'); $table->data[4][1] = print_input_text ('height', $height, '', 3, 5, true); } echo '
    '; @@ -315,11 +315,11 @@ if (! $edit_layout && ! $id_layout) { echo '
    '; if ($id_layout) { - print_submit_button (lang_string ('update'), 'update_layout', false, 'class="sub upd"'); + print_submit_button (__('update'), 'update_layout', false, 'class="sub upd"'); print_input_hidden ('update_layout', 1); print_input_hidden ('id_layout', $id_layout); } else { - print_submit_button (lang_string ('create'), 'create_layout', false, 'class="sub wand"'); + print_submit_button (__('create'), 'create_layout', false, 'class="sub wand"'); print_input_hidden ('create_layout', 1); } echo '
    '; @@ -327,7 +327,7 @@ if (! $edit_layout && ! $id_layout) { if ($id_layout) { /* Show visual map preview */ - echo '

    '.lang_string ('preview').'

    '; + echo '

    '.__('preview').'

    '; print_pandora_visual_map ($id_layout, false, true); $images_list = array (); @@ -345,32 +345,32 @@ if (! $edit_layout && ! $id_layout) { /* Layout data trash */ echo ''; echo '
    '; - echo '

    '.lang_string ('Map element trash').'

    '; - echo lang_string ('Drag an element here to delete from the map'); + echo '

    '.__('Map element trash').'

    '; + echo __('Drag an element here to delete from the map'); echo ' '; print_input_hidden ('delete_layout_data', 1); print_input_hidden ('id_layout', $id_layout); echo '
    '; - print_submit_button (lang_string ('delete'), 'delete_buttons', true, 'class="sub delete"'); + print_submit_button (__('delete'), 'delete_buttons', true, 'class="sub delete"'); echo '
    '; echo '
    '; echo '
    '; /* Layout_data editor form */ $intervals = array (); - $intervals[1] = lang_string ('Hour'); - $intervals[2] = "2 ".lang_string ('Hours'); - $intervals[3] = "3 ".lang_string ('Hours'); - $intervals[6] = "6 ".lang_string ('Hours'); - $intervals[12] = "12 ".lang_string ('Hours'); - $intervals[24] = lang_string ('Last day'); - $intervals[48] = "2 ". lang_string ('days'); - $intervals[168] = lang_string ('Last week'); - $intervals[360] = lang_string ('15 days'); - $intervals[720] = lang_string ('Last Month'); - $intervals[1440] = lang_string ('Two Months'); - $intervals[4320] = lang_string ('Six Months'); + $intervals[1] = __('Hour'); + $intervals[2] = "2 ".__('Hours'); + $intervals[3] = "3 ".__('Hours'); + $intervals[6] = "6 ".__('Hours'); + $intervals[12] = "12 ".__('Hours'); + $intervals[24] = __('Last day'); + $intervals[48] = "2 ". __('days'); + $intervals[168] = __('Last week'); + $intervals[360] = __('15 days'); + $intervals[720] = __('Last Month'); + $intervals[1440] = __('Two Months'); + $intervals[4320] = __('Six Months'); $all_agents = get_agents_in_group ($id_group); $agents = array (); @@ -382,8 +382,8 @@ if (! $edit_layout && ! $id_layout) { } echo '
    '; - echo '

    '.lang_string ('Map element editor').'

    '; - echo lang_string ('Drag an element here to edit the properties'); + echo '

    '.__('Map element editor').'

    '; + echo __('Drag an element here to edit the properties'); $table->data = array (); $table->id = 'table_layout_data'; @@ -391,29 +391,29 @@ if (! $edit_layout && ! $id_layout) { $table->rowstyle[3] = 'display: none'; $table->rowstyle[4] = 'display: none'; - $table->data[0][0] = lang_string ('label'); + $table->data[0][0] = __('label'); $table->data[0][1] = print_input_text ('label', '', '', 20, 200, true); - $table->data[1][0] = lang_string ('label_color'); + $table->data[1][0] = __('label_color'); $table->data[1][1] = print_input_text ('label_color', '#000000', '', 7, 7, true); - $table->data[2][0] = lang_string ('type'); + $table->data[2][0] = __('type'); $table->data[2][1] = print_select (get_layout_data_types (), 'type', '', '', '', '', true); - $table->data[3][0] = lang_string ('height'); + $table->data[3][0] = __('height'); $table->data[3][1] = print_input_text ('height', '', '', 5, 5, true); - $table->data[4][0] = lang_string ('width'); + $table->data[4][0] = __('width'); $table->data[4][1] = print_input_text ('width', '', '', 5, 5, true); - $table->data[5][0] = lang_string ('agent'); + $table->data[5][0] = __('agent'); $table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true); - $table->data[6][0] = lang_string ('module'); + $table->data[6][0] = __('module'); $table->data[6][1] = print_select (array (), 'module', '', '', '--', 0, true); - $table->data[7][0] = lang_string ('period'); + $table->data[7][0] = __('period'); $table->data[7][1] = print_select ($intervals, 'period', '', '', '--', 0, true); - $table->data[8][0] = lang_string ('image'); + $table->data[8][0] = __('image'); $table->data[8][1] = print_select ($images_list, 'image', '', '', 'None', '', true); $table->data[8][1] .= '
    '; - $table->data[9][0] = lang_string ('parent'); + $table->data[9][0] = __('parent'); $table->data[9][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout, 'parent_item', '', '', 'None', '', true); - $table->data[10][0] = lang_string ('map_linked'); + $table->data[10][0] = __('map_linked'); $table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout, 'map_linked', '', '', 'None', '', true); @@ -424,7 +424,7 @@ if (! $edit_layout && ! $id_layout) { print_input_hidden ('id_layout', $id_layout); print_input_hidden ('id_layout_data', 0); echo '
    '; - print_submit_button (lang_string ('create'), 'create_layout_data_button', false, 'class="sub wand"'); + print_submit_button (__('create'), 'create_layout_data_button', false, 'class="sub wand"'); echo '
    '; echo ''; echo '
    '; @@ -449,7 +449,7 @@ function agent_changed (event, id_agent, selected) { id_agent = this.value; $('#form_layout_data_editor #module').attr ('disabled', 1); $('#form_layout_data_editor #module').empty (); - $('#form_layout_data_editor #module').append (new Option ("...", 0)); + $('#form_layout_data_editor #module').append (new Option ("...", 0)); jQuery.post ('ajax.php', {page: "operation/agentes/ver_agente", get_agent_modules_json: 1, @@ -552,7 +552,7 @@ $(document).ready (function () { $("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1); $("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0); $("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id); - $("#form_layout_data_editor #submit-create_layout_data_button").attr ('value', "").removeClass ('wand').addClass ('upd'); + $("#form_layout_data_editor #submit-create_layout_data_button").attr ('value', "").removeClass ('wand').addClass ('upd'); $("#form_layout_data_editor #text-label_color").attr ('value', data['label_color']); $(".ColorPickerDivSample").css ('background-color', data['label_color']); agent_changed (null, data['id_agent'], data['id_agente_modulo']); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9b9a9b1d66..bbcdf3704b 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -17,11 +17,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Login check -$id_user=$_SESSION["id_usuario"]; -global $REMOTE_ADDR; +require ("include/config.php"); -if (give_acl ($id_user, 0, "AW") != 1 && dame_admin ($id_user) != 1) { - audit_db ($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); +check_login (); + +if (! give_acl ($config['id_user'], 0, "AW")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access graph builder"); include ("general/noaccess.php"); exit; } @@ -68,9 +70,9 @@ if ($delete_report_content) { $sql = sprintf ('DELETE FROM treport_content WHERE id_rc = %d', $id_report_content); $result = mysql_query ($sql); if ($result) - echo "

    ".lang_string ('delete_ok')."

    "; + echo "

    ".__('delete_ok')."

    "; else - echo "

    ".lang_string ('delete_no')."

    "; + echo "

    ".__('delete_no')."

    "; } // Move content up @@ -104,16 +106,16 @@ if ($delete_report) { $res = mysql_query ($sql); $res2 = mysql_query ($sql2); if ($res AND $res2) - echo "

    ".lang_string ('delete_reporting_ok')."

    "; + echo "

    ".__('delete_reporting_ok')."

    "; else - echo "

    ".lang_string ('delete_reporting_no')."

    "; + echo "

    ".__('delete_reporting_no')."

    "; $id_report = 0; } // Add module SQL code if ($add_content) { if (! $id_report) { - audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in report builder"); + audit_db ($config['id_user'], $REMOTE_ADDR, "Hack attempt", "Parameter trash in report builder"); include ("general/noaccess.php"); exit (); } @@ -131,7 +133,7 @@ if ($add_content) { $id_agent_module ? $id_agent_module : "NULL", $order, $type, $period * 3600); if ($result = mysql_query($sql)) { - echo '

    '.lang_string ('create_reporting_ok').'

    '; + echo '

    '.__('create_reporting_ok').'

    '; $id_agent = 0; $id_agent_module = 0; $report_id_group = 0; @@ -142,7 +144,7 @@ if ($add_content) { $sla_min = 0; $sla_limit = 0; } else { - echo '

    '.lang_string ('create_reporting_no')."

    "; + echo '

    '.__('create_reporting_no')."

    "; /* Do not unset so the values are kept in the form */ } } @@ -154,9 +156,9 @@ if ($create_report) { $report_name, $report_description, $config['id_user'], $report_private, $report_id_group); $result = mysql_query ($sql); if ($result) - echo "

    ".lang_string ('create_reporting_ok')."

    "; + echo "

    ".__('create_reporting_ok')."

    "; else - echo "

    ".lang_string ('create_reporting_no')."

    "; + echo "

    ".__('create_reporting_no')."

    "; $id_report = mysql_insert_id (); } @@ -169,9 +171,9 @@ if ($update_report) { $report_private, $id_report); $result = mysql_query ($sql); if ($result) - echo "

    ".lang_string ('modify_ok')."

    "; + echo "

    ".__('modify_ok')."

    "; else - echo "

    ".lang_string ('modify_no')."

    "; + echo "

    ".__('modify_no')."

    "; } if ($id_report) { @@ -214,11 +216,11 @@ if ($edit_sla_report_content) { if ($id_module) { $result = mysql_query ($sql); if ($result) - echo "

    ".lang_string ('add_sla_ok')."

    "; + echo "

    ".__('add_sla_ok')."

    "; else - echo "

    ".lang_string ('add_sla_no')."

    "; + echo "

    ".__('add_sla_no')."

    "; } else { - echo "

    ".lang_string ('sla_module_is_null')."

    "; + echo "

    ".__('sla_module_is_null')."

    "; } } if ($delete_sla) { @@ -226,18 +228,18 @@ if ($edit_sla_report_content) { $sql = sprintf ('DELETE FROM treport_content_sla_combined WHERE id = %d', $id_sla); $result = mysql_query ($sql); if ($result) - echo "

    ".lang_string ('delete_sla_ok')."

    "; + echo "

    ".__('delete_sla_ok')."

    "; else - echo "

    ".lang_string ('delete_sla_no')."

    "; + echo "

    ".__('delete_sla_no')."

    "; } $report_content = get_db_row ('treport_content', 'id_rc', $id_report_content); /* Show all SLAs defined in the report content */ - echo '

    '.lang_string ('reporting')." > "; - echo lang_string ('custom_reporting_builder')." > "; + echo '

    '.__('reporting')." > "; + echo __('custom_reporting_builder')." > "; echo ''.$report['name'].'

    '; - echo '

    '.lang_string ('defined_slas')."

    "; + echo '

    '.__('defined_slas')."

    "; $table->id = 'table-sla-list'; $table->width = '500px'; @@ -245,12 +247,12 @@ if ($edit_sla_report_content) { $table->align[5] = 'center'; $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('agent'); - $table->head[1] = lang_string ('module'); - $table->head[2] = lang_string ('sla_min'); - $table->head[3] = lang_string ('sla_max'); - $table->head[4] = lang_string ('sla_limit'); - $table->head[5] = lang_string ('delete'); + $table->head[0] = __('agent'); + $table->head[1] = __('module'); + $table->head[2] = __('sla_min'); + $table->head[3] = __('sla_max'); + $table->head[4] = __('sla_limit'); + $table->head[5] = __('delete'); $slas = get_db_all_rows_field_filter ('treport_content_sla_combined', 'id_report_content', $id_report_content); foreach ($slas as $sla) { @@ -272,7 +274,7 @@ if ($edit_sla_report_content) { print_table ($table); } - echo "

    ".lang_string ('sla_construction')."

    "; + echo "

    ".__('sla_construction')."

    "; $table->id = 'table-add-sla'; $table->width = '500px'; $table->data = array (); @@ -281,15 +283,15 @@ if ($edit_sla_report_content) { $table->size[0] = '150px'; $table->head = array (); $table->style[0] = 'font-weight: bold'; - $table->data[0][0] = lang_string ('agent'); + $table->data[0][0] = __('agent'); $table->data[0][1] = print_select ($agents, 'id_agent', 0, '', '--', 0, true); - $table->data[1][0] = lang_string ('module'); + $table->data[1][0] = __('module'); $table->data[1][1] = print_select (array (), 'id_module', 0, '', '--', 0, true); - $table->data[2][0] = lang_string ('sla_min'); + $table->data[2][0] = __('sla_min'); $table->data[2][1] = print_input_text ('sla_min', $sla_min, '', 5, 10, true); - $table->data[3][0] = lang_string ('sla_max'); + $table->data[3][0] = __('sla_max'); $table->data[3][1] = print_input_text ('sla_max', $sla_max, '', 5, 10, true); - $table->data[4][0] = lang_string ('sla_limit'); + $table->data[4][0] = __('sla_limit'); $table->data[4][1] = print_input_text ('sla_limit', $sla_limit, '', 5, 10, true); echo '
    '; - print_submit_button (lang_string ('create'), 'add', false, 'class="sub wand"'); + print_submit_button (__('create'), 'add', false, 'class="sub wand"'); echo ''; echo '
    '; } else if ($edit_report || $id_report) { @@ -308,17 +310,17 @@ if ($edit_sla_report_content) { $id_agent = $_POST["id_agent"]; else $id_agent = 0; - echo "

    ".lang_string ('reporting')." > "; - echo lang_string ('custom_reporting_builder')."

    "; + echo "

    ".__('reporting')." > "; + echo __('custom_reporting_builder')."

    "; $table->id = 'table-edit-report'; $table->width = '500px'; $table->data = array (); $table->style = array (); $table->style[0] = 'font-weight: bold'; - $table->data[0][0] = lang_string ('report_name'); + $table->data[0][0] = __('report_name'); $table->data[0][1] = print_input_text ('report_name', $report_name, '', 35, 150, true); - $table->data[1][0] = lang_string ('group'); + $table->data[1][0] = __('group'); if ($report_id_group) { /* Changing the group is not allowed. */ $table->data[1][1] = ''; } $table->data[1][1] .= ''; - $table->data[2][0] = lang_string ('private'); + $table->data[2][0] = __('private'); $table->data[2][1] = print_checkbox ('report_private', 1, $report_private, true); - $table->data[3][0] = lang_string ('description'); + $table->data[3][0] = __('description'); $table->data[3][1] = print_textarea ('report_description', 3, 40, $report_description, '', true); echo "
    "; @@ -345,17 +347,17 @@ if ($edit_sla_report_content) { if ($id_report) { print_input_hidden ('id_report', $id_report); print_input_hidden ('update_report', 1); - print_submit_button (lang_string ('update'), 'submit', false, 'class="sub next"'); + print_submit_button (__('update'), 'submit', false, 'class="sub next"'); } else { print_input_hidden ('create_report', 1); - print_submit_button (lang_string ('create'), 'submit', false, 'class="sub wand"'); + print_submit_button (__('create'), 'submit', false, 'class="sub wand"'); } echo ""; echo "
    "; if ($id_report) { // Part 2 - Add new items to report - echo "

    ".lang_string ('reporting_item_add')."

    "; + echo "

    ".__('reporting_item_add')."

    "; /* We're reusing some $table attributes */ $table->id = 'table-add-item'; @@ -367,29 +369,29 @@ if ($edit_sla_report_content) { $table->size[0] = '200px'; $table->data = array (); - $table->data[0][0] = lang_string ('reporting_type'); + $table->data[0][0] = __('reporting_type'); $types = get_report_types (); asort ($types); $table->data[0][1] = print_select ($types, 'type', -1, '', '--', -1, true); - $table->data[1][0] = lang_string ('period'); + $table->data[1][0] = __('period'); $periods = array (); - $periods[1] = lang_string ('hour'); - $periods[2] = '2 '.lang_string ('hours'); - $periods[3] = '3 '.lang_string ('hours'); - $periods[6] = '6 '.lang_string ('hours'); - $periods[12] = '12 '.lang_string ('hours'); - $periods[24] = lang_string ('last_day'); - $periods[48] = lang_string ('two_days'); - $periods[180] = lang_string ('last_week'); - $periods[360] = lang_string ('last_two_weeks'); - $periods[720] = lang_string ('last_month'); - $periods[4320] = lang_string ('six_months'); + $periods[1] = __('hour'); + $periods[2] = '2 '.__('hours'); + $periods[3] = '3 '.__('hours'); + $periods[6] = '6 '.__('hours'); + $periods[12] = '12 '.__('hours'); + $periods[24] = __('last_day'); + $periods[48] = __('two_days'); + $periods[180] = __('last_week'); + $periods[360] = __('last_two_weeks'); + $periods[720] = __('last_month'); + $periods[4320] = __('six_months'); $table->data[1][1] = print_select ($periods, 'period', 0, '', '--', 0, true); - $table->data[2][0] = lang_string ('source_agent'); + $table->data[2][0] = __('source_agent'); $table->data[2][1] = print_select ($agents, 'id_agent', $id_agent, '', '--', 0, true); - $table->data[3][0] = lang_string ('module'); + $table->data[3][0] = __('module'); $modules = array (); if ($id_agent) { $sql = sprintf ('SELECT id_agente_modulo, LOWER(nombre) FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent); @@ -397,7 +399,7 @@ if ($edit_sla_report_content) { } $table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true); - $table->data[4][0] = lang_string ('custom_graph_name'); + $table->data[4][0] = __('custom_graph_name'); $table->data[4][1] = print_select_from_sql ('SELECT id_graph, name FROM tgraph', 'id_custom_graph', 0, '', '--', 0, true); @@ -406,30 +408,30 @@ if ($edit_sla_report_content) { echo '
    '; print_input_hidden ('add_content', 1); print_input_hidden ('id_report', $id_report); - print_submit_button (lang_string ('add'), 'add', false, 'class="sub wand"'); + print_submit_button (__('add'), 'add', false, 'class="sub wand"'); echo "
    "; echo ""; // Part 3 - List of already assigned report items - echo "

    ".lang_string ('report_items')."

    "; + echo "

    ".__('report_items')."

    "; $table->id = 'table-assigned-reports'; $table->width = '90%'; $table->data = array (); $table->head = array (); $table->size = array (); $table->rowstyle = array (); - $table->head[0] = lang_string ('order'); - $table->head[1] = lang_string ('type'); - $table->head[2] = lang_string ('agent'); - $table->head[3] = lang_string ('module'); - $table->head[4] = lang_string ('period'); - $table->head[5] = lang_string ('Options'); + $table->head[0] = __('order'); + $table->head[1] = __('type'); + $table->head[2] = __('agent'); + $table->head[3] = __('module'); + $table->head[4] = __('period'); + $table->head[5] = __('Options'); $table->align = array (); $table->align[0] = 'center'; $table->align[5] = 'center'; if ($report_id_user == $config['id_user']) { $table->align[6] = 'center'; - $table->head[6] = lang_string ('delete'); + $table->head[6] = __('delete'); } $sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report); @@ -445,12 +447,12 @@ if ($edit_sla_report_content) { if ($first_id != $report_content['id_rc']) { $data[0] .= '
    '; + '">'; } if ($last_id != $report_content['id_rc']) { $data[0] .= ''; + '">'; } $data[1] = get_report_name ($report_content['type']); $data[2] = '--'; @@ -475,8 +477,8 @@ if ($edit_sla_report_content) { } } else { // Report LIST - echo "

    ".lang_string ('reporting')." > "; - echo lang_string ('custom_reporting')."

    "; + echo "

    ".__('reporting')." > "; + echo __('custom_reporting')."

    "; $reports = get_db_all_rows_in_table ('treport', 'name'); $table->width = '0px'; @@ -487,9 +489,9 @@ if ($edit_sla_report_content) { $table->align = array (); $table->align[2] = 'center'; $table->data = array (); - $table->head[0] = lang_string ('report_name'); - $table->head[1] = lang_string ('description'); - $table->head[2] = lang_string ('delete'); + $table->head[0] = __('report_name'); + $table->head[1] = __('description'); + $table->head[2] = __('delete'); foreach ($reports as $report) { if ($report["private"] || $report["id_user"] != $config['id_user']) @@ -506,13 +508,13 @@ if ($edit_sla_report_content) { } print_table ($table); } else { - echo "
    ".lang_string ('no_reporting_def')."
    "; + echo "
    ".__('no_reporting_def')."
    "; } echo '
    '; echo '
    '; print_input_hidden ('edit_report', 1); - print_submit_button (lang_string ('Create report'), 'create', false, 'class="sub next"'); + print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); echo "
    "; echo "
    "; } diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index 5b5d20f590..5489374499 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -17,12 +17,15 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars -global $config; +require ("include/config.php"); -if ( (give_acl($id_user, 0, "LM")==0)){ - audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Recon Task Management"); - require ("general/noaccess.php"); - exit; +check_login (); + +if (! give_acl ($config['id_user'], 0, "LM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Recon Task Management"); + require ("general/noaccess.php"); + exit; } // -------------------------------- @@ -33,9 +36,9 @@ if (isset($_GET["delete"])) { $sql = "DELETE FROM trecon_task WHERE id_rt = $id "; $result = mysql_query($sql); if ($result) - echo "

    ".$lang_label["delete_ok"]."

    "; + echo "

    ".__('delete_ok')."

    "; else - echo "

    ".$lang_label["delete_no"]."

    "; + echo "

    ".__('delete_no')."

    "; } @@ -63,9 +66,9 @@ if (isset($_GET["update"])) { id_network_profile = $id_network_profile WHERE id_rt = $id"; $result=mysql_query($sql); if ($result) - echo "

    ".$lang_label["modify_ok"]."

    "; + echo "

    ".__('modify_ok')."

    "; else - echo "

    ".$lang_label["modify_no"]."

    "; + echo "

    ".__('modify_no')."

    "; } // -------------------------------- @@ -75,30 +78,30 @@ if (isset($_GET["create"])) { $sql = "INSERT INTO trecon_task (name, subnet, description, id_recon_server, create_incident, id_group, id_network_profile, interval_sweep, id_os) VALUES ( '$name', '$network', '$description', $id_recon_server, $create_incident, $id_group, $id_network_profile, $interval, $id_os)"; $result=mysql_query($sql); if ($result) - echo "

    ".$lang_label["create_ok"]."

    "; + echo "

    ".__('create_ok')."

    "; else - echo "

    ".$lang_label["create_no"]."

    "; + echo "

    ".__('create_no')."

    "; } // -------------------------------- // SHOW TABLE WITH ALL RECON TASKs // -------------------------------- -echo "

    ".$lang_label["view_servers"]." > "; -echo $lang_label["manage_recontask"]."

    "; +echo "

    ".__('view_servers')." > "; +echo __('manage_recontask')."

    "; $query="SELECT * FROM trecon_task"; $result=mysql_query($query); $color=1; if (mysql_num_rows($result)){ echo ""; - echo "
    ".$lang_label["name"]; - echo "".lang_string ('type'); - echo "".lang_string ('network'); - echo "".lang_string ('network_profile'); - echo "".lang_string ('group'); - echo "".lang_string ('incident'); - echo "".lang_string ('OS'); - echo "".lang_string ('interval'); - echo "".lang_string ('Action'); + echo "
    ".__('name'); + echo "".__('type'); + echo "".__('network'); + echo "".__('network_profile'); + echo "".__('group'); + echo "".__('incident'); + echo "".__('OS'); + echo "".__('interval'); + echo "".__('Action'); } while ($row=mysql_fetch_array($result)){ $id_rt = $row["id_rt"]; @@ -145,9 +148,9 @@ while ($row=mysql_fetch_array($result)){ // INCIDENT echo ""; if ($create_incident == 1) - echo $lang_label["yes"]; + echo __('yes'); else - echo $lang_label["no"]; + echo __('no'); // OS echo ""; @@ -169,13 +172,13 @@ while ($row=mysql_fetch_array($result)){ echo "
    "; if (!mysql_num_rows($result)){ - echo "
    ".$lang_label["no_rtask"]."
    "; + echo "
    ".__('no_rtask')."
    "; } echo ""; echo "
    "; echo "
    "; -echo ""; +echo ""; echo "
    "; ?> diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index 521321605e..869abdeb2b 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -16,16 +16,18 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars -require("include/config.php"); +require ("include/config.php"); -if ((comprueba_login() != 0) || (give_acl($id_user, 0, "PM")!=1)) { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access Agent Management"); +check_login (); + +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Agent Management"); require ("general/noaccess.php"); - exit; + return; } -if (isset($_GET["update"])){ // Edit mode +if (isset ($_GET["update"])) { // Edit mode $id_rt = $_GET["update"]; $query="SELECT * FROM trecon_task where id_rt = $id_rt"; $result=mysql_query($query); @@ -41,7 +43,7 @@ if (isset($_GET["update"])){ // Edit mode $id_network_profile = $row["id_network_profile"]; $id_os = $row["id_os"]; -} elseif (isset($_GET["create"])){ +} elseif (isset ($_GET["create"])) { $id_rt = -1; $name = ""; $network = ""; @@ -55,8 +57,8 @@ if (isset($_GET["update"])){ // Edit mode $id_os = 10; // Other } -echo '

    '.$lang_label["view_servers"].' > '; -echo $lang_label["manage_recontask"]; +echo '

    '.__('view_servers').' > '; +echo __('manage_recontask'); pandora_help ("recontask"); echo '

    '; echo ''; @@ -68,12 +70,12 @@ else echo ""; // Name -echo '"; -echo ''; +echo ''; echo ''; // Interval -echo ''; +echo ''; echo '"; -echo ""; +echo ""; echo ""; // OS -echo ""; +echo ""; echo ""; // Group echo ""; -echo ""; +echo ""; echo ""; // Incident echo ""; -echo ""; +echo ""; echo ""; echo ""; // Comments -echo ''; + echo ''; + echo ''; - echo '
    '.$lang_label["task_name"]; +echo '
    '.__('task_name'); echo ""; // Recon server -echo "".$lang_label["recon_server"]; -echo ' '.$lang_label["recon_server_help"].''; +echo "".__('recon_server'); +echo ' '.__('recon_server_help').''; echo ""; echo '"; // Network echo "
    '.$lang_label["network"].''.__('network').''; echo ''.$lang_label["interval"].''.__('interval').''; echo ""; // Network profile echo "
    ".lang_string ("network_profile") . "".__('network_profile') . ""; echo "". lang_string ("OS") . "". __('OS') . ""; echo "
    ".$lang_label["group"]."".__('group').""; echo "
    ".$lang_label["incident"]."".__('incident').""; echo "
    '.$lang_label["comments"]; +echo '
    '.__('comments'); echo ''; echo '
    '.__('description').'
    '; - echo ''; - echo '
    '; - - if ($create != ""){ - echo ""; - } else { - echo ""; - } - echo '
    '; + echo '
    '; + echo ''; + echo '
    '; + + if ($create != ""){ + echo ""; + } else { + echo ""; + } + echo '
    '; } else { - echo "

    ". lang_string ("Plugins registered in Pandora FMS")."

    "; + echo "

    ". __('Plugins registered in Pandora FMS')."

    "; // If not edition or insert, then list available plugins - $sql1='SELECT * FROM tplugin ORDER BY name'; - $result=mysql_query($sql1); - if (mysql_num_rows($result) > 0){ - echo ''; - echo ""; - echo "
    ".lang_string("name"); - echo "".lang_string("execute"); - echo "".lang_string("delete"); - $color = 0; - while ($row=mysql_fetch_array($result)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo "
    "; - echo ""; - echo $row["name"]; - echo ""; - echo ""; - echo $row["execute"]; - echo ""; - echo ""; - } - echo "
    "; - } else { - echo '
    '. lang_string ("There is no plugins in the system"); - echo "
    "; - } - echo ""; - echo "
    "; - echo "
    "; - echo ""; - echo "
    "; - + $sql1='SELECT * FROM tplugin ORDER BY name'; + $result=mysql_query($sql1); + if (mysql_num_rows($result) > 0){ + echo ''; + echo ""; + echo "
    ".__('name'); + echo "".__('execute'); + echo "".__('delete'); + $color = 0; + while ($row=mysql_fetch_array($result)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo "
    "; + echo ""; + echo $row["name"]; + echo ""; + echo ""; + echo $row["execute"]; + echo ""; + echo ""; + } + echo "
    "; + } else { + echo '
    '. __('There is no plugins in the system'); + echo "
    "; + } + echo ""; + echo "
    "; + echo ""; + echo ""; + echo "
    "; } ?> diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index 2e7a14f5b6..66a01000be 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -35,9 +35,9 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] $sql_insert="INSERT INTO tlink (name,link) VALUES ('$name','$link') "; $result=mysql_query($sql_insert); if (! $result) - echo "

    ".$lang_label["create_link_no"]."

    "; + echo "

    ".__('create_link_no')."

    "; else { - echo "

    ".$lang_label["create_link_ok"]."

    "; + echo "

    ".__('create_link_ok')."

    "; $id_link = mysql_insert_id(); } } @@ -49,9 +49,9 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] $sql_update ="UPDATE tlink SET name = '".$name."', link ='".$link."' WHERE id_link = '".$id_link."'"; $result=mysql_query($sql_update); if (! $result) - echo "

    ".$lang_label["modify_link_no"]."

    "; + echo "

    ".__('modify_link_no')."

    "; else - echo "

    ".$lang_label["modify_link_ok"]."

    "; + echo "

    ".__('modify_link_ok')."

    "; } if (isset($_GET["borrar"])){ // if delete @@ -59,9 +59,9 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] $sql_delete= "DELETE FROM tlink WHERE id_link = ".$id_link; $result=mysql_query($sql_delete); if (! $result) - echo "

    ".$lang_label["delete_link_no"]."

    "; + echo "

    ".__('delete_link_no')."

    "; else - echo "

    ".$lang_label["delete_link_ok"]."

    "; + echo "

    ".__('delete_link_ok')."

    "; } @@ -76,7 +76,7 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] $nombre = $row["name"]; $link = $row["link"]; } - else echo "

    ".$lang_label["name_error"]."

    "; + else echo "

    ".__('name_error')."

    "; } else { // form_add $creation_mode =1; $nombre = ""; @@ -84,8 +84,8 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] } // Create link - echo "

    ".$lang_label["setup_screen"]." > "; - echo $lang_label["link_management"]."

    "; + echo "

    ".__('setup_screen')." > "; + echo __('link_management')."

    "; echo ''; echo ''; if ($creation_mode == 1) @@ -97,26 +97,26 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] "; echo ' - + - + '; echo ''; echo "
    '.$lang_label["link_name"].''.__('link_name').' '; echo '
    '.$lang_label["link"].''.__('link').'
    "; echo ""; echo "
    - "; + "; echo '
    '; } else { // Main list view for Links editor - echo "

    ".$lang_label["setup_screen"]." > "; - echo $lang_label["link_management"]."

    "; + echo "

    ".__('setup_screen')." > "; + echo __('link_management')."

    "; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; $sql1='SELECT * FROM tlink ORDER BY name'; $result=mysql_query($sql1); $color=1; @@ -130,13 +130,13 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'] $color = 1; } echo ""; - echo ''; + echo ''; } echo "
    ".$lang_label["link_name"]."".$lang_label["delete"]."".__('link_name')."".__('delete')."
    ".$row["name"]."
    "; echo ""; echo "
    "; echo "
    "; - echo ""; + echo ""; echo "
    "; } -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 0b20ddfc71..6a67c8515d 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -6,139 +6,139 @@ // Raul Mateos , 2005-2007 // Load global vars -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; - if (give_acl($id_user, 0, "PM")==1) { +require_once ("include/config.php"); - if (isset($_POST["create"])){ // If create - $subject = entrada_limpia($_POST["subject"]); - $text = entrada_limpia($_POST["text"]); - $timestamp = $ahora=date("Y/m/d H:i:s"); - $author = $id_user; - - $sql_insert="INSERT INTO tnews (subject, text, author, timestamp) VALUES ('$subject','$text', '$author', '$timestamp') "; - $result=mysql_query($sql_insert); - if (! $result) - echo "

    ".$lang_label["create_no"]."

    "; - else { - echo "

    ".$lang_label["create_ok"]."

    "; - $id_link = mysql_insert_id(); - } - } +check_login (); - if (isset($_POST["update"])){ // if update - $id_news = entrada_limpia($_POST["id_news"]); - $subject = entrada_limpia($_POST["subject"]); - $text = entrada_limpia($_POST["text"]); - $timestamp = $ahora=date("Y/m/d H:i:s"); - $sql_update ="UPDATE tnews SET subject = '".$subject."', text ='".$text."', timestamp = '$timestamp' WHERE id_news = '".$id_news."'"; - $result=mysql_query($sql_update); - if (! $result) - echo "

    ".$lang_label["modify_no"]."

    "; - else - echo "

    ".$lang_label["modify_ok"]."

    "; - } +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Link Management"); + require ("general/noaccess.php"); + return; +} + +if (isset ($_POST["create"])) { // If create + $subject = get_parameter ("subject"); + $text = get_parameter ("text"); + $timestamp = $ahora = date ("Y/m/d H:i:s"); + $author = $config['id_user']; - if (isset($_GET["borrar"])){ // if delete - $id_news = entrada_limpia($_GET["borrar"]); - $sql_delete= "DELETE FROM tnews WHERE id_news = ".$id_news; - $result=mysql_query($sql_delete); - if (! $result) - echo "

    ".$lang_label["delete_no"]."

    "; - else - echo "

    ".$lang_label["delete_ok"]."

    "; - + $sql = "INSERT INTO tnews (subject, text, author, timestamp) VALUES ('$subject','$text', '$author', '$timestamp') "; + $result = mysql_query ($sql_insert); + if (! $result) { + echo "

    ".__('create_no')."

    "; + } else { + echo "

    ".__('create_ok')."

    "; + $id_link = mysql_insert_id (); } +} - // Main form view for Links edit - if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){ - if (isset($_GET["form_edit"])){ - $creation_mode = 0; - $id_news = entrada_limpia($_GET["id_news"]); - $sql1='SELECT * FROM tnews WHERE id_news = '.$id_news; - $result=mysql_query($sql1); - if ($row=mysql_fetch_array($result)){ - $subject = $row["subject"]; - $text = $row["text"]; - $author = $row["author"]; - $timestamp = $row["timestamp"]; - } - else echo "

    ".$lang_label["name_error"]."

    "; - } else { // form_add - $creation_mode =1; - $text = ""; - $subject = ""; - $author = $id_user; +if (isset ($_POST["update"])) { // if update + $id_news = get_parameter ("id_news"); + $subject = get_parameter ("subject"); + $text = get_parameter ("text"); + $timestamp = $ahora = date("Y/m/d H:i:s"); + $sql_update ="UPDATE tnews SET subject = '".$subject."', text ='".$text."', timestamp = '$timestamp' WHERE id_news = '".$id_news."'"; + $result = mysql_query($sql_update); + if (! $result) + echo "

    ".__('modify_no')."

    "; + else + echo "

    ".__('modify_ok')."

    "; +} + +if (isset ($_GET["borrar"])) { // if delete + $id_news = get_parameter ("borrar"); + $sql_delete = "DELETE FROM tnews WHERE id_news = ".$id_news; + $result = mysql_query ($sql_delete); + if (! $result) + echo "

    ".__('delete_no')."

    "; + else + echo "

    ".__('delete_ok')."

    "; +} + +// Main form view for Links edit +if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) { + if (isset($_GET["form_edit"])) { + $creation_mode = 0; + $id_news = get_parameter ("id_news"); + $sql = 'SELECT * FROM tnews WHERE id_news = '.$id_news; + $result = mysql_query ($sql); + if ($row = mysql_fetch_array ($result)) { + $subject = $row["subject"]; + $text = $row["text"]; + $author = $row["author"]; + $timestamp = $row["timestamp"]; + } else { + echo "

    ".__('name_error')."

    "; } - - // Create news - echo "

    ".$lang_label["setup_screen"]." > "; - echo $lang_label["site_news_management"]."

    "; - echo ''; - echo ''; - if ($creation_mode == 1) - echo ""; - else - echo ""; - echo ""; - echo ' - - - - '; - echo ''; - echo "
    '.$lang_label["subject"].''; - echo '
    '.$lang_label["text"].' -
    "; - echo ""; - echo "
    - "; - echo '
    '; + } else { // form_add + $creation_mode =1; + $text = ""; + $subject = ""; + $author = $config['id_user']; } - else { // Main list view for Links editor - echo "

    ".$lang_label["setup_screen"]." > "; - echo $lang_label["site_news_management"]."

    "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $sql1='SELECT * FROM tnews ORDER BY timestamp'; - $result=mysql_query($sql1); - $color=1; - while ($row=mysql_fetch_array($result)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo ""; - - echo ""; - echo ""; - - echo ''; + // Create news + echo "

    ".__('setup_screen')." > "; + echo __('site_news_management')."

    "; + echo '
    ".$lang_label["subject"]."".$lang_label["author"]."".$lang_label["timestamp"]."".$lang_label["delete"]."
    ".$row["subject"]."".$row["author"]."".$row["timestamp"]."
    '; + echo ''; + if ($creation_mode == 1) + echo ""; + else + echo ""; + echo ""; + echo ' + + + + '; + echo ''; + echo "
    '.__('subject').''; + echo '
    '.__('text').' +
    "; + echo ""; + echo "
    + "; + echo '
    '; +} else { // Main list view for Links editor + echo "

    ".__('setup_screen')." > "; + echo __('site_news_management')."

    "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $sql = 'SELECT * FROM tnews ORDER BY timestamp'; + $result = mysql_query ($sql); + $color = 1; + while ($row=mysql_fetch_array($result)){ + if ($color == 1) { + $tdcolor = "datos"; + $color = 0; } - echo "
    ".__('subject')."".__('author')."".__('timestamp')."".__('delete')."
    "; - echo ""; - echo "
    "; - echo "
    "; - echo ""; - echo "
    "; -} // Fin bloque else -} else { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Link Management"); - require ("general/noaccess.php"); - } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo "
    ".$row["subject"]."".$row["author"]."".$row["timestamp"]."
    "; + echo ""; + echo "
    "; + echo "
    "; + echo ""; + echo "
    "; +} +?> diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index b53ee1da46..a15bf83845 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -63,49 +63,49 @@ if ($update_settings) { mysql_query ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'"); } -echo "

    ".lang_string ("setup_screen")." > "; -echo lang_string ("general_config")."

    "; +echo "

    ".__('setup_screen')." > "; +echo __('general_config')."

    "; $file_styles = list_files('include/styles/', "pandora", 1, 0); $table->width = '500px'; $table->data = array (); -$table->data[0][0] = lang_string ('language_code'); +$table->data[0][0] = __('language_code'); $table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true); -$table->data[1][0] = lang_string ('Remote config directory'); +$table->data[1][0] = __('Remote config directory'); $table->data[1][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); -$table->data[2][0] = lang_string ('Graph color (min)'); +$table->data[2][0] = __('Graph color (min)'); $table->data[2][1] = print_input_text ('graph_color1', $config["graph_color1"], '', 8, 8, true); -$table->data[3][0] = lang_string ('Graph color (avg)'); +$table->data[3][0] = __('Graph color (avg)'); $table->data[3][1] = print_input_text ('graph_color2', $config["graph_color2"], '', 8, 8, true); -$table->data[4][0] = lang_string ('Graph color (max)'); +$table->data[4][0] = __('Graph color (max)'); $table->data[4][1] = print_input_text ('graph_color3', $config["graph_color3"], '', 8, 8, true); -$table->data[5][0] = lang_string ('sla_period'); +$table->data[5][0] = __('sla_period'); $table->data[5][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true); -$table->data[5][0] = lang_string ('days_compact'); +$table->data[5][0] = __('days_compact'); $table->data[5][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); -$table->data[6][0] = lang_string ('days_purge'); +$table->data[6][0] = __('days_purge'); $table->data[6][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); -$table->data[7][0] = lang_string ('graph_res'); +$table->data[7][0] = __('graph_res'); $table->data[7][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true); -$table->data[8][0] = lang_string ('step_compact'); +$table->data[8][0] = __('step_compact'); $table->data[8][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); -$table->data[9][0] = lang_string ('show_unknown'); +$table->data[9][0] = __('show_unknown'); $table->data[9][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true); -$table->data[10][0] = lang_string ('show_lastalerts'); +$table->data[10][0] = __('show_lastalerts'); $table->data[10][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true); -$table->data[11][0] = lang_string ('style_template'); +$table->data[11][0] = __('style_template'); $table->data[11][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true); -$table->data[12][0] = lang_string ('block_size'); +$table->data[12][0] = __('block_size'); $table->data[12][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); -$table->data[13][0] = lang_string ('sla_period'); +$table->data[13][0] = __('sla_period'); $table->data[13][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true); echo '
    '; print_input_hidden ('update_settings', 1); print_table ($table); echo '
    '; -print_submit_button (lang_string ('update'), 'update_button', false, 'class="sub upd"'); +print_submit_button (__('update'), 'update_button', false, 'class="sub upd"'); echo '
    '; echo '
    '; ?> diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 337172383f..651ffb18f3 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -19,80 +19,84 @@ // Load global vars require("include/config.php"); -if (comprueba_login() == 0) - if (give_acl($id_user, 0, "UM")==1) { - // Init. vars - $comentarios = ""; - $direccion = ""; - $telefono = ""; - $password = ""; - $password2 = ""; - $id_usuario_mio = ""; - $nombre_real = ""; - $nivel = 0; - // Default is create mode (creacion) - $modo = "creacion"; - - if (isset($_GET["borrar_grupo"])){ // if modified some parameter - $grupo= entrada_limpia($_GET["borrar_grupo"]); - $query_del2="DELETE FROM tusuario_perfil WHERE id_up = ".$grupo; - $resq1=mysql_query($query_del2); - } - - if (isset($_GET["id_usuario_mio"])){ // if any parameter changed - $modo="edicion"; - $id_usuario_mio = entrada_limpia($_GET["id_usuario_mio"]); - // Read user data to include in form - $query1="SELECT * FROM tusuario WHERE id_usuario = '".$id_usuario_mio."'"; - $resq1=mysql_query($query1); - $rowdup=mysql_fetch_array($resq1); - if (!$rowdup) - { - echo "

    ".$lang_label["user_error"]."

    "; - echo ""; - include ("general/footer.php"); - exit; - } - else +check_login(); + +if (! give_acl ($config['id_user'], 0, "UM")) { + audit_db($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access User Management"); + require ("general/noaccess.php"); +} + +// Init. vars +$comentarios = ""; +$direccion = ""; +$telefono = ""; +$password = ""; +$password2 = ""; +$id_usuario_mio = ""; +$nombre_real = ""; +$nivel = 0; +// Default is create mode (creacion) +$modo = "creacion"; + +if (isset ($_GET["borrar_grupo"])) { // if modified some parameter + $grupo = get_parameter ("borrar_grupo"); + $sql = "DELETE FROM tusuario_perfil WHERE id_up = ".$grupo; + $resq1 = mysql_query ($sql); +} + +if (isset ($_GET["id_usuario_mio"])) { // if any parameter changed + $modo = "edicion"; + $id_usuario_mio = get_parameter ("id_usuario_mio"); + // Read user data to include in form + $sql = "SELECT * FROM tusuario WHERE id_usuario = '".$id_usuario_mio."'"; + $result = mysql_query ($sql); + $rowdup = mysql_fetch_array ($result); + if (! $rowdup) { + echo "

    ".__('user_error')."

    "; + echo ""; + include ("general/footer.php"); + exit; + } else { $password=""; - $password2=""; - $comentarios=$rowdup["comentarios"]; - $direccion=$rowdup["direccion"]; - $telefono=$rowdup["telefono"]; - $nivel =$rowdup["nivel"]; - $nombre_real=$rowdup["nombre_real"]; } - - // Edit user - if (isset ($_POST["edicion"])){ - // We do it - if (isset ($_POST["pass1"])){ - $nombre = entrada_limpia($_POST["nombre"]); - $nombre_real=entrada_limpia($_POST["nombre_real"]); - $nombre_viejo = entrada_limpia($_POST["id_usuario_antiguo"]); - $password = entrada_limpia($_POST["pass1"]); - $password2 = entrada_limpia($_POST["pass2"]); - if ($password <> $password2){ - echo "

    ".$lang_label["pass_nomatch"]."

    "; - } - else { + $password2 = ""; + $comentarios = $rowdup["comentarios"]; + $direccion = $rowdup["direccion"]; + $telefono = $rowdup["telefono"]; + $nivel = $rowdup["nivel"]; + $nombre_real = $rowdup["nombre_real"]; +} + +// Edit user +if (isset ($_POST["edicion"])) { + // We do it + if (isset ($_POST["pass1"])) { + $nombre = get_parameter_post ("nombre"); + $nombre_real = get_parameter_post ("nombre_real"); + $nombre_viejo = get_parameter_post ("id_usuario_antiguo"); + $password = get_parameter_post ("pass1"); + $password2 = get_parameter_post ("pass2"); + if ($password != $password2){ + echo "

    ".__('pass_nomatch')."

    "; + } else { if (isset($_POST["nivel"])) - $nivel = entrada_limpia($_POST["nivel"]); - $direccion = entrada_limpia($_POST["direccion"]); - $telefono = entrada_limpia($_POST["telefono"]); - $comentarios = entrada_limpia($_POST["comentarios"]); - - if ($password != ""){ - $password=md5($password); + $nivel = get_parameter_post ("nivel"); + $direccion = get_parameter_post ("direccion"); + $telefono = get_parameter_post ("telefono"); + $comentarios = get_parameter_post ("comentarios"); + + if ($password != "") { + $password = md5 ($password); $sql = "UPDATE tusuario SET nombre_real ='".$nombre_real."', id_usuario ='".$nombre."', password = '".$password."', telefono ='".$telefono."', direccion ='".$direccion." ', nivel = '".$nivel."', comentarios = '".$comentarios."' WHERE id_usuario = '".$nombre_viejo."'"; - } - else + } else { $sql = "UPDATE tusuario SET nombre_real ='".$nombre_real."', id_usuario ='".$nombre."', telefono ='".$telefono."', direccion ='".$direccion." ', nivel = '".$nivel."', comentarios = '".$comentarios."' WHERE id_usuario = '".$nombre_viejo."'"; - $resq2=mysql_query($sql); + } + $resq2 = mysql_query ($sql); // Add group if (isset($_POST["grupo"])) - if ($_POST["grupo"] <> ""){ + if ($_POST["grupo"] != "") { $grupo = $_POST["grupo"]; $perfil = $_POST["perfil"]; $id_usuario_edit = $_SESSION["id_usuario"]; @@ -100,187 +104,182 @@ if (comprueba_login() == 0) // echo "DEBUG:".$sql; $resq2=mysql_query($sql); } - - $query1="SELECT * FROM tusuario WHERE id_usuario = '".$nombre."'"; + + $query1 = "SELECT * FROM tusuario WHERE id_usuario = '".$nombre."'"; $id_usuario_mio = $nombre; - $resq1=mysql_query($query1); - $rowdup=mysql_fetch_array($resq1); + $resq1 = mysql_query ($query1); + $rowdup = mysql_fetch_array ($resq1); $password=""; - $password2= ""; + $password2= ""; $comentarios=$rowdup["comentarios"]; $direccion=$rowdup["direccion"]; $telefono=$rowdup["telefono"]; $nivel = $rowdup["nivel"]; $nombre_real=$rowdup["nombre_real"]; $modo ="edicion"; - echo "

    ".$lang_label["update_user_ok"]."

    "; + echo "

    ".__('update_user_ok')."

    "; } - } - else { - echo "

    ".$lang_label["update_user_no"]."

    "; - } - } - - // Create user - if (isset($_GET["nuevo_usuario"])){ - // Get data from POST - $nombre = entrada_limpia($_POST["nombre"]); - $password = entrada_limpia($_POST["pass1"]); - $password2 = entrada_limpia($_POST["pass2"]); - $nombre_real=entrada_limpia($_POST["nombre_real"]); - if ($password <> $password2){ - echo "

    ".$lang_label["pass_nomatch"]."

    "; - } - $direccion = entrada_limpia($_POST["direccion"]); - $telefono = entrada_limpia($_POST["telefono"]); - $comentarios = entrada_limpia($_POST["comentarios"]); - if (isset($_POST["nivel"])) - $nivel = entrada_limpia($_POST["nivel"]); - $password=md5($password); - $ahora = date("Y/m/d H:i:s"); - $sql_insert = "INSERT INTO tusuario (id_usuario,direccion,password,telefono,fecha_registro,nivel,comentarios, nombre_real) VALUES ('".$nombre."','".$direccion."','".$password."','".$telefono."','".$ahora."','".$nivel."','".$comentarios."','".$nombre_real."')"; - $resq1=mysql_query($sql_insert); - if (! $resq1) - echo "

    ".$lang_label["create_user_no"]."

    "; - else { - echo "

    ".$lang_label["create_user_ok"]."

    "; - } - $id_usuario_mio = $nombre; - $modo ="edicion"; - $password = ""; - $password2 = ""; + } else { + echo "

    ".__('update_user_no')."

    "; } - echo "

    ".$lang_label["user_management"]." > "; - if (isset($_GET["alta"])){ - if ($_GET["alta"]==1){ - echo $lang_label["create_user"]; - } +} + +// Create user +if (isset ($_GET["nuevo_usuario"])) { + // Get data from POST + $nombre = get_parameter_post ("nombre"); + $password = get_parameter_post ("pass1"); + $password2 = get_parameter_post ("pass2"); + $nombre_real=get_parameter_post ("nombre_real"); + if ($password <> $password2){ + echo "

    ".__('pass_nomatch')."

    "; + } + $direccion = get_parameter_post ("direccion"); + $telefono = get_parameter_post ("telefono"); + $comentarios = get_parameter_post ("comentarios"); + if (isset ($_POST["nivel"])) + $nivel = get_parameter_post ("nivel"); + $password = md5 ($password); + $ahora = date("Y/m/d H:i:s"); + $sql = "INSERT INTO tusuario (id_usuario,direccion,password,telefono,fecha_registro,nivel,comentarios, nombre_real) VALUES ('".$nombre."','".$direccion."','".$password."','".$telefono."','".$ahora."','".$nivel."','".$comentarios."','".$nombre_real."')"; + $resq1 = mysql_query ($sql); + if (! $resq1) + echo "

    ".__('create_user_no')."

    "; + else { + echo "

    ".__('create_user_ok')."

    "; + } + $id_usuario_mio = $nombre; + $modo ="edicion"; + $password = ""; + $password2 = ""; +} + echo "

    ".__('user_management')." > "; + if (isset($_GET["alta"])) { + if ($_GET["alta"] == 1) { + echo __('create_user'); } - if (isset($_GET["id_usuario_mio"]) OR isset($_GET["nuevo_usuario"])){ - echo $lang_label["update_user"]; - } - echo "

    "; + } + if (isset ($_GET["id_usuario_mio"]) || isset ($_GET["nuevo_usuario"])) { + echo __('update_user'); + } +echo ""; ?> - - '; - else - echo ''; - ?> - - - - - -'; - echo ''; - echo ''; - echo ''; +
    - '; - echo lang_string ("password"); - echo ''; - echo '
    '; - echo lang_string ("password"). " ". lang_string ("confirmation").''; - echo '
    E-Mail
    +'; +else + echo ''; ?> - - - - - - - - - '; - echo ''; - - echo ' - '; - echo ""; - echo "'; - echo '
    -  '.$help_label["users_msg1"].' '; - echo $lang_label["normal_user"].' '.$help_label["users_msg2"].''; - } else { - echo $lang_label["administrator"].' '.$help_label["users_msg1"].' '; - echo $lang_label["normal_user"].' '.$help_label["users_msg2"].''; - } - ?> -
    - -
    '.$lang_label["group_avail"].' - '; - - echo '
    ".$lang_label["profiles"]." - '; - echo '
    '; - echo ""; - echo "
    "; - echo "

    "; - // Show user profile / groups assigned - $sql1='SELECT * FROM tusuario_perfil WHERE id_usuario = "'.$id_usuario_mio.'"'; - $result=mysql_query($sql1); - - echo '

    '.$lang_label["listGroupUser"].'

    '; - echo ""; - if (mysql_num_rows($result)){ - echo ''; - $color=1; - while ($row=mysql_fetch_array($result)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo ''; - } - } - else { - echo '
    '.$lang_label["no_profile"].'
    '; - } - } - ?> - -
    '; - echo "".dame_perfil($row["id_perfil"])." / "; - echo "".dame_grupo($row["id_grupo"]).""; - echo '
    '; - echo ''; - echo '
    '; - echo ''; - } - ?> - -
    + + + + + \ No newline at end of file +echo ''; +echo __('password'); +echo ''; +echo ''; +echo ''; +echo __('password'). " ". __('confirmation').''; +echo ''; +echo ''; +echo 'E-Mail'; +?> + + + + + + + '.$help_label["users_msg1"].' '; + echo __('normal_user').' '.$help_label["users_msg2"].''; +} else { + echo __('administrator').' '.$help_label["users_msg1"].' '; + echo __('normal_user').' '.$help_label["users_msg2"].''; +} +?> + + + + + +'; + echo ''; + + echo ''.__('group_avail').' + + '; + + echo ''; + echo "".__('profiles').""; + echo " + '; + echo ''; + echo ''; + echo ""; + echo "
    "; + echo "

    "; + // Show user profile / groups assigned + $sql1='SELECT * FROM tusuario_perfil WHERE id_usuario = "'.$id_usuario_mio.'"'; + $result=mysql_query($sql1); + + echo '

    '.__('listGroupUser').'

    '; + echo ""; + if (mysql_num_rows($result)){ + echo ''; + $color=1; + while ($row=mysql_fetch_array($result)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo ''; + } + } + else { + echo '
    '.__('no_profile').'
    '; + } +} +?> + +
    '; + echo "".dame_perfil($row["id_perfil"])." / "; + echo "".dame_grupo($row["id_grupo"]).""; + echo '
    '; + echo ''; + echo '
    '; + echo ''; +} +?> + +
    diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index ddf3d9e1e8..e97ed88b28 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -8,38 +8,42 @@ // Load globar vars require("include/config.php"); -if (comprueba_login() == 0) - if (give_acl($id_user, 0, "UM")==1) { - if (isset($_GET["borrar_usuario"])){ // if delete user - $nombre= entrada_limpia($_GET["borrar_usuario"]); - // Delete user - // Delete cols from table tgrupo_usuario - - $query_del1="DELETE FROM tgrupo_usuario WHERE usuario = '".$nombre."'"; - $query_del2="DELETE FROM tusuario WHERE id_usuario = '".$nombre."'"; - $resq1=mysql_query($query_del1); - $resq1=mysql_query($query_del2); - if (! $resq1) - echo "

    ".$lang_label["delete_user_no"]."

    "; - else - echo "

    ".$lang_label["delete_user_ok"]."

    "; - } +check_login (); +if (! give_acl ($config['id_user'], 0, "UM")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access User Management"); + require ("general/noaccess.php"); +} +if (isset($_GET["borrar_usuario"])) { // if delete user + $nombre= entrada_limpia($_GET["borrar_usuario"]); + // Delete user + // Delete cols from table tgrupo_usuario + + $sql = "DELETE FROM tgrupo_usuario WHERE usuario = '".$nombre."'"; + $result = mysql_query ($sql); + $sql = "DELETE FROM tusuario WHERE id_usuario = '".$nombre."'"; + $result = mysql_query ($sql); + if (! $result) + echo "

    ".__('delete_user_no')."

    "; + else + echo "

    ".__('delete_user_ok')."

    "; +} ?> -

    > -

    +

    > +

    - - - - - - + + + + + +"; - $sql1='SELECT * FROM tusuario_perfil WHERE id_usuario = "'.$name.'"'; - $result=mysql_query($sql1); + $sql = 'SELECT * FROM tusuario_perfil WHERE id_usuario = "'.$name.'"'; + $result = mysql_query ($sql); echo " "; - if (mysql_num_rows($result)){ - while ($row=mysql_fetch_array($result)){ - echo dame_perfil($row["id_perfil"])."/ "; - echo dame_grupo($row["id_grupo"])."
    "; + if (mysql_num_rows ($result)) { + while ($row = mysql_fetch_array ($result)) { + echo dame_perfil ($row["id_perfil"])."/ "; + echo dame_grupo ($row["id_grupo"])."
    "; } + } else { + echo __('no_profile'); } - else { echo $lang_label["no_profile"]; } echo "
    "; - echo ""; + echo ""; echo ""; - echo ""; + echo ""; } - echo "
    ".substr($real_name,0,16)."".substr ($real_name, 0, 16)."".$comments."
    "; - echo ""; - echo "
    "; - echo "
    "; - echo ""; - echo "
    "; +echo ""; +echo ""; +echo "
    "; +echo "
    "; +echo ""; +echo "
    "; echo ""; - -} // end verify security of page - else { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access User Management"); - require ("general/noaccess.php"); -} -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 7fbe218a1b..f1d2faa934 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -46,7 +46,7 @@ function safe_input ($value) { if (is_numeric ($value)) return $value; if (is_array ($value)) { - array_walk (&$value,'safe_input'); + array_walk ($value,'safe_input'); return $value; } return htmlentities (utf8_decode ($value), ENT_QUOTES); @@ -198,11 +198,11 @@ function popup_help ($help_id, $return = false) { function no_permission () { require("config.php"); require ("include/languages/language_".$config["language"].".php"); - echo "

    ".lang_string ('no_permission_title')."

    "; + echo "

    ".__('no_permission_title')."

    "; echo "No access

    "; echo ""; echo "
    "; - echo lang_string ('no_permission_text'); + echo __('no_permission_text'); echo "
    "; echo ""; include "general/footer.php"; @@ -217,11 +217,11 @@ function no_permission () { function unmanaged_error ($error = "") { require("config.php"); require ("include/languages/language_".$config["language"].".php"); - echo "

    ".lang_string("Unmanaged error")."

    "; + echo "

    ".__('Unmanaged error')."

    "; echo "error

    "; echo ""; echo "
    "; - echo lang_string("Unmanaged error_text"); + echo __('Unmanaged error_text'); echo "
    "; echo $error; echo "
    "; @@ -452,24 +452,24 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands */ function human_time_comparation ($timestamp) { if ($timestamp == "") { - return "0 ".lang_string ('minutes'); + return "0 ".__('minutes'); } $ahora = date ("Y/m/d H:i:s"); $seconds = strtotime ($ahora) - strtotime ($timestamp); if ($seconds < 3600) - return format_numeric ($seconds / 60, 1)." ".lang_string ('minutes'); + return format_numeric ($seconds / 60, 1)." ".__('minutes'); if ($seconds >= 3600 && $seconds < 86400) - return format_numeric ($seconds / 3600, 1)." ".lang_string ('hours'); + return format_numeric ($seconds / 3600, 1)." ".__('hours'); if ($seconds >= 86400 && $seconds < 2592000) - return format_numeric ($seconds / 86400, 1)." ".lang_string ('days'); + return format_numeric ($seconds / 86400, 1)." ".__('days'); if ($seconds >= 2592000 && $seconds < 15552000) - return format_numeric ($seconds / 2592000, 1)." ".lang_string ('months'); - return " +6 ".lang_string ('months'); + return format_numeric ($seconds / 2592000, 1)." ".__('months'); + return " +6 ".__('months'); } /** @@ -483,12 +483,12 @@ function human_time_comparation ($timestamp) { function human_time_description_raw ($seconds) { global $lang_label; if ($seconds < 3600) - return format_numeric($seconds/60,2)." ".lang_string ('minutes'); + return format_numeric($seconds/60,2)." ".__('minutes'); if ($seconds >= 3600 && $seconds < 86400) - return format_numeric ($seconds/3600,2)." ".lang_string ('hours'); + return format_numeric ($seconds/3600,2)." ".__('hours'); - return format_numeric ($seconds/86400,2)." ".lang_string ('days'); + return format_numeric ($seconds/86400,2)." ".__('days'); } /** @@ -505,40 +505,40 @@ function human_time_description ($period) { switch ($period) { case 3600: - return lang_string ('hour'); + return __('hour'); break; case 7200: - return lang_string ('2_hours'); + return __('2_hours'); break; case 21600: - return lang_string ('6_hours'); + return __('6_hours'); break; case 43200: - return lang_string ('12_hours'); + return __('12_hours'); break; case 86400: - return lang_string ('last_day'); + return __('last_day'); break; case 172800: - return lang_string ('two_days'); + return __('two_days'); break; case 432000: - return lang_string ('five_days'); + return __('five_days'); break; case 604800: - return lang_string ('last_week'); + return __('last_week'); break; case 1296000: - return lang_string ('15_days'); + return __('15_days'); break; case 2592000: - return lang_string ('last_month'); + return __('last_month'); break; case 5184000: - return lang_string ('two_month'); + return __('two_month'); break; case 15552000: - return lang_string ('six_months'); + return __('six_months'); break; default: return human_time_description_raw ($period); @@ -645,19 +645,19 @@ function get_alert_priority ($priority = 0) { global $config; switch ($priority) { case 0: - return lang_string("Maintenance"); + return __('Maintenance'); break; case 1: - return lang_string("Informational"); + return __('Informational'); break; case 2: - return lang_string("Normal"); + return __('Normal'); break; case 3: - return lang_string("Warning"); + return __('Warning'); break; case 4: - return lang_string("Critical"); + return __('Critical'); break; } return ''; @@ -676,9 +676,9 @@ function get_alert_days ($row) { $check = $row["monday"] + $row["tuesday"] + $row["wednesday"] + $row["thursday"] + $row["friday"] + $row["saturday"] + $row["sunday"]; if ($check == 7) { - return lang_string ("all"); + return __('all'); } elseif ($check == 0) { - return lang_string ("none"); + return __('none'); } if ($row["monday"] != 0) $days_output .= "Mo "; @@ -711,15 +711,15 @@ function get_alert_times ($row2) { if ($row2["time_from"]){ $time_from_table = $row2["time_from"]; } else { - $time_from_table = lang_string ("N/A"); + $time_from_table = __('N/A'); } if ($row2["time_to"]){ $time_to_table = $row2["time_to"]; } else { - $time_to_table = lang_string ("N/A"); + $time_to_table = __('N/A'); } if ($time_to_table == $time_from_table) - return lang_string ('N/A'); + return __('N/A'); return substr ($time_from_table, 0, 5)." - ".substr ($time_to_table, 0, 5); } @@ -740,7 +740,7 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c $string = ""; if ($row2["disable"] == 1){ - $string .= "".lang_string ('disabled').""; + $string .= "".__('disabled').""; } elseif ($id_tipo_modulo != 0) { $string .= ""; } else { @@ -780,7 +780,7 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c // We have alert text ? if ($row2["alert_text"]!= "") { - $string = $string."".lang_string ('text').""; + $string = $string."".__('text').""; } else { $string = $string."".$mymin.""; $string = $string."".$mymax.""; @@ -795,16 +795,16 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c // Has recovery notify activated ? if ($row2["recovery_notify"] > 0) - $recovery_notify = lang_string("Yes"); + $recovery_notify = __('Yes'); else - $recovery_notify = lang_string("No"); + $recovery_notify = __('No'); // calculate priority $priority = get_alert_priority ($row2["priority"]); // calculare firing conditions if ($row2["alert_text"] != "") { - $firing_cond = lang_string("text")."(".substr($row2["alert_text"],0,8).")"; + $firing_cond = __('text')."(".substr($row2["alert_text"],0,8).")"; } else { $firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"]; } @@ -822,16 +822,16 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c + __('Recovery')." + __('Priority')." + __('Alert Ctrl.')." + __('Firing days')."
    ". - lang_string("Recovery")."
    $recovery_notify
    ". - lang_string("Priority")."
    $priority
    ". - lang_string("Alert Ctrl.")."
    ".$firing_cond."
    ". - lang_string("Firing days")."
    ".$firing_days."
    "; @@ -884,16 +884,16 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) { // Has recovery notify activated ? if ($data["recovery_notify"] > 0) - $recovery_notify = lang_string("Yes"); + $recovery_notify = __('Yes'); else - $recovery_notify = lang_string("No"); + $recovery_notify = __('No'); // calculate priority $priority = get_alert_priority ($data["priority"]); // calculare firing conditions if ($data["alert_text"] != ""){ - $firing_cond = lang_string("text")."(".substr($data["alert_text"],0,8).")"; + $firing_cond = __('text')."(".substr($data["alert_text"],0,8).")"; } else { $firing_cond = $data["min_alerts"]." / ".$data["max_alerts"]; } @@ -909,16 +909,16 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) { + __('Recovery')." + __('Priority')." + __('Alert Ctrl.')." + __('Firing days')."
    ". - lang_string("Recovery")."
    $recovery_notify
    ". - lang_string("Priority")."
    $priority
    ". - lang_string("Alert Ctrl.")."
    ".$firing_cond."
    ". - lang_string("Firing days")."
    ".$firing_days."
    "; @@ -937,20 +937,20 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) { $mymax = format_for_graph($mymax ); // Text alert ? if ($data["alert_text"] != "") - echo "".lang_string ('text').""; + echo "".__('text').""; else { echo "".$mymin.""; echo "".$mymax.""; } echo "".human_time_description($data["time_threshold"]); if ($data["last_fired"] == "0000-00-00 00:00:00") { - echo "".lang_string ('never').""; + echo "".__('never').""; } else { echo "".human_time_comparation ($data["last_fired"]).""; } echo "".$data["times_fired"].""; if ($data["times_fired"] <> 0){ - echo ""; + echo ""; echo ""; $id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente); if (give_acl($config["id_user"], $id_grupo_alerta, "AW") == 1) { @@ -961,7 +961,7 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) { } } else { echo " - "; + "; } } @@ -972,19 +972,19 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) { */ function get_report_types () { $types = array (); - $types['simple_graph'] = lang_string ('simple_graph'); - $types['custom_graph'] = lang_string ('custom_graph'); - $types['SLA'] = lang_string ('SLA'); - $types['event_report'] = lang_string ('event_report'); - $types['alert_report'] = lang_string ('alert_report'); - $types['monitor_report'] = lang_string ('monitor_report'); - $types['avg_value'] = lang_string ('avg_value'); - $types['max_value'] = lang_string ('max_value'); - $types['min_value'] = lang_string ('min_value'); - $types['sumatory'] = lang_string ('sumatory'); - $types['general_group_report'] = lang_string ('general_group_report'); - $types['monitor_health'] = lang_string ('monitor_health'); - $types['agents_detailed'] = lang_string ('agents_detailed'); + $types['simple_graph'] = __('simple_graph'); + $types['custom_graph'] = __('custom_graph'); + $types['SLA'] = __('SLA'); + $types['event_report'] = __('event_report'); + $types['alert_report'] = __('alert_report'); + $types['monitor_report'] = __('monitor_report'); + $types['avg_value'] = __('avg_value'); + $types['max_value'] = __('max_value'); + $types['min_value'] = __('min_value'); + $types['sumatory'] = __('sumatory'); + $types['general_group_report'] = __('general_group_report'); + $types['monitor_health'] = __('monitor_health'); + $types['agents_detailed'] = __('agents_detailed'); return $types; } @@ -999,7 +999,7 @@ function get_report_types () { function get_report_name ($type) { $types = get_report_types (); if (! isset ($types[$type])) - return lang_string ('unknown'); + return __('unknown'); return $types[$type]; } @@ -1108,16 +1108,16 @@ function is_module_data_string ($module_name) { */ function get_event_types () { $types = array (); - $types['unknown'] = lang_string ('unknown'); - $types['monitor_up'] = lang_string ('monitor_up'); - $types['monitor_down'] = lang_string ('monitor_down'); - $types['alert_fired'] = lang_string ('alert_fired'); - $types['alert_recovered'] = lang_string ('alert_recovered'); - $types['alert_ceased'] = lang_string ('alert_ceased'); - $types['alert_manual_validation'] = lang_string ('alert_manual_validation'); - $types['recon_host_detected'] = lang_string ('recon_host_detected'); - $types['system'] = lang_string ('sytem'); - $types['error'] = lang_string ('error'); + $types['unknown'] = __('unknown'); + $types['monitor_up'] = __('monitor_up'); + $types['monitor_down'] = __('monitor_down'); + $types['alert_fired'] = __('alert_fired'); + $types['alert_recovered'] = __('alert_recovered'); + $types['alert_ceased'] = __('alert_ceased'); + $types['alert_manual_validation'] = __('alert_manual_validation'); + $types['recon_host_detected'] = __('recon_host_detected'); + $types['system'] = __('sytem'); + $types['error'] = __('error'); return $types; } @@ -1129,11 +1129,11 @@ function get_event_types () { */ function get_priorities () { $priorities = array (); - $priorities[0] = lang_string ("Maintenance"); - $priorities[1] = lang_string ("Informational"); - $priorities[2] = lang_string ("Normal"); - $priorities[3] = lang_string ("Warning"); - $priorities[4] = lang_string ("Critical"); + $priorities[0] = __('Maintenance'); + $priorities[1] = __('Informational'); + $priorities[2] = __('Normal'); + $priorities[3] = __('Warning'); + $priorities[4] = __('Critical'); return $priorities; } @@ -1148,17 +1148,17 @@ function return_priority ($priority) { switch ($priority) { case 0: - return lang_string ("Maintenance"); + return __('Maintenance'); case 1: - return lang_string ("Informational"); + return __('Informational'); case 2: - return lang_string ("Normal"); + return __('Normal'); case 3: - return lang_string ("Warning"); + return __('Warning'); case 4: - return lang_string ("Critical"); + return __('Critical'); case -1: - return lang_string ("All"); + return __('All'); } } diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 5e9b8037c0..aa3100f6dc 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -70,11 +70,11 @@ function give_acl ($id_user, $id_group, $access) { //Joined multiple queries into one. That saves on the query overhead and query cache. if ($id_group == 0) { - $query1=sprintf("SELECT tperfil.incident_view,tperfil.incident_edit,tperfil.incident_management,tperfil.agent_view,tperfil.agent_edit,tperfil.alert_edit,tperfil.alert_management,tperfil.pandora_management,tperfil.db_management,tperfil.user_management FROM tusuario_perfil,tperfil WHERE tusuario_perfil.id_perfil = tperfil.id_perfil AND tusuario_perfil.id_usuario = '%s'",$id_user); + $query1=sprintf("SELECT tperfil.incident_view,tperfil.incident_edit,tperfil.incident_management,tperfil.agent_view,tperfil.agent_edit,tperfil.alert_edit,tperfil.alert_management,tperfil.pandora_management,tperfil.db_management,tperfil.user_management FROM tusuario_perfil,tperfil WHERE tusuario_perfil.id_perfil = tperfil.id_perfil AND tusuario_perfil.id_usuario = '%s'", $id_user); //GroupID = 0, access doesnt matter (use with caution!) - Any user gets access to group 0 } else { $query1=sprintf("SELECT tperfil.incident_view,tperfil.incident_edit,tperfil.incident_management,tperfil.agent_view,tperfil.agent_edit,tperfil.alert_edit,tperfil.alert_management,tperfil.pandora_management,tperfil.db_management,tperfil.user_management FROM tusuario_perfil,tperfil WHERE tusuario_perfil.id_perfil = tperfil.id_perfil -AND tusuario_perfil.id_usuario = '%s' AND (tusuario_perfil.id_grupo = %d OR tusuario_perfil.id_grupo= 1)",$id_user,$id_group); +AND tusuario_perfil.id_usuario = '%s' AND (tusuario_perfil.id_grupo = %d OR tusuario_perfil.id_grupo= 1)", $id_user, $id_group); } $rowdup = get_db_all_rows_sql($query1); @@ -373,8 +373,8 @@ function dame_nombre_agente ($id_agent) { * * @return Password of an user. */ -function get_user_password ($id_usuario) { - return (string) get_db_value ('password', 'tusuario', 'id_usuario', (int) $id_usuario); +function get_user_password ($id_user) { + return (string) get_db_value ('password', 'tusuario', 'id_usuario', $id_user); } /** @@ -1090,19 +1090,19 @@ function show_server_type ($id){ function give_modulecategory_name ($id_category) { switch ($id_category) { case 0: - return lang_string ("cat_0"); + return __('cat_0'); break; case 1: - return lang_string ("cat_1"); + return __('cat_1'); break; case 2: - return lang_string ("cat_2"); + return __('cat_2'); break; case 3: - return lang_string ("cat_3"); + return __('cat_3'); break; } - return lang_string ("unknown"); + return __('unknown'); } /** @@ -1656,7 +1656,7 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) $module_name = get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_module_type); if (is_module_data_string ($module_name)) { - return lang_string ('wrong_module_type'); + return __('wrong_module_type'); } // Get the whole interval of data @@ -1725,9 +1725,23 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) * @param file Filename of language definitions to load. */ function load_lang_file ($file) { + global $config; + if (file_exists ($file)) require_once ($config["homedir"]."/include/languages/language_".$config["language"].".php"); } + +/** + * Get a translated string (alias version of lang_string(). + * + * @param string String to translate + * + * @return The translated string. If not defined, the same string will be returned + */ +function __ ($string) { + return lang_string ($string); +} + /** * Get a translated string. * @@ -1780,16 +1794,16 @@ function show_alert_row_mini ($id_combined_alert) { WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = %d",$id_combined_alert); $result = get_db_all_rows_sql ($sql); echo ""; - echo ""; + echo ""; } else { echo ""; } @@ -1850,15 +1864,15 @@ function show_alert_row_mini ($id_combined_alert) { // Has recovery notify activated ? if ($row2["recovery_notify"] > 0) { - $recovery_notify = lang_string ("Yes"); + $recovery_notify = __('Yes'); } else { - $recovery_notify = lang_string ("No"); + $recovery_notify = __('No'); } echo ""; + echo ""; } else { - echo ""; + echo ""; } } echo "
    ".lang_string("Name"); - echo "".lang_string("Oper"); - echo "".lang_string("Tt"); - echo "".lang_string("Firing"); - echo "".lang_string("Time"); - echo "".lang_string("Desc"); - echo "".lang_string("Recovery"); - echo "".lang_string("MinMax.Al"); - echo "".lang_string("Days"); - echo "".lang_string("Fired"); + echo "".__('Name'); + echo "".__('Oper'); + echo "".__('Tt'); + echo "".__('Firing'); + echo "".__('Time'); + echo "".__('Desc'); + echo "".__('Recovery'); + echo "".__('MinMax.Al'); + echo "".__('Days'); + echo "".__('Fired'); foreach ($result as $row2) { if ($color == 1) { $tdcolor = "datos"; @@ -1830,13 +1844,13 @@ function show_alert_row_mini ($id_combined_alert) { } if (($mymin == 0) && ($mymax == 0)) { - $mymin = lang_string ("N/A"); + $mymin = __('N/A'); $mymax = $mymin; } // We have alert text ? if ($row2["alert_text"]!= "") { - echo "".lang_string ('text')."".__('text')."".$mymin."/".$mymax."".$recovery_notify; // calculare firing conditions if ($row2["alert_text"] != ""){ - $firing_cond = lang_string ("text")."(".substr ($row2["alert_text"],0,8).")"; + $firing_cond = __('text')."(".substr ($row2["alert_text"],0,8).")"; } else { $firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"]; } @@ -1870,9 +1884,9 @@ function show_alert_row_mini ($id_combined_alert) { // Fired ? if ($row2["times_fired"]>0) { - echo "
    "; @@ -1893,14 +1907,14 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) { $sql = sprintf ("SELECT * FROM tevento %s ORDER BY timestamp DESC LIMIT %d",$filter,$limit); echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; $result = get_db_all_rows_sql ($sql); if($result === false) $result = array(); @@ -1986,9 +2000,9 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) { // for System or SNMP generated alerts } else { if ($event["event_type"] == "system") { - echo "
    ".lang_string ("Latest events"); + echo "".__('Latest events'); echo "
    ".lang_string ("St")."".lang_string ("Type")."".lang_string ('event_name')."".lang_string ('agent_name')."".lang_string ('id_user')."".lang_string ('timestamp')."".__('St')."".__('Type')."".__('event_name')."".__('agent_name')."".__('id_user')."".__('timestamp')."".lang_string ("System"); + echo "".__('System'); } else { - echo "".lang_string ("alert")."SNMP"; + echo "".__('alert')."SNMP"; } } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9bd62bab5a..f7b5133b58 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -236,10 +236,10 @@ function event_reporting ($id_group, $period, $date = 0, $return = false) { $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('status'); - $table->head[1] = lang_string ('event_name'); - $table->head[2] = lang_string ('id_user'); - $table->head[3] = lang_string ('timestamp'); + $table->head[0] = __('status'); + $table->head[1] = __('event_name'); + $table->head[2] = __('id_user'); + $table->head[3] = __('timestamp'); $sql = sprintf ('SELECT * FROM tevento WHERE id_agente = %d @@ -293,10 +293,10 @@ function get_fired_alerts_reporting_table ($alerts_fired) { $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('agent'); - $table->head[1] = lang_string ('alert_description'); - $table->head[2] = lang_string ('times_fired'); - $table->head[3] = lang_string ('priority'); + $table->head[0] = __('agent'); + $table->head[1] = __('alert_description'); + $table->head[2] = __('times_fired'); + $table->head[3] = __('priority'); foreach ($agents as $alerts) { $data = array (); @@ -338,8 +338,8 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { $output .= ''; - $output .= ''.lang_string ('fired_alerts').': '.sizeof ($alerts_fired).'
    '; - $output .= ''.lang_string ('total_alerts_monitored').': '.sizeof ($alerts).'
    '; + $output .= ''.__('fired_alerts').': '.sizeof ($alerts_fired).'
    '; + $output .= ''.__('total_alerts_monitored').': '.sizeof ($alerts).'
    '; if (! sizeof ($alerts_fired)) { if (!$return) @@ -387,8 +387,8 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = $output .= ''; - $output .= ''.lang_string ('total_monitors').': '.sizeof ($monitors).'
    '; - $output .= ''.lang_string ('monitors_down_on_period').': '.sizeof ($monitors_down).'
    '; + $output .= ''.__('total_monitors').': '.sizeof ($monitors).'
    '; + $output .= ''.__('monitors_down_on_period').': '.sizeof ($monitors_down).'
    '; $table = get_monitors_down_reporting_table ($monitors_down); $table->width = '100%'; @@ -419,8 +419,8 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = function get_monitors_down_reporting_table ($monitors_down) { $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('agent'); - $table->head[1] = lang_string ('monitor'); + $table->head[0] = __('agent'); + $table->head[1] = __('monitor'); $agents = array (); foreach ($monitors_down as $monitor) { @@ -463,7 +463,7 @@ function get_monitors_down_reporting_table ($monitors_down) { function general_group_reporting ($id_group, $return = false) { $output = ''; $agents = get_agents_in_group ($id_group); - $output .= ''.lang_string ('agents_in_group').': '.sizeof ($agents).'
    '; + $output .= ''.__('agents_in_group').': '.sizeof ($agents).'
    '; if (!$return) echo $output; @@ -482,13 +482,13 @@ function general_group_reporting ($id_group, $return = false) { function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { $table->data = array (); $table->head = array (); - $table->head[0] = lang_string ('type'); - $table->head[1] = lang_string ('description'); - $table->head[2] = lang_string ('min'); - $table->head[3] = lang_string ('max'); - $table->head[4] = lang_string ('threshold'); - $table->head[5] = lang_string ('last_fired'); - $table->head[6] = lang_string ('times_fired'); + $table->head[0] = __('type'); + $table->head[1] = __('description'); + $table->head[2] = __('min'); + $table->head[3] = __('max'); + $table->head[4] = __('threshold'); + $table->head[5] = __('last_fired'); + $table->head[6] = __('times_fired'); $alerts = get_alerts_in_agent ($id_agent); foreach ($alerts as $alert) { @@ -521,10 +521,10 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { * @return A table object with the report. */ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) { - $n_a_string = lang_string ('N/A').'(*)'; + $n_a_string = __('N/A').'(*)'; $table->head = array (); - $table->head[0] = lang_string ('monitor'); - $table->head[1] = lang_string ('last_failure'); + $table->head[0] = __('monitor'); + $table->head[1] = __('last_failure'); $table->data = array (); $monitors = get_monitors_in_agent ($id_agent); @@ -559,7 +559,7 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) */ function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { $table->data = array (); - $n_a_string = lang_string ('N/A').'(*)'; + $n_a_string = __('N/A').'(*)'; $modules = get_modules_in_agent ($id_agent); $data = array (); @@ -584,12 +584,12 @@ function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { */ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $return = false) { $output = ''; - $n_a_string = lang_string ('N/A').'(*)'; + $n_a_string = __('N/A').'(*)'; /* Show modules in agent */ $output .= '
    '; - $output .= '

    '.lang_string ('agent').' - '.dame_nombre_agente ($id_agent).'

    '; - $output .= '

    '.lang_string ('modules').'

    '; + $output .= '

    '.__('agent').' - '.dame_nombre_agente ($id_agent).'

    '; + $output .= '

    '.__('modules').'

    '; $table_modules = get_agent_modules_reporting_table ($id_agent, $period, $date); $table_modules->width = '99%'; $output .= print_table ($table_modules, true); @@ -598,7 +598,7 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur $table_alerts = get_agent_alerts_reporting_table ($id_agent, $period, $date); $table_alerts->width = '99%'; if (sizeof ($table_alerts->data)) { - $output .= '

    '.lang_string ('alerts').'

    '; + $output .= '

    '.__('alerts').'

    '; $output .= print_table ($table_alerts, true); } @@ -615,7 +615,7 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur $table_monitors->align[1] = 'right'; $table_monitors->size = array (); $table_monitors->align[1] = '10%'; - $output .= '

    '.lang_string ('monitors').'

    '; + $output .= '

    '.__('monitors').'

    '; $output .= print_table ($table_monitors, true); $output .= '
    '; diff --git a/pandora_console/include/functions_reporting_pdf.php b/pandora_console/include/functions_reporting_pdf.php index ab28aa1a65..f0d961e4d6 100644 --- a/pandora_console/include/functions_reporting_pdf.php +++ b/pandora_console/include/functions_reporting_pdf.php @@ -128,7 +128,7 @@ function get_pdf_report ($report) { switch ($content["type"]) { case 1: case 'simple_graph': - doTitle ($pdf, lang_string ("Module graph").': '.$agent_name. + doTitle ($pdf, __('Module graph').': '.$agent_name. ' - '.$module_name.' - '.$period); $image = 'http://'.$_SERVER['HTTP_HOST'].$config["homeurl"]. '/reporting/fgraph.php?PHPSESSID='.$session_id. @@ -152,7 +152,7 @@ function get_pdf_report ($report) { array_push ($modules, $content2['id_agent_module']); array_push ($weights, $content2["weight"]); } - doTitle ($pdf, lang_string ("Custom graph").': '.$graph["name"]. + doTitle ($pdf, __('Custom graph').': '.$graph["name"]. ' - '.$period); $image = 'http://'.$_SERVER['HTTP_HOST'].$config["homeurl"]. '/reporting/fgraph.php?PHPSESSID='.$session_id.'&tipo=combined&id='. @@ -164,29 +164,29 @@ function get_pdf_report ($report) { break; case 3: case 'SLA': - doTitle ($pdf, lang_string ('SLA').': '.$period); + doTitle ($pdf, __('SLA').': '.$period); $slas = get_db_all_rows_field_filter ('treport_content_sla_combined', 'id_report_content', $content['id_rc']); if (sizeof ($slas) == 0) { - $pdf->ezText ("".lang_string ('no_defined_slas') . " %", 18); + $pdf->ezText ("".__('no_defined_slas') . " %", 18); } $table->data = array (); - $table->head = array (lang_string ('Info'), - lang_string ('sla_result')); + $table->head = array (__('Info'), + __('sla_result')); $sla_failed = false; foreach ($slas as $sla) { $data = array (); - $data[0] = lang_string ('agent')." : ".dame_nombre_agente_agentemodulo ($sla['id_agent_module'])."\n"; - $data[0] .= lang_string ('module')." : ".dame_nombre_modulo_agentemodulo ($sla['id_agent_module'])."\n"; - $data[0] .= lang_string ('sla_max')." : ".$sla['sla_max']."\n"; - $data[0] .= lang_string ('sla_min')." : ".$sla['sla_min']; + $data[0] = __('agent')." : ".dame_nombre_agente_agentemodulo ($sla['id_agent_module'])."\n"; + $data[0] .= __('module')." : ".dame_nombre_modulo_agentemodulo ($sla['id_agent_module'])."\n"; + $data[0] .= __('sla_max')." : ".$sla['sla_max']."\n"; + $data[0] .= __('sla_min')." : ".$sla['sla_min']; $sla_value = get_agent_module_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max']); if ($sla_value === false) { - $data[1] = lang_string ('unknown'); + $data[1] = __('unknown'); } else { if ($sla_value < $sla['sla_limit']) { $pdf->setColor (0, 1, 0, 0); // Red @@ -201,16 +201,16 @@ function get_pdf_report ($report) { $pdf->ezTable ($table->data, $table->head, "", $table_options); if (! $sla_failed) { - $pdf->ezText (''.lang_string ('ok').'', 8); + $pdf->ezText (''.__('ok').'', 8); } else { - $pdf->ezText (''.lang_string ('fail').'', 8); + $pdf->ezText (''.__('fail').'', 8); } unset ($slas); break; case 4: case 'event_report': - doTitle ($pdf, lang_string ("event_report").' - '.$period); + doTitle ($pdf, __('event_report').' - '.$period); $table_events = event_reporting ($report['id_group'], $content['period'], 0, true); $pdf->ezTable ($table_events->data, $table_events->head, "", $table_options); @@ -221,7 +221,7 @@ function get_pdf_report ($report) { $alerts = get_alerts_in_group ($report['id_group']); $alerts_fired = get_alerts_fired ($alerts, $content['period']); - doTitle ($pdf, lang_string ("alert_report").': '.$group_name. + doTitle ($pdf, __('alert_report').': '.$group_name. ' - '.$period); $fired_percentage = round (sizeof ($alerts_fired) / sizeof ($alerts) * 100, 2); $not_fired_percentage = 100 - $fired_percentage; @@ -230,8 +230,8 @@ function get_pdf_report ($report) { '&tipo=alerts_fired_pipe&height=150&width=280&fired='. $fired_percentage.'¬_fired='.$not_fired_percentage; $pdf->ezImage ($image, 0, 150, 'none', 'left'); - $pdf->ezText (''.lang_string ('fired_alerts').': '.sizeof ($alerts_fired).'', 8); - $pdf->ezText (''.lang_string ('total_alerts_monitored').': '.sizeof ($alerts).'', 8); + $pdf->ezText (''.__('fired_alerts').': '.sizeof ($alerts_fired).'', 8); + $pdf->ezText (''.__('total_alerts_monitored').': '.sizeof ($alerts).'', 8); $pdf->ezText ("\n", 8); $table_alerts = get_fired_alerts_reporting_table ($alerts_fired); @@ -244,19 +244,19 @@ function get_pdf_report ($report) { case 6: case 'monitor_report': $value = get_agent_module_sla ($content["id_agent_module"], $content['period'], 1, 1); - doTitle ($pdf, lang_string ("monitor_report").': '.$agent_name.' - '.$module_name. + doTitle ($pdf, __('monitor_report').': '.$agent_name.' - '.$module_name. ' - '.$period); $pdf->setColor (0, 0.9, 0, 0); // Red - $pdf->ezText (''.lang_string ('up').': '.format_for_graph ($value, 2) . " %", 18); + $pdf->ezText (''.__('up').': '.format_for_graph ($value, 2) . " %", 18); $pdf->setColor (0.9, 0, 0, 1); // Grey - $pdf->ezText (''.lang_string ('down').': '.format_numeric (100 - $value, 2) . " %", 18); + $pdf->ezText (''.__('down').': '.format_numeric (100 - $value, 2) . " %", 18); $pdf->setColor (0, 0, 0, 1); // Black break; case 7: case 'avg_value': $value = get_agent_module_value_average ($content["id_agent_module"], $content['period']); - doTitle ($pdf, lang_string("avg_value").': '.$agent_name.' - '. + doTitle ($pdf, __('avg_value').': '.$agent_name.' - '. $module_name.' - '.$period); $pdf->ezText ("".format_for_graph ($value, 2)."", 18); @@ -264,7 +264,7 @@ function get_pdf_report ($report) { case 8: case 'max_value': $value = get_agent_module_value_max ($content["id_agent_module"], $content['period']); - doTitle ($pdf, lang_string ("max_value").': '.$agent_name. + doTitle ($pdf, __('max_value').': '.$agent_name. ' - '.$module_name.' - '.$period); $pdf->ezText ("".format_for_graph ($value, 2)."", 18); @@ -272,7 +272,7 @@ function get_pdf_report ($report) { case 9: case 'min_value': $value = get_agent_module_value_min ($content["id_agent_module"], $content['period']); - doTitle ($pdf, lang_string ("min_value").': '.$agent_name. + doTitle ($pdf, __('min_value').': '.$agent_name. ' - '.$module_name.' - '.$period); $pdf->ezText ("".format_for_graph ($value, 2)."", 18); @@ -280,15 +280,15 @@ function get_pdf_report ($report) { case 10: case 'sumatory': $value = get_agent_module_value_sumatory ($content["id_agent_module"], $content['period']); - doTitle ($pdf, lang_string ("sumatory").': '.$agent_name. + doTitle ($pdf, __('sumatory').': '.$agent_name. ' - '.$module_name.' - '.$period); $pdf->ezText ("".format_for_graph ($value, 2)."", 18); break; case 11: case 'general_group_report': - doTitle ($pdf, lang_string ("group").': '.$group_name); - $pdf->ezText ("".lang_string ('agents_in_group').': '.sizeof ($agents)."", 12); + doTitle ($pdf, __('group').': '.$group_name); + $pdf->ezText ("".__('agents_in_group').': '.sizeof ($agents)."", 12); break; case 12: @@ -296,7 +296,7 @@ function get_pdf_report ($report) { $monitors = get_monitors_in_group ($report['id_group']); $monitors_down = get_monitors_down ($monitors, $content['period']); - doTitle ($pdf, lang_string ("monitor_health").': '. + doTitle ($pdf, __('monitor_health').': '. $group_name. ' - '.$period); $down_percentage = round (sizeof ($monitors_down) / sizeof ($monitors) * 100, 2); $not_down_percentage = 100 - $down_percentage; @@ -306,8 +306,8 @@ function get_pdf_report ($report) { $down_percentage.'¬_down='.$not_down_percentage; $pdf->ezImage ($image, 0, 150, 'none', 'left'); $pdf->ezText ("\n", 4); - $pdf->ezText (''.lang_string ('total_monitors').': '.sizeof ($monitors).'', 8); - $pdf->ezText (''.lang_string ('monitors_down_on_period').': '.sizeof ($monitors_down).'', 8); + $pdf->ezText (''.__('total_monitors').': '.sizeof ($monitors).'', 8); + $pdf->ezText (''.__('monitors_down_on_period').': '.sizeof ($monitors_down).'', 8); $pdf->ezText ("\n", 8); $table_monitors = get_monitors_down_reporting_table ($monitors_down); @@ -319,25 +319,25 @@ function get_pdf_report ($report) { break; case 13: case 'agents_detailed': - doTitle ($pdf, lang_string ("agents_detailed").': '. - $group_name.' '.lang_string ('group')); + doTitle ($pdf, __('agents_detailed').': '. + $group_name.' '.__('group')); foreach ($agents as $agent) { $pdf->ezText ("".$agent['nombre']."", 18); $table = get_agent_modules_reporting_table ($agent['id_agente'], $content['period']); - $pdf->ezText ("".lang_string ('modules')."", 12); + $pdf->ezText ("".__('modules')."", 12); $pdf->ezText ("\n", 3); - $pdf->ezTable ($table->data, array (lang_string ('name')), "", $table_options); + $pdf->ezTable ($table->data, array (__('name')), "", $table_options); $table = get_agent_alerts_reporting_table ($agent['id_agente'], $content['period']); if (sizeof ($table->data)) { - $pdf->ezText ("".lang_string ('alerts')."", 12); + $pdf->ezText ("".__('alerts')."", 12); $pdf->ezText ("\n", 3); $pdf->ezTable ($table->data, $table->head, "", $table_options); } $table = get_agent_monitors_reporting_table ($agent['id_agente'], $content['period']); if (sizeof ($table->data)) { - $pdf->ezText ("".lang_string ('monitors')."", 12); + $pdf->ezText ("".__('monitors')."", 12); $pdf->ezText ("\n", 3); $pdf->ezTable ($table->data, $table->head, "", $table_options); } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 832018909f..af525c428a 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -137,8 +137,8 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = } function get_layout_data_types () { - $types = array (0 => lang_string ("static_graph"), - 1 => lang_string ("module_graph")); + $types = array (0 => __('static_graph'), + 1 => __('module_graph')); return $types; } diff --git a/pandora_console/index.php b/pandora_console/index.php index db174a08a2..6ed85a17c3 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -106,7 +106,7 @@ if ($intervalo > 0){ } ?> -Pandora FMS - <?php echo lang_string("header_title"); ?> +Pandora FMS - <?php echo __('header_title'); ?> @@ -184,8 +184,6 @@ if (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) { } else { // There is session for id_usuario $config["id_user"] = $_SESSION["id_usuario"]; - // Temporal fix - $id_user = $config["id_user"]; } // Log off @@ -249,7 +247,7 @@ if ($page != "") { } } } else { - echo "
    ".lang_string("Sorry! I can't find the page!").""; + echo "
    ".__('Sorry! I can\'t find the page!').""; } } else require ("general/logon_ok.php"); //default diff --git a/pandora_console/operation/agentes/bulbs.php b/pandora_console/operation/agentes/bulbs.php index 559b5db38b..e5c572f40b 100644 --- a/pandora_console/operation/agentes/bulbs.php +++ b/pandora_console/operation/agentes/bulbs.php @@ -22,21 +22,21 @@ echo " + ".__('green_light')." + ".__('red_light')." + ".__('yellow_light')." + ".__('fired')." + ".__('no_light')." + ".__('blue_light')." + ".__('broken_light')." + ".__('not_fired')."
    - ".$lang_label["green_light"]." - ".$lang_label["red_light"]." - ".$lang_label["yellow_light"]." - ".$lang_label["fired"]."
    - ".$lang_label["no_light"]." - ".$lang_label["blue_light"]." - ".$lang_label["broken_light"]." - ".$lang_label["not_fired"]."
    "; diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index 880294758f..5bbaf2a79d 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -20,69 +20,77 @@ // Load global vars require ("include/config.php"); +check_login(); + +if (give_acl ($config['id_user'], 0, "AR")!=1) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Agent Data view"); + require ("general/noaccess.php"); + exit; +} + function datos_raw ($id_agente_modulo, $periodo){ - global $config; + global $config; require("include/languages/language_".$config["language"].".php"); - $id_user = $config["id_user"]; + $periodo_label = $periodo; switch ($periodo) { - case "mes": - $periodo = 2592000; - $et=$lang_label["last_month"]; - break; - case "semana": - $periodo = 604800; - $et=$lang_label["last_week"]; - break; - case "dia": - $periodo = 86400; - $et=$lang_label["last_24"]; - break; + case "mes": + $periodo = 2592000; + $et=__('last_month'); + break; + case "semana": + $periodo = 604800; + $et=__('last_week'); + break; + case "dia": + $periodo = 86400; + $et=__('last_24'); + break; } $periodo = time () - $periodo; $id_agent = give_agent_id_from_module_id ($id_agente_modulo); $id_group = get_db_value ("id_grupo", "tagente", "id_agente", $id_agent); // Different query for string data type $id_tipo_modulo = dame_id_tipo_modulo_agentemodulo($id_agente_modulo); - if ( (dame_nombre_tipo_modulo($id_tipo_modulo) == "generic_data_string" ) OR - (dame_nombre_tipo_modulo($id_tipo_modulo) == "remote_tcp_string" ) OR - (dame_nombre_tipo_modulo($id_tipo_modulo) == "remote_snmp_string" )) { + if ( (dame_nombre_tipo_modulo ($id_tipo_modulo) == "generic_data_string" ) || + (dame_nombre_tipo_modulo ($id_tipo_modulo) == "remote_tcp_string" ) || + (dame_nombre_tipo_modulo ($id_tipo_modulo) == "remote_snmp_string" )) { $sql1="SELECT * FROM tagente_datos_string WHERE id_agente_modulo = ". $id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."' ORDER BY timestamp DESC"; $string_type = 1; } else { - $sql1="SELECT * FROM tagente_datos WHERE id_agente_modulo = ". - $id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."' - ORDER BY timestamp DESC"; + $sql1 = "SELECT * FROM tagente_datos WHERE id_agente_modulo = ". + $id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."' + ORDER BY timestamp DESC"; $string_type = 0; } - $result=mysql_query($sql1); - $nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo); - $nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo); + $result = mysql_query ($sql1); + $nombre_agente = dame_nombre_agente_agentemodulo ($id_agente_modulo); + $nombre_modulo = dame_nombre_modulo_agentemodulo ($id_agente_modulo); - echo "

    ".$lang_label["data_received"]." + echo "

    ".__('data_received')." '$nombre_agente' / '$nombre_modulo'

    "; echo "

    ". $et ."

    "; - if (mysql_num_rows($result)){ + if (mysql_num_rows ($result)) { echo ""; $color=1; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; while ($row=mysql_fetch_array($result)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; - } - else { + } else { $tdcolor = "datos2"; $color = 1; } echo ""; - if ((give_acl($id_user, $id_group, "AW") ==1) AND ($string_type == 0)){ + if ((give_acl ($config['id_user'], $id_group, "AW") ==1) && ($string_type == 0)) { echo ""; echo ""; } echo "
    ".$lang_label["delete"]."".$lang_label["timestamp"]."".$lang_label["data"]."".__('delete')."".__('timestamp')."".__('data')."
    "; echo ""; } else { @@ -90,16 +98,15 @@ function datos_raw ($id_agente_modulo, $periodo){ } echo "".$row["timestamp"].""; - if (is_numeric($row["datos"])) { + if (is_numeric ($row["datos"])) { echo format_for_graph ($row["datos"]); } else { - echo salida_limpia($row["datos"]); + echo salida_limpia ($row["datos"]); } echo "
    "; - } - else { + } else { echo "
    no_data
    "; } } @@ -108,31 +115,20 @@ function datos_raw ($id_agente_modulo, $periodo){ // Page begin // --------------- -check_login(); - -$id_user = $_SESSION["id_usuario"]; - -if (give_acl($id_user, 0, "AR")!=1) { - audit_db ($id_user, $REMOTE_ADDR, "ACL Violation", - "Trying to access Agent Data view"); - require ("general/noaccess.php"); - exit; -} - -if (isset($_GET["tipo"]) AND isset($_GET["id"])) { - $id =entrada_limpia($_GET["id"]); - $tipo= entrada_limpia($_GET["tipo"]); +if (isset ($_GET["tipo"]) && isset ($_GET["id"])) { + $id = get_parameter ("id"); + $tipo= get_parameter ("tipo"); } else { - echo "

    ".$lang_label["graf_error"]."

    "; + echo "

    ".__('graf_error')."

    "; exit; } if (isset($_GET["delete"])) { $delete =$_GET["delete"]; $sql = "DELETE FROM tagente_datos WHERE id_agente_datos = $delete"; - $result=mysql_query($sql); + $result = process_sql ($sql); } -datos_raw ($id,$tipo); +datos_raw ($id, $tipo); ?> diff --git a/pandora_console/operation/agentes/estadisticas.php b/pandora_console/operation/agentes/estadisticas.php index 5bf8dfdab3..6168fe2f95 100644 --- a/pandora_console/operation/agentes/estadisticas.php +++ b/pandora_console/operation/agentes/estadisticas.php @@ -20,20 +20,20 @@ // Load global vars require("include/config.php"); -if (comprueba_login() == 0){ - $iduser_temp=$_SESSION['id_usuario']; - if (give_acl($iduser_temp, 0, "AR") == 1){ - echo "

    ".$lang_label["ag_title"]." > "; - echo $lang_label["db_stat_agent"]."

    "; - echo ""; - echo "

    "; - echo "

    "; - echo "

    "; - echo "
    "; - } - else { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent estatistics"); - require ("general/noaccess.php"); - } + +check_login (); + +if (! give_acl ($config['id_user'], 0, "AR")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access Agent estatistics"); + require ("general/noaccess.php"); + return; } -?> \ No newline at end of file +echo "

    ".__('ag_title')." > "; +echo __('db_stat_agent')."

    "; +echo ""; +echo "

    "; +echo "

    "; +echo "

    "; +echo "
    "; +?> diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index eb2f6a8d99..a199282efe 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -20,8 +20,9 @@ require ("include/config.php"); check_login (); -if (give_acl($id_user, 0, "AR") == 0) { - audit_db ($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access agent main list view"); +if (! give_acl ($config['id_user'], 0, "AR")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access agent main list view"); require ("general/noaccess.php"); exit; } @@ -37,7 +38,7 @@ if (isset($_GET["ag_group_refresh"])){ } $search = get_parameter ("search", ""); -echo "

    ".$lang_label["ag_title"]." > ".$lang_label["summary"]."

    "; +echo "

    ".__('ag_title')." > ".__('summary')."

    "; // Show group selector (POST) if (isset($_POST["ag_group"])){ @@ -52,7 +53,7 @@ if (isset($_POST["ag_group"])){ } echo ""; -echo ""; +echo ""; echo "
    ".$lang_label["group"]."".__('group').""; echo ""; echo " "; -echo $lang_label["free_text_search"]; +echo __('free_text_search'); echo ""; echo "
    "; echo ""; echo "
    "; echo ""; +value='".__('search')."'>"; echo ""; echo "
    "; @@ -94,53 +95,71 @@ if ($ag_group > 1){ AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"]; $sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group AND disabled = 0 $search_sql ORDER BY nombre"; - // Not selected any specific group } else { -// Is admin user ?? -if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){ - $sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; - $sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo"; + // Is admin user ?? + $sql = sprintf ("SELECT * FROM tusuario WHERE id_usuario ='%s'", $config['id_user']); + if (get_db_sql ($sql, "nivel") == 1) { + $sql = "SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; + $sql2 = "SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo"; + // standard user + } else { + // User has explicit permission on group 1 ? + $sql = sprintf ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='%s' AND id_grupo = 1", $config['id_user']); + $all_group = get_db_sql ($sql); -// standard user -} else { - - // User has explicit permission on group 1 ? - $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='$id_user' AND id_grupo = 1"); + if ($all_group > 0) { + $sql = sprintf ("SELECT * FROM tagente + WHERE disabled = 0 %s + ORDER BY nombre, id_grupo LIMIT %d,%d", + $search_sql, $offset, + $config["block_size"]); + $sql2 = sprint ("SELECT COUNT(id_agente) + FROM tagente WHERE disabled = 0 %s + ORDER BY nombre, id_grupo", + $search_sql); + } else { + $sql = sprintf ("SELECT * FROM tagente + WHERE disabled = 0 %s + AND id_grupo IN (SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario='%s') + ORDER BY nombre, id_grupo LIMIT %d,%d", + $search_sql, $config['id_user'], $offset, + $config["block_size"]); + $sql2 = sprintf ("SELECT COUNT(id_agente) + FROM tagente + WHERE disabled = 0 %s + AND id_grupo IN (SELECT id_grupo + FROM tusuario_perfil + WHERE id_usuario='%s') + ORDER BY nombre, id_grupo", + $search_sql, $config['id_user']); + } - if ($all_group > 0){ - $sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql - ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; - $sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql - ORDER BY nombre, id_grupo"; - } else { - $sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') - ORDER BY nombre, id_grupo LIMIT $offset,".$config["block_size"]; - $sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo"; - } - -} + } } -$result2=mysql_query($sql2); -$row2=mysql_fetch_array($result2); +$result2 = mysql_query ($sql2); +$row2 = mysql_fetch_array ($result2); $total_events = $row2[0]; // Prepare pagination pagination ($total_events, -"index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60", $offset); + "index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60", + $offset); // Show data. $result=mysql_query($sql); if (mysql_num_rows($result)){ echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; // For every agent defined in the agent table $color = 1; while ($row=mysql_fetch_array($result)){ @@ -230,7 +249,7 @@ if (mysql_num_rows($result)){ } echo ""; echo ""; echo "
    ".$lang_label["agent"]."".$lang_label["os"]."".$lang_label["interval"]."".$lang_label["group"]."".$lang_label["modules"]."".$lang_label["status"]."".$lang_label["alerts"]."".$lang_label["last_contact"]."".__('agent')."".__('os')."".__('interval')."".__('group')."".__('modules')."".__('status')."".__('alerts')."".__('last_contact')."
    "; - if (give_acl($id_user, $id_grupo, "AW")==1){ + if (give_acl ($config['id_user'], $id_grupo, "AW")) { echo " @@ -299,21 +318,21 @@ echo '"; + echo ""; } else { - echo ""; + echo ""; } } elseif ($monitor_ok > 0) { - echo ""; + echo ""; } elseif ($numero_datamodules > 0) { - echo ""; + echo ""; } elseif ($monitor_down > 0) { - echo ""; + echo ""; } } else - echo ""; + echo ""; // checks if an alert was fired recently echo ""; @@ -321,14 +340,14 @@ echo '"; else { if (check_alert_fired($id_agente) == 1) - echo ""; + echo ""; else - echo ""; + echo ""; } echo ""; if ( $ultimo_contacto == "0000-00-00 00:00:00"){ - echo $lang_label["never"]; + echo __('never'); } else { $ultima = strtotime($ultimo_contacto); $ahora = strtotime("now"); @@ -355,12 +374,16 @@ echo '
    "; require "bulbs.php"; } else { - echo '

    '.$lang_label["no_agent"].'
    '; - $id_user = $_SESSION["id_usuario"]; - if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1 ) OR (give_acl($id_user, 0, "PM")==1) OR (give_acl($id_user, 0, "DM")==1) OR (give_acl($id_user, 0, "UM")==1 )){ + echo '

    '.__('no_agent').'
    '; + if (give_acl ($config['id_user'], 0, "LM") + || give_acl ($config['id_user'], 0, "AW") + || give_acl ($config['id_user'], 0, "PM") + || give_acl ($config['id_user'], 0, "DM") + || give_acl ($config['id_user'], 0, "UM")) { + echo " 
    "; + sec2=godmode/agentes/configurar_agente&create_agent=1'>"; } } diff --git a/pandora_console/operation/agentes/estado_alertas.php b/pandora_console/operation/agentes/estado_alertas.php index b17b9aa193..5f36d4628d 100644 --- a/pandora_console/operation/agentes/estado_alertas.php +++ b/pandora_console/operation/agentes/estado_alertas.php @@ -19,26 +19,17 @@ // Load global vars require ("include/config.php"); -// Login check -$id_usuario=$_SESSION["id_usuario"]; -global $REMOTE_ADDR; -if (check_login() != 0) { - audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access alert view"); +check_login (); + +if (! give_acl ($config["id_user"], 0, "AR") && ! give_acl ($config["id_user"], 0, "AW")) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + "Trying to access alert view"); include ("general/noaccess.php"); exit; } -if ((give_acl($config["id_user"], 0, "AR")!=1) AND (!give_acl($config["id_user"],0,"AW")) AND (dame_admin($config["id_user"])!=1)) { - audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access alert view"); - include ("general/noaccess.php"); - exit; -} - - -// ------------------------------- // Show alerts for specific agent -// ------------------------------- if (isset($_GET["id_agente"])){ $id_agente = $_GET["id_agente"]; @@ -50,29 +41,29 @@ if (isset($_GET["id_agente"])){ } if (isset($_GET["tab"])){ - echo "

    ".$lang_label["ag_title"]." > ".$lang_label["alert_listing"]."

    "; + echo "

    ".__('ag_title')." > ".__('alert_listing')."

    "; } - $query_gen='SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente ='.$id_agente; + $query_gen='SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente ='.$id_agente; $result_gen=mysql_query($query_gen); if (mysql_num_rows ($result_gen)) { if (!isset($_GET["tab"])) { - echo "

    ".$lang_label["alert_listing"]."

    "; + echo "

    ".__('alert_listing')."

    "; } echo ""; echo " - - - - - - - - - - "; + + + + + + + + + + "; $color=1; while ($data=mysql_fetch_array($result_gen)){ if ($color == 1){ @@ -87,28 +78,27 @@ if (isset($_GET["id_agente"])){ show_alert_show_view ($data, $tdcolor, 0); } - // Show combined alerts for this agent - $result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente"); - if (mysql_num_rows ($result_com)) { - echo ""; - show_alert_show_view ($data_com, $tdcolor, 1); - } - + // Show combined alerts for this agent + $result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente"); + if (mysql_num_rows ($result_com)) { + echo ""; + show_alert_show_view ($data_com, $tdcolor, 1); + } + echo '
    ".$lang_label["type"]."".$lang_label["name"]."".$lang_label["description"]."".$lang_label["Info"]."".$lang_label["min."]."".$lang_label["max."]."".$lang_label["time_threshold"]."".$lang_label["last_fired"]."".$lang_label["times_fired"]."".$lang_label["status"]."".$lang_label["validate"]."".__('type')."".__('name')."".__('description')."".__('Info')."".__('min.')."".__('max.')."".__('time_threshold')."".__('last_fired')."".__('times_fired')."".__('status')."".__('validate')."
    ".lang_string("Combined alerts")."
    "; - } - while ($data_com=mysql_fetch_array($result_com)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo "
    ".__('Combined alerts')."
    "; + } + while ($data_com=mysql_fetch_array($result_com)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } else { + $tdcolor = "datos2"; + $color = 1; + } + echo "
    '; } else { - echo "
    ".$lang_label["no_alerts"]."
    "; + echo "
    ".__('no_alerts')."
    "; } // Show alert for no defined agent @@ -117,20 +107,20 @@ if (isset($_GET["id_agente"])){ // SHOW ALL ALERTS (GENERAL PAGE) // ------------------------------- - echo "

    ".$lang_label["ag_title"]." > "; - echo $lang_label["alert_listing"]."

    "; + echo "

    ".__('ag_title')." > "; + echo __('alert_listing')."

    "; $iduser_temp=$_SESSION['id_usuario']; - $ag_group = get_parameter ("ag_group", -1); + $ag_group = get_parameter ("ag_group", -1); - if ($ag_group != -1) + if ($ag_group != -1) echo "
    "; else echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; echo ""; // Display single alerts - // ======================= if ($ag_group > 1) $sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre'; else $sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre'; - $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; - // Agent group selector - if ($ag_group > 1) - $sql .=" AND tagente.id_grupo = ".$ag_group; - else { - // User has explicit permission on group 1 ? - $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); - if ($all_group == 0) - $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; - } + $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; + // Agent group selector + if ($ag_group > 1) + $sql .=" AND tagente.id_grupo = ".$ag_group; + else { + // User has explicit permission on group 1 ? + $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); + if ($all_group == 0) + $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; + } - $color=1; $string = ''; - $result=mysql_query($sql); - if ($result) - while ($row=mysql_fetch_array($result)){ //while there are agents + $color=1; $string = ''; + $result=mysql_query($sql); + if ($result) + while ($row=mysql_fetch_array($result)) { //while there are agents $id_agente = $row['id_agente']; $nombre_agente = strtoupper($row["nombre"]); $query_gen='SELECT talerta_agente_modulo.id_alerta, @@ -197,9 +186,9 @@ if (isset($_GET["id_agente"])){ ".$nombre_agente.""; $string .= ""; @@ -207,7 +196,7 @@ if (isset($_GET["id_agente"])){ $data["descripcion"].""; if ($data["last_fired"] == "0000-00-00 00:00:00") { $string=$string.""; + __('never').""; } else { $string=$string.""; @@ -217,97 +206,95 @@ if (isset($_GET["id_agente"])){ } } //end while - // Display combined alerts - // ======================= - $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; - // Agent group selector - if ($ag_group > 1) - $sql .=" AND tagente.id_grupo = ".$ag_group; - else { - // User has explicit permission on group 1 ? - $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); - if ($all_group == 0) - $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; - } + // Display combined alerts + // ======================= + $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; + // Agent group selector + if ($ag_group > 1) + $sql .=" AND tagente.id_grupo = ".$ag_group; + else { + // User has explicit permission on group 1 ? + $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); + if ($all_group == 0) + $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; + } - $result=mysql_query($sql); - $color=1; - if ($result) - while ($row=mysql_fetch_array($result)){ //while there are agents - $id_agente = $row['id_agente']; - $nombre_agente = strtoupper($row["nombre"]); - $query_gen='SELECT talerta_agente_modulo.id_alerta, - talerta_agente_modulo.descripcion, - talerta_agente_modulo.last_fired, - talerta_agente_modulo.times_fired, - talerta_agente_modulo.id_agent - FROM talerta_agente_modulo - WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 '; - $result_gen=mysql_query($query_gen); - if (mysql_num_rows ($result_gen)) { - while ($data=mysql_fetch_array($result_gen)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - if (!isset($string)) { - $string=''; - } - $string = $string.""; - $string=$string.""; - if ($data["last_fired"] == "0000-00-00 00:00:00") { - $string=$string.""; - } else { - $string=$string.""; - - - } - $string=$string.""; - } - } - } //end while + $result=mysql_query($sql); + $color=1; + if ($result) + while ($row=mysql_fetch_array($result)){ //while there are agents + $id_agente = $row['id_agente']; + $nombre_agente = strtoupper($row["nombre"]); + $query_gen='SELECT talerta_agente_modulo.id_alerta, + talerta_agente_modulo.descripcion, + talerta_agente_modulo.last_fired, + talerta_agente_modulo.times_fired, + talerta_agente_modulo.id_agent + FROM talerta_agente_modulo + WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 '; + $result_gen=mysql_query($query_gen); + if (mysql_num_rows ($result_gen)) { + while ($data=mysql_fetch_array($result_gen)){ + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + if (!isset($string)) { + $string=''; + } + $string = $string.""; + $string=$string.""; + if ($data["last_fired"] == "0000-00-00 00:00:00") { + $string=$string.""; + } else { + $string=$string.""; + } + $string=$string.""; + } + } + } //end while if ($string != "") { echo ""; + echo " ".__('fired').""; echo "
    ".$lang_label["group"]."
    ".__('group').""; echo " "; if ($data["times_fired"] <> 0) - $string .= ""; + $string .= ""; else - $string .= ""; + $string .= ""; $string = $string."" .dame_nombre_alerta($data["id_alerta"])."". - $lang_label["never"]."". human_time_comparation($data["last_fired"])."
    - - ".$nombre_agente." (*)"; - $string .= ""; - if ($data["times_fired"] <> 0) - $string .= ""; - else - $string .= ""; - - $string = $string."" - .dame_nombre_alerta($data["id_alerta"])."". - $data["descripcion"]."". - $lang_label["never"]."". - human_time_comparation($data["last_fired"])."". - $data["times_fired"]."
    + + ".$nombre_agente." (*)"; + $string .= ""; + if ($data["times_fired"] <> 0) + $string .= ""; + else + $string .= ""; + + $string = $string."" + .dame_nombre_alerta($data["id_alerta"])."". + $data["descripcion"]."". + __('never')."". + human_time_comparation($data["last_fired"])."". + $data["times_fired"].""; - echo " ".$lang_label["fired"].""; - echo " ".$lang_label["not_fired"]; - echo "(*) ".lang_string("Combined alert")."
    "; + echo " ".__('not_fired'); + echo "(*) ".__('Combined alert').""; echo "
    "; echo ""; echo " - - - - - - "; + + + + + + "; echo $string; //built table of alerts echo "
    ".$lang_label["agent"]."".$lang_label["status"]."".$lang_label["type"]."".$lang_label["description"]."".$lang_label["last_fired"]."".$lang_label["times_fired"]."".__('agent')."".__('status')."".__('type')."".__('description')."".__('last_fired')."".__('times_fired')."
    "; } else { echo "
    ". - $lang_label["no_alert"]."
    "; + __('no_alert').""; } } // Main alert view ?> diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 33a680859a..fe68e07e3f 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -40,7 +40,7 @@ if (isset($_GET["id_agente"])){ $disabled= $row["disabled"]; $network_server = $row["id_network_server"]; } else { - echo "

    ".$lang_label["agent_error"]."

    "; + echo "

    ".__('agent_error')."

    "; echo ""; echo "