2011-02-28 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_db.php: cleaned source code, and erased the deprecated
	function "dame_id_grupo".
	
	*extensions/update_manager.php, operation/agentes/export_csv.php,
	godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php,
	godmode/agentes/configurar_agente.php: replaced obsolete "dame_id_grupo" to
	"get_agent_group".



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4027 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-02-28 16:49:44 +00:00
parent 9b0eaa62c4
commit 98645e4f69
7 changed files with 33 additions and 29 deletions

View File

@ -1,3 +1,12 @@
2011-02-28 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_db.php: cleaned source code, and erased the deprecated
function "dame_id_grupo".
*extensions/update_manager.php, operation/agentes/export_csv.php,
godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php: replaced obsolete "dame_id_grupo" to
"get_agent_group".
2011-02-28 Miguel de Dios <miguel.dedios@artica.es> 2011-02-28 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager.php: replaced obsolete "give_acl" to "check_acl" * extensions/update_manager.php: replaced obsolete "give_acl" to "check_acl"
and erased the "give_acl". and erased the "give_acl".

View File

@ -69,7 +69,7 @@ function pandora_update_manager_main () {
global $config; global $config;
global $db; global $db;
if (! give_acl ($config['id_user'], 0, "PM")) { if (! check_acl($config['id_user'], 0, "PM")) {
require ("general/noaccess.php"); require ("general/noaccess.php");
return; return;
} }
@ -124,7 +124,7 @@ function pandora_update_manager_godmode () {
} }
if(isset($config['id_user'])) { if(isset($config['id_user'])) {
if (give_acl ($config['id_user'], 0, "PM")) { if (check_acl($config['id_user'], 0, "PM")) {
add_operation_menu_option (__('Update manager')); add_operation_menu_option (__('Update manager'));
add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup'); add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup');
add_extension_main_function ('pandora_update_manager_main'); add_extension_main_function ('pandora_update_manager_main');

View File

@ -750,7 +750,7 @@ if ($create_module) {
if ($delete_module) { // DELETE agent module ! if ($delete_module) { // DELETE agent module !
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0); $id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
$module_data = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo); $module_data = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo);
$id_grupo = (int) dame_id_grupo ($id_agente); $id_grupo = (int) get_agent_group($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) { if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
pandora_audit("ACL Violation", pandora_audit("ACL Violation",

View File

@ -45,7 +45,7 @@ $agent_to_delete = (int)get_parameter('borrar_agente');
if (!empty($agent_to_delete)) { if (!empty($agent_to_delete)) {
$id_agente = $agent_to_delete; $id_agente = $agent_to_delete;
$agent_name = get_agent_name ($id_agente); $agent_name = get_agent_name ($id_agente);
$id_grupo = dame_id_grupo ($id_agente); $id_grupo = get_agent_group($id_agente);
if (check_acl ($config["id_user"], $id_grupo, "AW")==1) { if (check_acl ($config["id_user"], $id_grupo, "AW")==1) {
$id_agentes[0] = $id_agente; $id_agentes[0] = $id_agente;
delete_agent($id_agentes); delete_agent($id_agentes);

View File

@ -81,7 +81,7 @@ if ($multiple_delete) {
$id_agent_modules_delete = (array)get_parameter('id_delete'); $id_agent_modules_delete = (array)get_parameter('id_delete');
foreach($id_agent_modules_delete as $id_agent_module_del) { foreach($id_agent_modules_delete as $id_agent_module_del) {
$id_grupo = (int) dame_id_grupo ($id_agente); $id_grupo = (int) get_agent_group($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) { if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
pandora_audit("ACL Violation", pandora_audit("ACL Violation",

View File

@ -71,7 +71,7 @@ function check_login () {
} }
if ((isset($_SESSION["id_usuario"])) AND ($_SESSION["id_usuario"] != "")) { if ((isset($_SESSION["id_usuario"])) AND ($_SESSION["id_usuario"] != "")) {
if (is_user($_SESSION["id_usuario"])) { if (is_user ($_SESSION["id_usuario"])) {
return 0; return 0;
} }
} }
@ -314,7 +314,8 @@ function safe_acl_group ($id_user, $id_groups, $access) {
if ($id_groups == 0) if ($id_groups == 0)
return array_keys (get_user_groups ($id_user, $access)); return array_keys (get_user_groups ($id_user, $access));
return array ($id_groups); return array ($id_groups);
} elseif (!is_array ($id_groups)) { }
elseif (!is_array ($id_groups)) {
return array (); return array ();
} }
@ -340,7 +341,7 @@ function safe_acl_group ($id_user, $id_groups, $access) {
* *
* @return int Return the id of row in tsesion or false in case of fail. * @return int Return the id of row in tsesion or false in case of fail.
*/ */
function pandora_audit ($accion, $descripcion, $user_id = false, $ip = false, $info = '') { function pandora_audit($accion, $descripcion, $user_id = false, $ip = false, $info = '') {
global $config; global $config;
if ($ip !== false) { if ($ip !== false) {
@ -894,15 +895,15 @@ function get_agent_name ($id_agent, $case = "none") {
// Version 3.0 has enforced case sensitive agent names // Version 3.0 has enforced case sensitive agent names
// so we always should show real case names. // so we always should show real case names.
switch ($case) { switch ($case) {
case "upper": case "upper":
return mb_strtoupper ($agent,"UTF-8"); return mb_strtoupper ($agent,"UTF-8");
break; break;
case "lower": case "lower":
return mb_strtolower ($agent,"UTF-8"); return mb_strtolower ($agent,"UTF-8");
break; break;
case "none": case "none":
default: default:
return ($agent); return ($agent);
} }
} }
@ -1343,7 +1344,7 @@ function get_alerts_fired ($alerts, $period = 0, $date = 0) {
$agents = array (); $agents = array ();
foreach ($alerts as $alert) { foreach ($alerts as $alert) {
if (isset($alert['id'])){ if (isset($alert['id'])) {
$fires = get_alert_fires_in_period ($alert['id'], $period, $date); $fires = get_alert_fires_in_period ($alert['id'], $period, $date);
if (! $fires) { if (! $fires) {
continue; continue;
@ -1426,7 +1427,8 @@ function get_moduletypes ($type = "all", $rows = "nombre") {
$row_cnt = count ($rows); $row_cnt = count ($rows);
if ($type == "remote") { if ($type == "remote") {
return array_merge (range (6,18), (array) 100); return array_merge (range (6,18), (array) 100);
} elseif ($type == "agent") { }
elseif ($type == "agent") {
return array_merge (range (1,4), range (19,24)); return array_merge (range (1,4), range (19,24));
} }
@ -1439,7 +1441,8 @@ function get_moduletypes ($type = "all", $rows = "nombre") {
foreach ($result as $type) { foreach ($result as $type) {
if ($row_cnt > 1) { if ($row_cnt > 1) {
$return[$type["id_tipo"]] = $type; $return[$type["id_tipo"]] = $type;
} else { }
else {
$return[$type["id_tipo"]] = $type[reset ($rows)]; $return[$type["id_tipo"]] = $type[reset ($rows)];
} }
} }
@ -1447,14 +1450,6 @@ function get_moduletypes ($type = "all", $rows = "nombre") {
} }
/**
* @deprecated Use get_agent_group ($id) now (fully compatible)
*/
function dame_id_grupo ($id_agent) {
return get_agent_group ($id_agent);
}
/** /**
* Get the number of pandora data packets in the database. * Get the number of pandora data packets in the database.
* *

View File

@ -29,7 +29,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
$id_agentmodule = $_GET["agentmodule"]; $id_agentmodule = $_GET["agentmodule"];
$id_agent = $_GET["agent"]; $id_agent = $_GET["agent"];
$agentmodule_name = get_agentmodule_name ($id_agentmodule); $agentmodule_name = get_agentmodule_name ($id_agentmodule);
if (! check_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR")) { if (! check_acl ($config['id_user'], get_agent_group($id_agent), "AR")) {
pandora_audit("ACL Violation", pandora_audit("ACL Violation",
"Trying to access Agent Export Data"); "Trying to access Agent Export Data");
require ("../../general/noaccess.php"); require ("../../general/noaccess.php");