***************
Some More Generalized Session Processes
***************
167431
protected function loadSessInfo($coreTbl)
    {
        if (!isset($this->v["currPage"])) {
            $this->survLoopInit($GLOBALS["SL"]->REQ); // not sure why this
        }
        if (isset($GLOBALS["SL"]->formTree->TreeID)) {
            return false;
        }
        // If we're loading a Page that doesn't even have a Core Table, then we skip all the session checks...
        if ((!isset($GLOBALS["SL"]->treeRow->TreeCoreTable) || intVal($GLOBALS["SL"]->treeRow->TreeCoreTable) <= 0)
            && isset($GLOBALS["SL"]->treeRow->TreeType) && $GLOBALS["SL"]->treeRow->TreeType == 'Page') {
            $this->sessInfo = new SLSess;
            $this->sessID = $this->coreID = -3;
            $GLOBALS["SL"]->setClosestLoop();
            return false;
        }
        $cid = (($GLOBALS["SL"]->REQ->has('cid') && intVal($GLOBALS["SL"]->REQ->get('cid')) > 0) 
            ? intVal($GLOBALS["SL"]->REQ->get('cid')) : 0);
        if ($GLOBALS["SL"]->REQ->has('core') && intVal($GLOBALS["SL"]->REQ->get('core')) > 0) {
            $this->sessInfo = SLSess::where('SessUserID', $this->v["uID"])
                ->where('SessTree', $GLOBALS["SL"]->sessTree) //$this->treeID)
                ->where('SessCoreID', '=', intVal($GLOBALS["SL"]->REQ->get('core')))
                ->orderBy('updated_at', 'desc')
                ->first();
            if ($this->sessInfo && isset($this->sessInfo->SessID)) {
                $this->sessID = $this->sessInfo->SessID;
                $this->coreID = $this->sessInfo->SessCoreID;
            }
        } elseif ($cid <= 0 && $GLOBALS["SL"]->REQ->has('start') && $GLOBALS["SL"]->REQ->has('new')
            && !session()->has('t' . $GLOBALS["SL"]->treeID . 'new' . $GLOBALS["SL"]->REQ->get('new'))) {
            $this->createNewSess();
            $this->newCoreRow($coreTbl);
            session()->put('t' . $GLOBALS["SL"]->treeID . 'new' . $GLOBALS["SL"]->REQ->get('new'), time());
        } elseif (isset($this->v) && $this->v["uID"] > 0) {
            //$recentSessTime = mktime(date('H')-2, date('i'), date('s'), date('m'), date('d'), date('Y'));
            $this->sessInfo = SLSess::where('SessUserID', $this->v["uID"])
                ->where('SessTree', $GLOBALS["SL"]->sessTree) //$this->treeID)
                ->where('SessCoreID', (($cid > 0) ? '=' : '>'), (($cid > 0) ? $cid : 0))
                ->where('SessIsActive', 1)
                //->where('updated_at', '>', date('Y-m-d H:i:s', $recentSessTime))
                ->orderBy('updated_at', 'desc')
                ->first();
            if ($this->sessInfo && isset($this->sessInfo->SessID)) {
                if ($this->isAdminUser() && $cid > 0 && $cid != $this->sessInfo->SessCoreID) {
                    $this->sessInfo = new SLSess;
                    $this->sessInfo->SessUserID   = $this->v["uID"];
                    $this->sessInfo->SessTree     = $GLOBALS["SL"]->sessTree;
                    $this->sessInfo->SessCoreID   = $this->coreID = $cid;
                    $this->sessInfo->SessIsActive = 1;
                    $this->sessInfo->save();
                    $this->sessID = $this->sessInfo->SessID;
                } elseif ($this->isAdminUser() || $this->recordIsEditable($coreTbl, $this->sessInfo->SessCoreID)) {
                    $this->sessID = $this->sessInfo->SessID;
                    $this->coreID = $this->sessInfo->SessCoreID;
                } else {
                    $this->sessInfo = [];
                }
            }
        } else {
            $this->chkTreeSess($GLOBALS["SL"]->sessTree);
        }
        // Check for and load core record's ID
        if ($this->coreID <= 0 && $this->sessInfo && isset($this->sessInfo->SessCoreID) 
            && intVal($this->sessInfo->SessCoreID) > 0) {
            $this->coreID = $this->sessInfo->SessCoreID;
        }
        $this->chkIfCoreIsEditable($this->coreID);
        if ($this->coreID <= 0 && $this->v["uID"] > 0) {
            $pastUserSess = SLSess::where('SessUserID', $this->v["uID"])
                ->where('SessTree', $this->treeID)
                ->where('SessCoreID', '>', '0')
                ->orderBy('updated_at', 'desc')
                ->get();
            if ($pastUserSess->isNotEmpty()) {
                foreach ($pastUserSess as $pastSess) {
                    $this->chkIfCoreIsEditable($pastSess->SessCoreID);
                }
            }
        }
        if ($this->coreIDoverride > 0) {
            // should there be more permission checks here?..
            $this->coreID = $this->coreIDoverride;
        //} elseif ($this->coreID <= 0) { $this->newCoreRow($coreTbl);
        }
        if ($this->coreID > 0) {
            if (!$this->sessInfo) {
                $this->createNewSess();
            }
            $this->setSessCore($this->coreID);
            if ((!isset($this->sessInfo->SessUserID) || intVal($this->sessInfo->SessUserID) <= 0)
                && $this->v["uID"] > 0) {
                $this->sessInfo->SessUserID = $this->v["uID"];
                $this->logAdd('session-stuff', 'Assigning Sess#' . $this->sessID . ' to U#' . $this->v["uID"] 
                    . ' <i>(loadSessInfo)</i>');
            }
            $chkNode = false;
            if (isset($this->sessInfo->SessCurrNode)) {
                $chkNode = SLNode::where('NodeTree', $this->treeID)
                    ->where('NodeID', $this->sessInfo->SessCurrNode)
                    ->first();
            }
            if (!$chkNode) {
                $this->sessInfo->SessCurrNode = 0;
                $nodeSaves = DB::table('SL_NodeSavesPage')
                    ->join('SL_Node', 'SL_Node.NodeID', '=', 'SL_NodeSavesPage.PageSaveNode')
                    ->where('SL_NodeSavesPage.PageSaveSession', $this->coreID)
                    ->where('SL_Node.NodeTree', $this->treeID)
                    ->select('SL_NodeSavesPage.*')
                    ->orderBy('updated_at', 'desc')
                    ->get();
                if ($nodeSaves->isNotEmpty()) {
                    foreach ($nodeSaves as $i => $s) {
                        if ($this->sessInfo->SessCurrNode <= 0 && isset($s->PageSaveNode) 
                            && isset($this->allNodes[$s->PageSaveNode])) {
                            $this->sessInfo->SessCurrNode = $s->PageSaveNode;
                        }
                    }
                }
                if ($this->sessInfo->SessCurrNode <= 0 && isset($GLOBALS["SL"]->treeRow->TreeRoot)) {
                    $this->sessInfo->SessCurrNode = $GLOBALS["SL"]->treeRow->TreeRoot;
                }
            }
            $this->sessInfo->save();
            session()->put('lastTree', $GLOBALS["SL"]->sessTree);
            session()->put('lastTreeTime', time());
            $this->chkIfCoreIsEditable();
            $this->updateCurrNode($this->sessInfo->SessCurrNode);
            
            $GLOBALS["SL"]->loadSessLoops($this->sessID);
            
            // Initialize currNode
            if ($coreTbl != '' && isset($GLOBALS["SL"]->tblAbbr[$coreTbl])) {
                $subFld = $GLOBALS["SL"]->tblAbbr[$coreTbl] . 'SubmissionProgress';
                if (isset($this->sessData->dataSets[$coreTbl]) 
                    && isset($this->sessData->dataSets[$coreTbl][0])
                    && isset($this->sessData->dataSets[$coreTbl][0]->{ $subFld })
                    && intVal($this->sessData->dataSets[$coreTbl][0]->{ $subFld }) > 0) {
                    $this->updateCurrNode($this->sessData->dataSets[$coreTbl][0]->{ $subFld });
                } elseif (isset($this->sessInfo->SessCurrNode) && intVal($this->sessInfo->SessCurrNode) > 0) {
                    $this->updateCurrNode($this->sessInfo->SessCurrNode);
                } else {
                    $this->updateCurrNode($this->rootID);
                }
            }
        } // end $this->coreID > 0
        return true;
    }
993607
private function setSession()
    {
        if (isset($_SESSION)) {
            foreach ($_SESSION as $k => $v) {
                $this->log->debug("[ SESSION Params ]" . $k . ": " . $v, []);
                $this->session->$k = $this->setSecurityLevel($v);
                $this->parameters["session"][$k] = $this->setSecurityLevel($v);
            }
        }
    }
771738
private function sessionStart()
    {
        if (session_status() !== PHP_SESSION_ACTIVE) {
            $request = new Request;
            session_set_cookie_params(
                0,
                $request->getBasePath(),
                null,
                $request->getUri()->getScheme() === 'https',
                true
            );
            session_start();
        }
    }
733548
public function process()
	{
		$view = $this->getView();
		$session = $this->_getContext()->getSession();

		if( ( $languageId = $view->param( 'loc-languageid' ) ) !== null ) {
			$session->set( 'arcavias/locale/languageid', $languageId );
		}

		if( ( $currencyId = $view->param( 'loc-currencyid' ) ) !== null ) {
			$session->set( 'arcavias/locale/currencyId', $currencyId );
		}

		parent::process();
	}
817050
function(session) {
  EventEmitter.call(this);
  clone(session, this, FRONTEND_SESSION_FIELDS);
  // deep copy for settings
  this.settings = dclone(session.settings);
  this.__session__ = session;
}
1085432
def _maybeCleanSessions(self):
        
        sinceLast = self._clock.seconds() - self._lastClean
        if sinceLast > self.sessionCleanFrequency:
            self._cleanSessions()
458557
def _write_session(self):
        
        base_name = "%ssession" % self._product_accronym.lower()
        filename = "%s%s.py" % (self._class_prefix.lower(), base_name)
        override_content = self._extract_override_content(base_name)

        self.write(destination=self.output_directory, filename=filename, template_name="session.py.tpl",
                   version=self.api_version,
                   product_accronym=self._product_accronym,
                   class_prefix=self._class_prefix,
                   root_api=self.api_root,
                   api_prefix=self.api_prefix,
                   override_content=override_content,
                   header=self.header_content)
997178
private function handleStrict(): void
    {
        if (!ini_get('session.use_strict_mode') || headers_sent()) {
            return;
        }

        $cookieName = session_name();
        if (empty($_COOKIE[$cookieName])) {
            return;
        }

        $sessionId = $_COOKIE[$cookieName];

        $identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);

        if ($this->storageDriver->sessionExists($identifier)) {
            return;
        }

        $newSessionId = session_create_id();
        session_id($newSessionId);
    }
278632
public void createSession(Session session) {
        sessionMap.put(session.id(), session);
        Event event = new Event();
        event.attribute("session", session);

        eventManager.fireEvent(EventType.SESSION_CREATED, event);
    }
1210384
public function initNewSession()
    {
        // starting session only if it was not started yet
        if (self::$_blIsNewSession) {
            $this->_sessionStart();
        }

        //saving persistent params if old session exists
        $aPersistent = [];
        foreach ($this->_aPersistentParams as $sParam) {
            if (($sValue = $this->getVariable($sParam))) {
                $aPersistent[$sParam] = $sValue;
            }
        }

        $this->_setSessionId($this->_getNewSessionId());

        //restoring persistent params to session
        foreach ($aPersistent as $sKey => $sParam) {
            $this->setVariable($sKey, $aPersistent[$sKey]);
        }

        $this->_initNewSessionChallenge();

        // (re)setting actual user agent when initiating new session
        $this->setVariable("sessionagent", \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getServerVar('HTTP_USER_AGENT'));
    }
1062992
private function initializeSessionContext()
    {
        $sessionServer = SessionServer::create($this)->getValue();
        $this->sessionContext = SessionContext::create($sessionServer);
    }
348252
private void process(T session) {
        // Process Reads
        if (isReadable(session) && !session.isReadSuspended()) {
            read(session);
        }

        // Process writes
        if (isWritable(session) && !session.isWriteSuspended()) {
            scheduleFlush(session);
        }
    }
935453
function SessionStrategy(options, deserializeUser) {
  if (typeof options == 'function') {
    deserializeUser = options;
    options = undefined;
  }
  options = options || {};
  
  Strategy.call(this);
  this.name = 'session';
  this._deserializeUser = deserializeUser;
}
114607
function createSession(config, cb) {
  cb = utils.callOnce(cb)

  DEBUG("create", utils.JS(config))

  var channel = channels.createChannel(config.url)
  var session = new Session(channel, config, cb)
}
457256
public function fromSessionData ()
	{
		
		$arr	= $this->getSessionData ();
		
		if (isset ($arr['id']))
		{
			$this->iset ('id', $arr['id']);
		}
		
		$this->fromArray ($arr, FALSE, FALSE);
		
		$this->loginTimestamp	= !Parser::_ak ($arr, 'login_timestamp', FALSE);
		$this->lastAction		= !Parser::_ak ($arr, 'last_action', FALSE);
		
	}
1146600
function (session) {
            this._session = session;
            if (this._smList) {
                var sz = this._smList.length;
                for (var i = 0; i < sz; i++) {
                    var subModule = this._smList[i];
                    if (subModule) {
                        subModule.setSession(session);
                    }
                }
            }
        }
1206681
public function flush()
    {

        // persist all sessions
        /** @var \AppserverIo\Psr\Servlet\ServletSessionInterface $session */
        foreach ($this->getSessions() as $session) {
            // iterate over the session handlers and persist the sessions
            /** @var \AppserverIo\Appserver\ServletEngine\Session\SessionHandlerInterface $sessionHandler */
            foreach ($this->getSessionHandlers() as $sessionHandler) {
                try {
                    $sessionHandler->save($session);
                } catch (\Exception $e) {
                    // log the exception if a system logger is available
                    if ($logger = $this->getLogger(LoggerUtils::SYSTEM)) {
                        $logger->error($e->__toString());
                    }
                }
            }
        }
    }