2011-08-24 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/module_manager_editor.php: added javascript alert message
	when the name in field and remote config is different.
	
	Fixes: #3397306

	* godmode/agentes/configurar_agente.php: fixed when copy a module the name
	now is safe input type.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4818 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-08-24 17:52:52 +00:00
parent 4733b866dc
commit 9192987cf0
3 changed files with 51 additions and 4 deletions

View File

@ -1,3 +1,13 @@
2011-08-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor.php: added javascript alert message
when the name in field and remote config is different.
Fixes: #3397306
* godmode/agentes/configurar_agente.php: fixed when copy a module the name
now is safe input type.
2011-08-24 Sancho Lerena <slerena@artica.es>
* include/help/en/help_snmp_alert_field1.php: New help page.

View File

@ -905,8 +905,8 @@ if ($delete_module) { // DELETE agent module !
if ($duplicate_module) { // DUPLICATE agent module !
$id_duplicate_module = (int) get_parameter_get ("duplicate_module",0);
$result = modules_copy_agent_module_to_agent ($id_duplicate_module,
modules_get_agentmodule_agent($id_duplicate_module),
__('copy of').' '.modules_get_agentmodule_name($id_duplicate_module));
modules_get_agentmodule_agent($id_duplicate_module),
io_safe_input(__('copy of').' '.modules_get_agentmodule_name($id_duplicate_module)));
$agent = db_get_row ('tagente', 'id_agente', $id_agente);

View File

@ -265,6 +265,7 @@ if($is_function_policies !== ENTERPRISE_NOT_HOOK) {
}
global $__code_from;
$__code_from = 'modules';
$remote_conf = false;
switch ($moduletype) {
case "dataserver":
case 1:
@ -281,7 +282,8 @@ switch ($moduletype) {
if ($config['enterprise_installed'] && $remote_conf) {
if($id_agent_module) {
enterprise_include_once('include/functions_config_agents.php');
$configuration_data = enterprise_hook('config_agents_get_module_from_conf', array($id_agente, modules_get_agentmodule_name($id_agent_module)));
$configuration_data = enterprise_hook('config_agents_get_module_from_conf',
array($id_agente, io_safe_output(modules_get_agentmodule_name($id_agent_module))));
}
enterprise_include ('godmode/agentes/module_manager_editor_data.php');
}
@ -358,10 +360,27 @@ if ($id_agent_module) {
html_print_input_hidden ('update_module', 1);
html_print_input_hidden ('id_agent_module', $id_agent_module);
html_print_input_hidden ('id_module_type', $id_module_type);
} else {
if ($config['enterprise_installed'] && $remote_conf) {
?>
<script type="text/javascript">
var check_remote_conf = true;
</script>
<?php
}
}
else {
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
html_print_input_hidden ('id_module', $moduletype);
html_print_input_hidden ('create_module', 1);
if ($config['enterprise_installed'] && $remote_conf) {
?>
<script type="text/javascript">
var check_remote_conf = true;
</script>
<?php
}
}
echo '</div>';
echo '</form>';
@ -383,6 +402,24 @@ var no_plugin_lang = "<?php echo __('No plug-in provided') ?>";
$(document).ready (function () {
configure_modules_form ();
$("#module_form").submit(function() {
if (check_remote_conf) {
//Check the name
name = $("#text-name").val();
remote_config = $("#textarea_configuration_data").val();
regexp_name = new RegExp('module_name\\s*' + name+"\n");
if (remote_config.match(regexp_name)) return true;
else {
alert("<?php echo __("Error, The field name and name in module_name in data configuration are difrerent.");?>");
return false;
}
}
return true;
});
});
/* ]]> */
</script>