API::retrieveSession PHP Method

retrieveSession() protected method

Retrieve GLPI Session initialised by initSession function Use 'session_token' param in $this->parameters
protected retrieveSession ( )
    protected function retrieveSession()
    {
        if (isset($this->parameters['session_token']) && !empty($this->parameters['session_token'])) {
            $current = session_id();
            $session = trim($this->parameters['session_token']);
            if (file_exists(GLPI_ROOT . "/config/config_path.php")) {
                include_once GLPI_ROOT . "/config/config_path.php";
            }
            if (!defined("GLPI_SESSION_DIR")) {
                define("GLPI_SESSION_DIR", GLPI_ROOT . "/files/_sessions");
            }
            if ($session != $current && !empty($current)) {
                session_destroy();
            }
            if ($session != $current && !empty($session)) {
                if (ini_get("session.save_handler") == "files") {
                    session_save_path(GLPI_SESSION_DIR);
                }
                session_id($session);
                session_start();
                // Define current time for sync of action timing
                $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
                $_SESSION['glpi_use_mode'] = Session::NORMAL_MODE;
            }
        }
    }