From b69d40aba9849e9087568ca7456b962b82ec4376 Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Tue, 28 Oct 2008 14:22:44 +0000 Subject: [PATCH] 2008-10-28 Esteban Sanchez * godmode/modules/manage_network_components.php: Replaced parameters manual check using entrada_limpia with get_parameter(). It was causing PHP notices and was not working fine. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1197 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 67 +++++---- .../modules/manage_network_components.php | 131 ++++++------------ 2 files changed, 82 insertions(+), 116 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fe903851cc..fe08ef4d83 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2008-10-28 Esteban Sanchez + + * godmode/modules/manage_network_components.php: Replaced parameters + manual check using entrada_limpia with get_parameter(). It was causing + PHP notices and was not working fine. + 2008-10-27 Evi Vanoost * godmode/users/user_list.php: Rewrite to use print_table. Fixed @@ -122,25 +128,26 @@ 2008-10-21 Jorge Gonzalez * operation/servers/view_server.php, - godmode/agentes/module_manager_editor_network.php, - godmode/agentes/module_manager_editor_wmi.php, - godmode/agentes/module_manager_editor_plugin.php, - godmode/agentes/module_manager_editor_prediction.php, - godmode/agentes/module_manager_editor_data.php, - godmode/agentes/configurar_agente.php: added translation context. + godmode/agentes/module_manager_editor_network.php, + godmode/agentes/module_manager_editor_wmi.php, + godmode/agentes/module_manager_editor_plugin.php, + godmode/agentes/module_manager_editor_prediction.php, + godmode/agentes/module_manager_editor_data.php, + godmode/agentes/configurar_agente.php: Added translation context. * include/languages/cs.po, include/languages/pt_BR.po, - include/languages/es.po, include/languages/uk.po, - include/languages/ro.po, include/languages/fr.po, - include/languages/ca.po, include/languages/de.po, - include/languages/sv.po, include/languages/zh_TW.po, - include/languages/hi.po, include/languages/zh_CN.po, - include/languages/te.po, include/languages/eu.po, - include/languages/hu.po, include/languages/ru.po, - include/languages/gl.po, include/languages/pl.po, - include/languages/it.po, include/languages/sl.po, - include/languages/pt.po, include/languages/ast.po, - include/languages/index.pot: Updated translations from Rosetta, thanks to all contributors. + include/languages/es.po, include/languages/uk.po, + include/languages/ro.po, include/languages/fr.po, + include/languages/ca.po, include/languages/de.po, + include/languages/sv.po, include/languages/zh_TW.po, + include/languages/hi.po, include/languages/zh_CN.po, + include/languages/te.po, include/languages/eu.po, + include/languages/hu.po, include/languages/ru.po, + include/languages/gl.po, include/languages/pl.po, + include/languages/it.po, include/languages/sl.po, + include/languages/pt.po, include/languages/ast.po, + include/languages/index.pot: Updated translations from Rosetta, thanks to + all contributors. 2008-10-21 Manuel Arostegui @@ -204,8 +211,8 @@ 2008-10-20 Jorge Gonzalez * operation/agentes/estado_agente.php, operation/agentes/bulbs.php: - fixed bug, blue monitor means it has no monitors, while gray means - it has no data. + fixed bug, blue monitor means it has no monitors, while gray means + it has no data. 2008-10-20 Esteban Sanchez @@ -215,17 +222,17 @@ 2008-10-20 Jorge Gonzalez * include/languages/cs.po, include/languages/pt_BR.po, - include/languages/es.po, include/languages/uk.po, - include/languages/ro.po, include/languages/fr.po, - include/languages/ca.po, include/languages/de.po, - include/languages/sv.po, include/languages/zh_TW.po, - include/languages/hi.po, include/languages/zh_CN.po, - include/languages/te.po, include/languages/eu.po, - include/languages/hu.po, include/languages/ru.po, - include/languages/gl.po, include/languages/pl.po, - include/languages/it.po, include/languages/sl.po, - include/languages/pt.po, include/languages/ast.po: Updated - translations from Rosetta, thanks to all contributors. + include/languages/es.po, include/languages/uk.po, + include/languages/ro.po, include/languages/fr.po, + include/languages/ca.po, include/languages/de.po, + include/languages/sv.po, include/languages/zh_TW.po, + include/languages/hi.po, include/languages/zh_CN.po, + include/languages/te.po, include/languages/eu.po, + include/languages/hu.po, include/languages/ru.po, + include/languages/gl.po, include/languages/pl.po, + include/languages/it.po, include/languages/sl.po, + include/languages/pt.po, include/languages/ast.po: Updated + translations from Rosetta, thanks to all contributors. * Makefile: modified entries to make them be in alphabetic order. diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 4afcfa7b5e..4177d3484c 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -49,53 +49,33 @@ $plugin_parameter = ""; // ------------------ if (isset($_GET["create"])){ // Create module - if (isset($_POST["tipo"])) - $type = entrada_limpia($_POST["tipo"]); - if (isset($_POST["name"])) - $name = entrada_limpia($_POST["name"]); - if (isset($_POST["descripcion"])) - $description = entrada_limpia($_POST["descripcion"]); - if (isset($_POST["modulo_max"])) - $modulo_max = entrada_limpia($_POST["modulo_max"]); - if (isset($_POST["modulo_min"])) - $modulo_min = entrada_limpia($_POST["modulo_min"]); - if (isset($_POST["tcp_send"])) - $tcp_send = entrada_limpia($_POST["tcp_send"]); - if (isset($_POST["tcp_rcv"])) - $tcp_rcv = entrada_limpia($_POST["tcp_rcv"]); - if (isset($_POST["tcp_port"])) - $tcp_port = entrada_limpia($_POST["tcp_port"]); - if (isset($_POST["snmp_oid"])) - $snmp_oid = entrada_limpia($_POST["snmp_oid"]); - if (isset($_POST["snmp_community"])) - $snmp_community = entrada_limpia($_POST["snmp_community"]); - if (isset($_POST["id_module_group"])) - $id_module_group = entrada_limpia($_POST["id_module_group"]); - if (isset($_POST["module_interval"])) - $module_interval = entrada_limpia($_POST["module_interval"]); - if (isset($_POST["id_group"])) - $id_group = entrada_limpia($_POST["id_group"]); - if (isset($_POST["plugin_user"])) - $plugin_user = entrada_limpia($_POST["plugin_user"]); - if (isset($_POST["plugin_pass"])) - $plugin_pass = entrada_limpia($_POST["plugin_pass"]); - if (isset($_POST["plugin_parameter"])) - $plugin_parameter = entrada_limpia($_POST["plugin_parameter"]); - if (isset($_POST["max_timeout"])) - $max_timeout = entrada_limpia($_POST["max_timeout"]); - if (isset($_POST["id_modulo"])) - $id_modulo = entrada_limpia($_POST["id_modulo"]); - + $type = get_parameter ('tipo'); + $name = get_parameter ('name'); + $description = get_parameter ('descripcion'); + $modulo_max = get_parameter ('modulo_max', 0); + $modulo_min = get_parameter ('modulo_min', 0); + $tcp_send = get_parameter ('tcp_send'); + $tcp_rcv = get_parameter ('tcp_rcv'); + $tcp_port = get_parameter ('tcp_port'); + $snmp_oid = get_parameter ('snmp_oid'); + $snmp_community = get_parameter ('snmp_community'); + $id_module_group = get_parameter ('id_module_group'); + $module_interval = get_parameter ('module_interval'); + $id_group = get_parameter ('id_group'); + $plugin_user = get_parameter ('plugin_user'); + $plugin_pass = get_parameter ('plugin_pass'); + $plugin_parameter = get_parameter ('plugin_parameter'); + $max_timeout = get_parameter ('max_timeout'); + $id_modulo = get_parameter ('id_modulo'); - $sql_insert="INSERT INTO tnetwork_component (name, description, module_interval, type, max, min, tcp_send, tcp_rcv, tcp_port, snmp_oid, snmp_community, id_module_group, id_group, id_modulo, plugin_user, plugin_pass, plugin_parameter, max_timeout) + $sql = "INSERT INTO tnetwork_component (name, description, module_interval, type, max, min, tcp_send, tcp_rcv, tcp_port, snmp_oid, snmp_community, id_module_group, id_group, id_modulo, plugin_user, plugin_pass, plugin_parameter, max_timeout) VALUES ('$name', '$description', '$module_interval', '$type', '$modulo_max', '$modulo_min', '$tcp_send', '$tcp_rcv', '$tcp_port', '$snmp_oid' ,'$snmp_community', '$id_module_group', '$id_group', '$id_modulo', '$plugin_user', '$plugin_pass', '$plugin_parameter', '$max_timeout')"; - $result=mysql_query($sql_insert); - if (! $result) + $id_module = process_sql ($sql, 'insert_id'); + if ($id_module === false) echo "

".__('Not created. Error inserting data')."

"; else { echo "

".__('Created successfully')."

"; - $id_module = mysql_insert_id(); } } @@ -103,54 +83,33 @@ if (isset($_GET["create"])){ // Create module // UPDATE MODULE // ------------------ if (isset($_GET["update"])){ // if modified any parameter - $id_nc = entrada_limpia ($_GET["id_nc"]); + $id_nc = get_parameter ('id_nc'); - if (isset($_POST["tipo"])) - $type = entrada_limpia($_POST["tipo"]); - if (isset($_POST["name"])) - $name = entrada_limpia($_POST["name"]); - if (isset($_POST["descripcion"])) - $description = entrada_limpia($_POST["descripcion"]); - if (isset($_POST["modulo_max"])) - $modulo_max = entrada_limpia($_POST["modulo_max"]); - if ($modulo_max == "") - $modulo_max = 0; - if (isset($_POST["modulo_min"])) - $modulo_min = entrada_limpia($_POST["modulo_min"]); - if ($modulo_min == "") - $modulo_min = 0; - if (isset($_POST["tcp_send"])) - $tcp_send = entrada_limpia($_POST["tcp_send"]); - if (isset($_POST["tcp_rcv"])) - $tcp_rcv = entrada_limpia($_POST["tcp_rcv"]); - if (isset($_POST["tcp_port"])) - $tcp_port = entrada_limpia($_POST["tcp_port"]); - if (isset($_POST["snmp_oid"])) - $snmp_oid = entrada_limpia($_POST["snmp_oid"]); - if (isset($_POST["snmp_community"])) - $snmp_community = entrada_limpia($_POST["snmp_community"]); - if (isset($_POST["id_module_group"])) - $id_module_group = entrada_limpia($_POST["id_module_group"]); - if (isset($_POST["module_interval"])) - $module_interval = entrada_limpia($_POST["module_interval"]); - if (isset($_POST["id_group"])) - $id_group = entrada_limpia($_POST["id_group"]); - if (isset($_POST["plugin_user"])) - $plugin_user = entrada_limpia($_POST["plugin_user"]); - if (isset($_POST["plugin_pass"])) - $plugin_pass = entrada_limpia($_POST["plugin_pass"]); - if (isset($_POST["plugin_parameter"])) - $plugin_parameter = entrada_limpia($_POST["plugin_parameter"]); - if (isset($_POST["max_timeout"])) - $max_timeout = entrada_limpia($_POST["max_timeout"]); + $type = get_parameter ('tipo'); + $name = get_parameter ('name'); + $description = get_parameter ('descripcion'); + $modulo_max = get_parameter ('modulo_max', 0); + $modulo_min = get_parameter ('modulo_min', 0); + $tcp_send = get_parameter ('tcp_send'); + $tcp_rcv = get_parameter ('tcp_rcv'); + $tcp_port = get_parameter ('tcp_port'); + $snmp_oid = get_parameter ('snmp_oid'); + $snmp_community = get_parameter ('snmp_community'); + $id_module_group = get_parameter ('id_module_group'); + $module_interval = get_parameter ('module_interval'); + $id_group = get_parameter ('id_group'); + $plugin_user = get_parameter ('plugin_user'); + $plugin_pass = get_parameter ('plugin_pass'); + $plugin_parameter = get_parameter ('plugin_parameter'); + $max_timeout = get_parameter ('max_timeout'); - $sql_update ="UPDATE tnetwork_component SET name = '$name', + $sql ="UPDATE tnetwork_component SET name = '$name', description = '$description', snmp_oid = '$snmp_oid', snmp_community = '$snmp_community', id_group = '$id_group', tcp_rcv = '$tcp_rcv', tcp_send = '$tcp_send', max = '$modulo_max', min = '$modulo_min', tcp_port = '$tcp_port', id_module_group = '$id_module_group', type = '$type', module_interval = '$module_interval', plugin_user = '$plugin_user', plugin_pass = '$plugin_pass', plugin_parameter = '$plugin_parameter', max_timeout = '$max_timeout' WHERE id_nc = '$id_nc'"; - $result=mysql_query($sql_update); + $result = process_sql ($sql); if (! $result) echo "

".__('Not updated. Error updating data')."

"; else @@ -162,14 +121,14 @@ if (isset($_GET["update"])){ // if modified any parameter // ------------------ if (isset($_GET["delete"])){ // if delete $id_nc = entrada_limpia ($_GET["id_nc"]); - $sql_delete= "DELETE FROM tnetwork_component WHERE id_nc = ".$id_nc; - $result=mysql_query($sql_delete); + $sql= "DELETE FROM tnetwork_component WHERE id_nc = ".$id_nc; + $result = process_sql ($sql); if (! $result) echo "

".__('Not deleted. Error deleting data')."

"; else echo "

".__('Deleted successfully')."

"; - $sql_delete= "DELETE FROM tnetwork_profile_component WHERE id_nc = ".$id_nc; - $result=mysql_query($sql_delete); + $sql = "DELETE FROM tnetwork_profile_component WHERE id_nc = ".$id_nc; + $result = process_sql ($sql); } // ------------------