mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
disallow editing module type
This commit is contained in:
parent
f8e2cbd7e0
commit
85794418e2
@ -1499,6 +1499,7 @@ if ($update_module === true || $create_module === true) {
|
|||||||
$old_configuration_data = (string) get_parameter('old_configuration_data');
|
$old_configuration_data = (string) get_parameter('old_configuration_data');
|
||||||
$new_configuration_data = '';
|
$new_configuration_data = '';
|
||||||
|
|
||||||
|
|
||||||
$custom_string_1_default = '';
|
$custom_string_1_default = '';
|
||||||
$custom_string_2_default = '';
|
$custom_string_2_default = '';
|
||||||
$custom_string_3_default = '';
|
$custom_string_3_default = '';
|
||||||
@ -1964,6 +1965,19 @@ if ($update_module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$def_msg = __('There was a problem updating module. Processing error');
|
||||||
|
|
||||||
|
if (preg_match('/module_type\s+([^\\n]+)/', io_safe_output($configuration_data), $matches)) {
|
||||||
|
$config_module_type = $matches[1];
|
||||||
|
|
||||||
|
$type_id = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', $config_module_type);
|
||||||
|
|
||||||
|
if ($type_id !== $id_module_type) {
|
||||||
|
$def_msg = __('There was a problem updating module: module type cannot be edited');
|
||||||
|
$result = ERR_GENERIC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_error($result) === true) {
|
if (is_error($result) === true) {
|
||||||
switch ($result) {
|
switch ($result) {
|
||||||
case ERR_EXIST:
|
case ERR_EXIST:
|
||||||
@ -1981,7 +1995,7 @@ if ($update_module) {
|
|||||||
case ERR_DB:
|
case ERR_DB:
|
||||||
case ERR_GENERIC:
|
case ERR_GENERIC:
|
||||||
default:
|
default:
|
||||||
$msg = __('There was a problem updating module. Processing error');
|
$msg = $def_msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,12 +657,7 @@ sub process_xml_data ($$$$$) {
|
|||||||
# Unnamed module
|
# Unnamed module
|
||||||
next if ($module_name eq '');
|
next if ($module_name eq '');
|
||||||
|
|
||||||
# Read module type from db when module exists within it (skip XML read).
|
my $module_type = get_tag_value ($module_data, 'type', 'generic_data');
|
||||||
my $module_type = get_db_value ($dbh, 'SELECT ttm.nombre FROM ttipo_modulo ttm INNER JOIN tagente_modulo tam ON tam.id_tipo_modulo = ttm.id_tipo WHERE tam.id_agente = ' . $agent_id . ' AND tam.nombre' . ' = '. $RDBMS_QUOTE_STRING . safe_input($module_name) . $RDBMS_QUOTE_STRING);
|
|
||||||
|
|
||||||
if (!defined($module_type)) {
|
|
||||||
$module_type = get_tag_value ($module_data, 'type', 'generic_data');
|
|
||||||
}
|
|
||||||
|
|
||||||
# Apply timezone offset to module if timestamp is set.
|
# Apply timezone offset to module if timestamp is set.
|
||||||
if (defined($module_data->{'timestamp'} && $module_data->{'timestamp'} ne '')) {
|
if (defined($module_data->{'timestamp'} && $module_data->{'timestamp'} ne '')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user