Initialises a new Session instance using this cookie's params

@throws Throwable
@return string|boolean
779637
private function __init()
    {
        $this->_session = Session::start($this->_timeout, $this->_path, $this->_domain, $this->_httpOnly, $this->_secure);

        if (!$this->_session) {
            return false;
        }

        if (!isset($_SESSION[$this->_index])) {
            $_SESSION[$this->_index] = array();
        }

        // Class FrontendPage uses $_COOKIE directly (inside it's __buildPage() function), so try to emulate it.
        // @deprecated will be removed in Symphony 3.0.0
        $_COOKIE[$this->_index] = &$_SESSION[$this->_index];

        return $this->_session;
    }
368829
public function initSession()
    {
        $identity = $this->getIdentity();

        $identitySession = $identity->getSession();
        if ($identitySession) {
            $curentSessionId = $this->getSessionId();
            $identitySessionId = $identitySession->getId();
            if (empty($curentSessionId) || $curentSessionId !== $identitySessionId) {
                setcookie($this->cookieName, $identitySessionId, time() + (60 * 60 * 24 * 365 * 2), $this->cookiePath);
            }
        }
    }
813335
private function initialize()
    {
        $this->name = (isset($this->configurations['name']))
            ? $this->configurations['name']
            : self::DEFAULT_SESSION_NAME;
        $this->assignSessionLifetime();
        if (isset($this->configurations['encryption_enabled'])
            && $this->configurations['encryption_enabled']) {
            $this->handler = new EncryptedSessionHandler();
        }
        $this->security = new SecuritySession($this->configurations);
    }
100355
public static function initialize()
    {
        if (!isset($GLOBALS['_SESSION']) or !($GLOBALS['_SESSION'] instanceof self)) {
            $GLOBALS['_SESSION'] = self::getInstance();
        }

        return self::getInstance();
    }
1355213
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

        $session = $this->manager->driver();

        //
        $handler = $session->getHandler();

        return ($handler instanceof CookieSessionHandler);
    }
289598
public function initTable()
    {

        // If table not exist ,create the table
        $tableExist = $this->db->query("SHOW TABLES LIKE '{$this->table}'")->execute();

        if (!$tableExist) {
            $sql = "CREATE TABLE `$this->table` (
                            `{$this->idCol}` VARBINARY(128) NOT NULL PRIMARY KEY,
                            `{$this->dataCol}` BLOB NOT NULL,
                            `{$this->lifetimeCol}` MEDIUMINT NOT NULL,
                            `{$this->timeCol}` INTEGER UNSIGNED NOT NULL
                            ) COLLATE utf8_bin, ENGINE = InnoDB;";

            $result = $this->db->query($sql)->execute();

            $tableExist = $this->db->query("SHOW TABLES LIKE '{$this->table}'")->execute();

            // Check table creation result, if not throw error
            if (!$tableExist) {
                throw new Exception('Fail to create database session table');
            }
        }
    }
746383
public function start(): bool
    {
        if (!$this->started) {
            // check headers
            if (headers_sent($file, $line)) {
                throw new SessionException(sprintf("Cannot use '%s()', headers already sent in %s:%s",
                    __method__, $file, $line));
            }

            // start session
            $this->started = session_start();
            if (!$this->started) {
                session_write_close();
                throw new SessionException(sprintf("Session start failed in '%s()'", __method__));
            }

            // check id for last time
            if (session_id() !== $this->id) {
                session_write_close();
                throw new SessionException(sprintf("Session ID match failed in '%s()'", __method__));
            }

            // init sub-array
            if (!isset($_SESSION[$this->name])) {
                $_SESSION[$this->name] = [];
            }
        }

        return $this->started;
    }
489491
public function init()
    {
        $this->cookiesFile = tempnam(sys_get_temp_dir(), 'WikiPublish.' . uniqid('', true) . '.cookies');

        $this->curl = curl_init();
        if (false === is_resource($this->curl)) {
            throw new BuildException('Curl init failed (' . $this->apiUrl . ')');
        }

        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookiesFile);
        curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookiesFile);
    }
583940
public function init()
    {

        // init body stream
        $this->bodyStream = '';

        // init exception
        $this->exception = null;

        // init default response properties
        $this->statusCode = 200;
        $this->version = 'HTTP/1.1';
        $this->statusReasonPhrase = "OK";
        $this->mimeType = "text/plain";
        $this->state = HttpResponseStates::INITIAL;

        // initialize cookies and headers
        $this->cookies = array();
        $this->headers = array();

        // initialize the default headers
        $this->initDefaultHeaders();
    }
930487
protected function _init() {
		$mobileOverwrite = $this->Controller->getRequest()->getQuery('mobile');

		if ($mobileOverwrite !== null) {
			if ($mobileOverwrite === '-1') {
				$this->Controller->getRequest()->getSession()->delete('User.mobile');
			} else {
				$wantsMobile = (bool)$mobileOverwrite;
				$this->Controller->getRequest()->getSession()->write('User.mobile', (int)$wantsMobile);
			}
		}
		$this->isMobile();

		if (!$this->_config['auto']) {
			return;
		}
		$this->setMobile();
	}
712181
public static function init()
    {
        self::add(self::HEADER_SET_COOKIE, '__Host-sess=' . session_id() . '; path=' . Request::$subfolders . '; Secure; HttpOnly; SameSite;');
        if (Request::isSecure()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
            self::add(self::HEADER_STRICT_TRANSPORT_SECURITY, self::HEADER_STRICT_TRANSPORT_SECURITY_CONTENT);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
        } elseif (Request::isLocalhost()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
        } else {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
        }
        self::$initialized = true;
    }
612985
final public function create()
    {

        $self = $this;

        $splash = $self->getSplash();
        $sessId = $this->generateId($splash);

        session_id($sessId); //Must be called before the sesion start to generate the Id
        session_cache_limiter('none');

        session_name(md5($self->cookie . $splash['agent'] . $splash['ip'] . $splash['domain']));
        session_start();

        //Create the default namespace; affix to splash;
        //The default namespace will contain vars such as -request count, - last session start time, -last session response time, etc
        //The dfault namespace will also contain, instantiated objects?
        //
        $defaultReg = new Registry("default");
        $self->registry['default'] = $defaultReg;

        //update the cookie with the expiry time
        //Create the authenticated namespace and lock it!
        $self->set("handler", $this->authenticator, "auth");

        $this->write($sessId, $splash);
    }
923432
protected function initialiseSession()
    {
        $this->queryStartTime = time();
        $authReplyString = $this->fetchURL($this->getServiceProxyAuthURL());
        $authReply = GeneralUtility::xml2array($authReplyString);

        $success = false;
        if ($authReply) {
            $status = $authReply['status'];
            if ($status === 'OK') {
                $success = true;
            } else {
                GeneralUtility::devLog('Service Proxy init status is not "OK" but "' . $status . '"', 'pazpar2', 3);
            }
        } else {
            GeneralUtility::devLog('could not parse Service Proxy init reply', 'pazpar2', 3);
        }

        return ($this->cookie !== null) && $success;
    }
926472
public static function init()
	{
		if(!self::$isInited)
		{
			self::name(Config::get('@.SESSION_NAME', null));
			self::savePath(Config::get('@.SESSION_SAVEPATH', null));
			self::useCookies(Config::get('@.SESSION_USE_COOKIES', null));
			self::cacheExpire(Config::get('@.SESSION_CACHE_EXPIRE', null));
			self::cacheLimiter(Config::get('@.SESSION_CACHE_LIMITER', null));
			self::gcProbability(Config::get('@.SESSION_GC_PROBABILITY', null));
			self::maxLifetime(Config::get('@.SESSION_MAX_LIFETIME', null));
			self::prefix(Config::get('@.SESSION_PREFIX', ''));
			self::cookieDomain(Config::get('@.SESSION_COOKIE_DOMAIN',null));
			$saveHandler = Config::get('@.SESSION_SAVE_HANDLER', 'files');
			self::saveHandler($saveHandler);
			if('user' === $saveHandler)
			{
				self::userSaveHandler(Config::get('@.SESSION_USER_SAVE_HANDLER'));
			}
			self::$isInited = true;
			if(null !== self::$sessionID)
			{
				session_id(self::$sessionID);
			}
			session_start();
			session_write_close();
			return true;
		}
		else
		{
			return false;
		}
	}
241928
public function initialize()
    {
        if ($this->initialized === true) {
            return;
        }
        if ($this->canBeInitialized() === false) {
            throw new Exception('The security Context cannot be initialized yet. Please check if it can be initialized with $securityContext->canBeInitialized() before trying to do so.', 1358513802);
        }

        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $factoryTokens = $this->tokenAndProviderFactory->getTokens();
        $tokens = $this->mergeTokens($factoryTokens, $sessionDataContainer->getSecurityTokens());
        $this->separateActiveAndInactiveTokens($tokens);
        $this->updateTokens($this->activeTokens);

        $this->initialized = true;
    }
885020
protected function _allowSessionStart()
    {
        $blAllowSessionStart = true;
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        // special handling only in non-admin mode
        if (!$this->isAdmin()) {
            if (\OxidEsales\Eshop\Core\Registry::getUtils()->isSearchEngine() || $myConfig->getRequestParameter('skipSession')) {
                $blAllowSessionStart = false;
            } elseif (\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('oxid_' . $myConfig->getShopId() . '_autologin') === '1') {
                $blAllowSessionStart = true;
            } elseif (!$this->_forceSessionStart() && !\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('sid_key')) {
                // session is not needed to start when it is not necessary:
                // - no sid in request and also user executes no session connected action
                // - no cookie set and user executes no session connected action
                if (!\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie($this->getName()) &&
                    !($myConfig->getRequestParameter($this->getName()) || $myConfig->getRequestParameter($this->getForcedName())) &&
                    !$this->_isSessionRequiredAction()
                ) {
                    $blAllowSessionStart = false;
                }
            }
        }

        return $blAllowSessionStart;
    }
980911
public function init()
    {
        $request =& $this->request;
        $route = '/:controller/:action';
        $opts = array('controller' => 'Home', 'action' => 'index');

        // Inlined as a closure to fix "using $this when not in object context" on 5.3
        $validateSession = function () {
            if (!empty($_SESSION['phpci_user_id'])) {
                $user = b8\Store\Factory::getStore('User')->getByPrimaryKey($_SESSION['phpci_user_id']);

                if ($user) {
                    $_SESSION['phpci_user'] = $user;
                    return true;
                }

                unset($_SESSION['phpci_user_id']);
            }

            return false;
        };

        $skipAuth = array($this, 'shouldSkipAuth');

        // Handler for the route we're about to register, checks for a valid session where necessary:
        $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) {
            $skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status'));

            if (!$skipValidation && !$validateSession() && (!is_callable($skipAuth) || !$skipAuth())) {
                if ($request->isAjax()) {
                    $response->setResponseCode(401);
                    $response->setContent('');
                } else {
                    $_SESSION['phpci_login_redirect'] = substr($request->getPath(), 1);
                    $response = new RedirectResponse($response);
                    $response->setHeader('Location', PHPCI_URL.'session/login');
                }

                return false;
            }

            return true;
        };

        $this->router->clearRoutes();
        $this->router->register($route, $opts, $routeHandler);
    }