Checks if current session id is the same as in originally received cookie.
This method is intended to indicate if new session cookie
is to be sent as header from this script execution.

@return bool
558795
public function isActualSidInCookie()
    {
        return isset($_COOKIE[$this->getName()]) && ($_COOKIE[$this->getName()] == $this->getId());
    }
84222
public function renewId()
    {

        // create a new session ID
        $this->setId(SessionUtils::generateRandomString());

        // load the session manager
        $sessionManager = $this->getContext()->search(SessionManagerInterface::IDENTIFIER);

        // attach this session with the new ID
        $sessionManager->attach($this->getSession());

        // create a new cookie with the session values
        $cookie = new HttpCookie(
            $this->getName(),
            $this->getId(),
            $this->getLifetime(),
            $this->getMaximumAge(),
            $this->getDomain(),
            $this->getPath(),
            $this->isSecure(),
            $this->isHttpOnly()
        );

        // add the cookie to the response
        $this->getRequest()->setRequestedSessionId($this->getId());
        $this->getResponse()->addCookie($cookie);

        // return the new session ID
        return $this->getId();
    }
1355213
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

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

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

        return ($handler instanceof CookieSessionHandler);
    }
663939
private function checkCookieAuth()
    {
        if (strlen(trim($this->getUsername())) == 0) {
            $this->objConnector->cleanupSession();
            $this->objConnector->refreshSession();
            return false;
        }
        return true;
    }
1069087
public function isJailed()
	{
		if ($this->get('user_id', false))
		{
			$params        = Plugin::params('system', 'spamjail');
			$sessionCount  = $params->get('session_count', 5);
			$lifetimeCount = $params->get('user_count', 10);
			if (Session::get('spam_count', 0) > $sessionCount || $this->get('spam_count', 0) > $lifetimeCount)
			{
				return true;
			}
		}

		return false;
	}
668327
private function checkFormIdInSession()
    {
        if (!isset($_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID])) {
            return false;
        }

        if (!$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] === $this->formId) {
            return false;
        }

        return true;
    }
1023575
protected function verifyCookie()
    {
        if (!$this->parseCookie() || $this->parseCookie()->expires < current_time('timestamp')) {
            return false;
        }

        if ($this->parseCookie()->hash !== $this->getHash()) {
            return false;
        }

        return true;
    }
681930
public function isActiveSession()
    {
        // Check if session timeout is defined in application settings
        $sessionConfig = $GLOBALS['app']->getConfiguration()->getRawConfiguration('session');
        if (!empty($sessionConfig) && isset($sessionConfig['timeout']) && !empty($sessionConfig['timeout'])) {
            $sessionTimeout = $sessionConfig['timeout'];
        } else {
            $sessionTimeout = SESSION_TIMEOUT;
        }

        file_put_contents(getcwd().'/logs/session.log', print_r($_SESSION, 1));

        if(isset($_SESSION[self::GLOBAL_PREFIX.'last_accessed']) &&
            (time() - $_SESSION[self::GLOBAL_PREFIX.'last_accessed'] > $sessionTimeout)) {
            return FALSE;
        }

        return TRUE;
    }
360613
public function getCurrentSessionHash(){
        return isset($_COOKIE[$this->config->cookie_name]) ? $_COOKIE[$this->config->cookie_name] : false;
    }
461270
public function getIdFromCookie()
    {
        if (empty($_COOKIE[$this->name])) {
            return false;
        }
        $id = $_COOKIE[$this->name];
        if (!is_string($id) || !$this->isValidId($id)) {
            return false;
        }
        return $id;
    }
522270
public function hasAny() {
		return isset($_SESSION[self::SESSION_KEY_FLASH]) && is_array($_SESSION[self::SESSION_KEY_FLASH]) && count($_SESSION[self::SESSION_KEY_FLASH]) > 0;
	}
739228
public function isActive()
    {
        $sid = defined('SID') ? constant('SID') : false;
        if ($sid !== false && session_id()) {
            return true;
        }

        if (headers_sent()) {
            return true;
        }

        return false;
    }
715038
public function getSessionIdFromCookie()
	{
		// get session id key name
		$client = 'site';
		if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'])
		{
			$referrer = $_SERVER['HTTP_REFERER'];
			if (\Hubzero\Utility\Uri::isInternal($referrer))
			{
				if (substr($referrer, 0, strlen('http')) == 'http')
				{
					$referrer = parse_url($referrer, PHP_URL_PATH);
				}
				$referrer = trim($referrer, '/');
				$parts = explode('/', $referrer);
				$referrer = array_shift($parts);
				if ($referrer == 'administrator')
				{
					$client = $referrer;
				}
			}
		}
		$sessionName = md5(\App::hash($client));

		// return session id stored in cookie
		return (!empty($_COOKIE[$sessionName])) ? $_COOKIE[$sessionName] : null;
	}
1322007
private function hasSession() {

        if(DI::getDefault()->has('session') === true) {

            // get instance of session class
            $this->session = DI::getDefault()->getSession();

            if($this->session->getId() === '') {
                $this->session->start();
            }

            return true;
        }

        return false;
    }
373202
public function isAuthenticated()
    {
        if (!$this->session->has('usr_id')) {
            return false;
        }

        if ($this->session->has('session_id')) {
            if (null !== $this->app['repo.sessions']->find($this->session->get('session_id'))) {
                return true;
            }
        }

        $this->session->invalidate();
        $this->reinitUser();

        return false;
    }
251770
public function isLogged() {
        if ($this->isAuthenticated === false) {
            $this->isAuthenticated = $this->checkSession($this->getCurrentSessionHash());
        }
        return $this->isAuthenticated;
    }
962313
public function isCookieAlive()
	{
		//	...
		$bRet = false;

		if ( $this->isKeepAlive() )
		{
			//
			//	return false if user set to keep alive
			//
			$bRet	= true;
		}
		else
		{
			//	...
			$nLoginTime = $this->m_cUCProMain->getXTInstance()->getTValue( UCProConst::CKT_LOGIN_TM );
			if ( is_numeric( $nLoginTime ) )
			{
				//
				//	escaped time in seconds after user logged in
				//      the default timeout is 1 day.
				//
				$fTerm	= floatval( time() - floatval( $nLoginTime ) );
				$bRet	= ( $fTerm <= $this->m_cUCProMain->getConfig_nCookieTimeout() );
			}
			else
			{
				//
				//      login time is invalid
				//      So, we marked this cookie as timeout
				//
				$bRet	= false;
			}
		}

		return $bRet;
	}