Fixes to improve the oracle compatibility
This commit is contained in:
parent
9867fb6bd7
commit
25dde2c836
|
@ -1257,10 +1257,10 @@ if ($create_module) {
|
|||
// =================
|
||||
if ($delete_module) { // DELETE agent module !
|
||||
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
|
||||
$module_data = db_get_row_sql ('SELECT *
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.id_agente_modulo=' . $id_borrar_modulo);
|
||||
$module_data = db_get_row_sql ('SELECT tam.id_agente, tam.nombre
|
||||
FROM tagente_modulo tam, tagente_estado tae
|
||||
WHERE tam.id_agente_modulo = tae.id_agente_modulo
|
||||
AND tam.id_agente_modulo = ' . $id_borrar_modulo);
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
|
||||
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
|
@ -1271,7 +1271,7 @@ if ($delete_module) { // DELETE agent module !
|
|||
exit;
|
||||
}
|
||||
|
||||
if ($id_borrar_modulo < 1) {
|
||||
if (empty($module_data) || $id_borrar_modulo < 1) {
|
||||
db_pandora_audit("HACK Attempt",
|
||||
"Expected variable from form is not correct");
|
||||
require ("general/noaccess.php");
|
||||
|
|
|
@ -169,10 +169,8 @@ if ($multiple_delete) {
|
|||
// error. NOTICE that we don't delete all data here, just marking for deletion
|
||||
// and delete some simple data.
|
||||
$status = '';
|
||||
$module = db_get_row_sql ('SELECT *
|
||||
FROM tagente_modulo, tagente_estado
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.id_agente_modulo=' . (int)$id_agent_module_del);
|
||||
$agent_id_of_module = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', (int)$id_agent_module_del);
|
||||
|
||||
if (db_process_sql("UPDATE tagente_modulo
|
||||
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1
|
||||
WHERE id_agente_modulo = " . $id_agent_module_del, "affected_rows", '', true, $status, false) === false) {
|
||||
|
@ -180,10 +178,10 @@ if ($multiple_delete) {
|
|||
}
|
||||
else {
|
||||
// Set flag to update module status count
|
||||
if ($module !== false) {
|
||||
if ($agent_id_of_module !== false) {
|
||||
db_process_sql ('UPDATE tagente
|
||||
SET update_module_count = 1, update_alert_count = 1
|
||||
WHERE id_agente = ' . $module['id_agente']);
|
||||
WHERE id_agente = ' . $agent_id_of_module);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1100,10 +1100,10 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
array_push ($fields, $field.' = \''.$value.'\'');
|
||||
break;
|
||||
case "oracle":
|
||||
if (is_int ($value) ||is_float ($value)||is_double ($value))
|
||||
if (is_int ($value) || is_float ($value) || is_double ($value))
|
||||
array_push ($fields, $field.' = '.$value.'');
|
||||
else
|
||||
array_push ($fields, $field.' = "'.$value.'"');
|
||||
array_push ($fields, $field.' = \''.$value.'\'');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1119,27 +1119,7 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
$details = "nombre";
|
||||
}
|
||||
else {
|
||||
if ($config['dbtype'] == 'oracle') {
|
||||
$details_new = array();
|
||||
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 {
|
||||
if ($details == 'nombre')
|
||||
$details_new = 'dbms_lob.substr(nombre,4000,1) as nombre';
|
||||
else
|
||||
$details_new = $details;
|
||||
}
|
||||
|
||||
$details = io_safe_input ($details);
|
||||
}
|
||||
else
|
||||
$details = io_safe_input ($details);
|
||||
$details = io_safe_input ($details);
|
||||
}
|
||||
|
||||
//$where .= " AND id_policy_module = 0 ";
|
||||
|
@ -1150,30 +1130,14 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
|
||||
$where .= "\n\n" . $where_tags;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo
|
||||
WHERE
|
||||
%s
|
||||
ORDER BY nombre',
|
||||
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$where);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo
|
||||
WHERE
|
||||
%s
|
||||
ORDER BY dbms_lob.substr(nombre, 4000, 1)',
|
||||
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$where);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo
|
||||
WHERE
|
||||
%s
|
||||
ORDER BY nombre',
|
||||
($details != '*' && $indexed) ? 'id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$where);
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
|
Loading…
Reference in New Issue