From a3aa84bf92a0df69538231b9c2ea01e0096e1120 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 21 Nov 2018 15:16:52 +0100 Subject: [PATCH] fixed errors in session with send mail alerts graph API --- pandora_console/general/footer.php | 4 +--- pandora_console/godmode/alerts/alert_actions.php | 1 + pandora_console/include/api.php | 11 +++++------ pandora_console/include/config_process.php | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 33c8493e26..48c0424c62 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -32,9 +32,7 @@ if (!$config["MR"]) { echo ''; -if(enterprise_installed()){ - enterprise_include_once("../include/functions_update_manager.php"); -} +include_once ($config["homedir"]."/include/functions_update_manager.php"); $current_package = update_manager_get_current_package(); diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 2c2357541d..a1ae9afca5 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -215,6 +215,7 @@ if ($delete_action) { __('Could not be deleted')); } +$table = new stdClass(); $table->width = '100%'; $table->class = 'databox data'; $table->data = array (); diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php index bbc79ef702..6d5a5abcc8 100644 --- a/pandora_console/include/api.php +++ b/pandora_console/include/api.php @@ -72,10 +72,14 @@ switch($info) { if (isInACL($ipOrigin)) { if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) { $user_in_db = process_user_login($user, $password, true); - if ($user_in_db !== false) { $config['id_user'] = $user_in_db; $correctLogin = true; + + if (session_status() === PHP_SESSION_NONE) session_start(); + $_SESSION["id_usuario"] = $user; + session_write_close(); + } else { $no_login_msg = "Incorrect user credentials"; @@ -178,11 +182,6 @@ if ($correctLogin) { returnError('no_exist_operation', $returnType); } } - - //XXXXX - if (file_exists(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id())) { - unlink(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id()); - } } else { // TODO: Implement a new switch in config to enable / disable diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4e731f6b5d..820e090318 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -176,7 +176,7 @@ date_default_timezone_set("Europe/Madrid"); ////////////////////////////////////// require_once ($config["homedir"].'/include/load_session.php'); -if (session_id() == '') session_start(); +if (session_status() === PHP_SESSION_NONE) session_start(); config_process_config(); config_prepare_session();