mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2012-02-10 Miguel de Dios <miguel.dedios@artica.es>
* * extensions/module_groups.php, include/functions_modules.php, godmode/agentes/module_manager_editor_prediction.php: cleaned source code style. * godmode/agentes/configurar_agente.php: cleaned source code style and fixed the duplication of module. * include/functions_agents.php: fixed the get modules into function "agents_get_modules", before the function return ever the policy modules without apply filter. Fixes: #3482260 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5554 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4df70f23d7
commit
0a9f2ccda4
@ -1,3 +1,18 @@
|
||||
2012-02-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* * extensions/module_groups.php, include/functions_modules.php,
|
||||
godmode/agentes/module_manager_editor_prediction.php: cleaned
|
||||
source code style.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: cleaned source code style and fixed
|
||||
the duplication of module.
|
||||
|
||||
* include/functions_agents.php: fixed the get modules into function
|
||||
"agents_get_modules", before the function return ever the policy modules
|
||||
without apply filter.
|
||||
|
||||
Fixes: #3482260
|
||||
|
||||
2012-02-10 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* include/functions_groups.php: Added links to different sections with
|
||||
|
@ -191,7 +191,6 @@ function mainModuleGroups() {
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($states as $idState => $state) {
|
||||
$count += $state;
|
||||
}
|
||||
|
@ -608,7 +608,8 @@ if ($id_agente) {
|
||||
$update_module = (bool) get_parameter ('update_module');
|
||||
$create_module = (bool) get_parameter ('create_module');
|
||||
$delete_module = (bool) get_parameter ('delete_module');
|
||||
$duplicate_module = (bool) get_parameter ('duplicate_module');
|
||||
//It is the id_agent_module to duplicate
|
||||
$duplicate_module = (int) get_parameter ('duplicate_module');
|
||||
$edit_module = (bool) get_parameter ('edit_module');
|
||||
|
||||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||
@ -996,11 +997,26 @@ if ($delete_module) { // DELETE agent module !
|
||||
|
||||
// MODULE DUPLICATION
|
||||
// =================
|
||||
if ($duplicate_module) { // DUPLICATE agent module !
|
||||
$id_duplicate_module = (int) get_parameter_get ("duplicate_module",0);
|
||||
if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||
$id_duplicate_module = $duplicate_module;
|
||||
|
||||
$original_name = modules_get_agentmodule_name($id_duplicate_module);
|
||||
$copy_name = __('copy of') . ' ' . $original_name;
|
||||
|
||||
$cont = 0;
|
||||
$exists = true;
|
||||
while($exists) {
|
||||
$exists = (bool)db_get_value ('id_agente_modulo', 'tagente_modulo',
|
||||
'nombre', $copy_name);
|
||||
if ($exists) {
|
||||
$cont++;
|
||||
$copy_name = __('copy of') . ' ' . $original_name
|
||||
. ' (' . $cont . ')';
|
||||
}
|
||||
}
|
||||
|
||||
$result = modules_copy_agent_module_to_agent ($id_duplicate_module,
|
||||
modules_get_agentmodule_agent($id_duplicate_module),
|
||||
io_safe_input(__('copy of').' '.modules_get_agentmodule_name($id_duplicate_module)));
|
||||
modules_get_agentmodule_agent($id_duplicate_module), $copy_name);
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
|
||||
|
@ -969,7 +969,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
||||
|
||||
enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
if ($extra_access && $all_groups){ //if you have all group, search extra policies.
|
||||
if ($extra_access && $all_groups) { //if you have all group, search extra policies.
|
||||
$extra_sql = enterprise_hook('policies_get_agents_sql_condition');
|
||||
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
|
||||
$extra_sql = '';
|
||||
@ -1070,13 +1070,15 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||
$id_agent = safe_int ($id_agent, 1);
|
||||
}
|
||||
|
||||
$extra_sql = '';
|
||||
$policy_sql = '';
|
||||
if ($id_agent != 0){
|
||||
$extra_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent, '', false));
|
||||
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
|
||||
$extra_sql = '';
|
||||
}else if ($extra_sql != '') {
|
||||
$extra_sql .= ' OR ';
|
||||
$extra_policy_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent));
|
||||
if ($policy_sql === ENTERPRISE_NOT_HOOK) {
|
||||
$policy_sql = '';
|
||||
}
|
||||
else if ($policy_sql != '') {
|
||||
//It is AND instead OR, because It is necesary apply the filter.
|
||||
$policy_sql = ' OR ' . $policy_sql;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1111,6 +1113,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||
FROM tperfil WHERE agent_view = 1
|
||||
)
|
||||
)
|
||||
" . $policy_sql . "
|
||||
)";
|
||||
|
||||
if (! empty ($id_agent)) {
|
||||
@ -1199,15 +1202,15 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||
else {
|
||||
if ($config['dbtype'] == 'oracle'){
|
||||
$details_new = array();
|
||||
if (is_array($details)){
|
||||
foreach ($details as $detail){
|
||||
if (is_array($details)) {
|
||||
foreach ($details as $detail) {
|
||||
if ($detail == 'nombre')
|
||||
$details_new[] = 'dbms_lob.substr(nombre,4000,1) as nombre';
|
||||
else
|
||||
$details_new[] = $detail;
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
if ($details == 'nombre')
|
||||
$details_new = 'dbms_lob.substr(nombre,4000,1) as nombre';
|
||||
else
|
||||
@ -1227,21 +1230,19 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo WHERE
|
||||
%s (%s)
|
||||
%s
|
||||
ORDER BY nombre',
|
||||
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$extra_sql,
|
||||
$where);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo WHERE
|
||||
%s (%s)
|
||||
%s
|
||||
ORDER BY dbms_lob.substr(nombre, 4000, 1)',
|
||||
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$extra_sql,
|
||||
$where);
|
||||
break;
|
||||
}
|
||||
@ -1261,7 +1262,8 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||
if (is_array ($details) || $details == '*') {
|
||||
//Just stack the information in array by ID
|
||||
$modules[$module['id_agente_modulo']] = $module;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$modules[$module['id_agente_modulo']] = $module[$details];
|
||||
}
|
||||
}
|
||||
|
@ -108,10 +108,12 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$id_new_module = db_process_sql_insert ('tagente_modulo', $new_module);
|
||||
$id_new_module = db_process_sql_insert ('tagente_modulo',
|
||||
$new_module);
|
||||
break;
|
||||
case "oracle":
|
||||
$id_new_module = db_process_sql_insert ('tagente_modulo', $new_module, false);
|
||||
$id_new_module = db_process_sql_insert ('tagente_modulo',
|
||||
$new_module, false);
|
||||
break;
|
||||
}
|
||||
if ($id_new_module === false) {
|
||||
@ -589,7 +591,8 @@ function modules_get_type_icon ($id_type) {
|
||||
* @return int The id of the agent of given agent module
|
||||
*/
|
||||
function modules_get_agentmodule_agent ($id_agentmodule) {
|
||||
return (int) db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||
return (int) db_get_value ('id_agente', 'tagente_modulo',
|
||||
'id_agente_modulo', (int) $id_agentmodule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user