mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2009-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_modules.php: fix bug that the function copy_agent_module_to_agent didn't copy the modules what was previus delete. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1803 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b8c2ef89d4
commit
fb10e76c49
@ -1,3 +1,9 @@
|
|||||||
|
2009-07-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_modules.php: fix bug that the function
|
||||||
|
copy_agent_module_to_agent didn't copy the modules what was previus
|
||||||
|
delete.
|
||||||
|
|
||||||
2009-07-16 Jorge Gonzalez <jorgegonz@artica.es>
|
2009-07-16 Jorge Gonzalez <jorgegonz@artica.es>
|
||||||
|
|
||||||
* godmode/servers/manage_recontask_form.php: Changed sql query to
|
* godmode/servers/manage_recontask_form.php: Changed sql query to
|
||||||
|
@ -31,11 +31,42 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$modules = get_agent_modules ($id_destiny_agent, false,
|
$modules = get_agent_modules ($id_destiny_agent, false,
|
||||||
array ('nombre' => $module['nombre']));
|
array ('nombre' => $module['nombre'], 'disabled' => false));
|
||||||
|
|
||||||
if (! empty ($modules))
|
if (! empty ($modules))
|
||||||
return array_pop (array_keys ($modules));
|
return array_pop (array_keys ($modules));
|
||||||
|
|
||||||
|
$modulesDisabled = get_agent_modules ($id_destiny_agent, false,
|
||||||
|
array ('nombre' => $module['nombre'], 'disabled' => true));
|
||||||
|
|
||||||
|
if (!empty($modulesDisabled)) {
|
||||||
|
//the foreach have only one loop but extract the array index, and it's id_agente_modulo
|
||||||
|
foreach ($modulesDisabled as $id => $garbage) {
|
||||||
|
$id_module = $id;
|
||||||
|
process_sql_update('tagente_modulo', array('disabled' => false, 'delete_pending' => false),
|
||||||
|
array('id_agente_modulo' => $id_module, 'disabled' => true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array ();
|
||||||
|
$values['id_agente_modulo'] = $id_module;
|
||||||
|
|
||||||
|
/* PHP copy arrays on assignment */
|
||||||
|
$new_module = $module;
|
||||||
|
|
||||||
|
/* Rewrite different values */
|
||||||
|
$new_module['id_agente'] = $id_destiny_agent;
|
||||||
|
$new_module['ip_target'] = get_agent_address ($id_destiny_agent);
|
||||||
|
|
||||||
|
/* Unset numeric indexes or SQL would fail */
|
||||||
|
$len = count ($new_module) / 2;
|
||||||
|
for ($i = 0; $i < $len; $i++)
|
||||||
|
unset ($new_module[$i]);
|
||||||
|
/* Unset original agent module id */
|
||||||
|
unset ($new_module['id_agente_modulo']);
|
||||||
|
|
||||||
|
$id_new_module = $id_module;
|
||||||
|
}
|
||||||
|
else {
|
||||||
/* PHP copy arrays on assignment */
|
/* PHP copy arrays on assignment */
|
||||||
$new_module = $module;
|
$new_module = $module;
|
||||||
|
|
||||||
@ -57,9 +88,11 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent) {
|
|||||||
|
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values['id_agente_modulo'] = $id_new_module;
|
$values['id_agente_modulo'] = $id_new_module;
|
||||||
|
}
|
||||||
|
|
||||||
$values['id_agente'] = $id_destiny_agent;
|
$values['id_agente'] = $id_destiny_agent;
|
||||||
|
|
||||||
if (! in_array ($new_module['id_tipo_modulo'], array (2, 6, 9, 18, 21, 100)))
|
if (! in_array ($new_module['id_tipo_modulo'], array (2, 6, 9, 18, 21, 100))) //TODO delete magic numbers
|
||||||
/* Not proc modules uses a special estado (status) value */
|
/* Not proc modules uses a special estado (status) value */
|
||||||
$values['estado'] = 100;
|
$values['estado'] = 100;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user