Starting session

@param array $options
546113
public static function start($options) {
		// setting default options
		foreach (self::$default_options as $k => $v) {
			if (isset($options[$k]) || array_key_exists($k, $options)) {
				ini_set("session.$k", $options[$k]);
				self::$default_options[$k] = $options[$k];
			} else if (isset(self::$default_options[$k])) {
				ini_set("session.$k", $v);
			}
		}
		// session # replacement
		$__session_id = \Application::get('flag.global.__session_id');
		if (!empty($__session_id)) {
			session_id($__session_id);
		}
		// starting session submodule if we have one
		$class = Application::get('flag.global.session.submodule', ['class' => 1]);
		// check if backend has been enabled
		if (!\Application::get($class, ['submodule_exists' => true])) {
			Throw new Exception('You must enable ' . $class . ' first!');
		}
		// initialize
		if (!empty($class)) {
			self::$object = new $class();
			self::$object->init();
		}
		// starting session
		session_start();
		// session fixation prevention
		if (empty($_SESSION['numbers']['flag_generated_by_system'])) {
			session_regenerate_id(true);
			$_SESSION = [];
			$_SESSION['numbers']['flag_generated_by_system'] = true;
		}
		// processing IP address
		$ip = \Request::ip();
		// we need to reset ip address details if we have different ip
		if (!empty($_SESSION['numbers']['ip']['ip']) && $_SESSION['numbers']['ip']['ip'] != $ip) {
			$_SESSION['numbers']['ip'] = [];
		}
		// we need to try to decode ip address
		$ip_decoder_submodule = \Application::get('flag.global.ip.submodule');
		if (!empty($ip_decoder_submodule) && !isset($_SESSION['numbers']['ip']['ip'])) {
			$ip_object = new \Object\Miscellaneous\IP();
			$ip_data = $ip_object->get($ip);
			if ($ip_data['success']) {
				$_SESSION['numbers']['ip'] = array_merge2(['ip' => $ip], $ip_data['data']);
			}
		}
		// we only store ip address if its not set
		if (!isset($_SESSION['numbers']['ip']['ip'])) {
			$_SESSION['numbers']['ip'] = [
				'ip' => $ip
			];
		}
		// add anonymous role
		if (!\User::authorized()) {
			\User::roleGrant(\Object\ACL\Resources::getStatic('user_roles', 'anonymous', 'data'));
		}
	}
1133717
protected function setOptions($options)
    {
        if (!$options instanceof OptionsInterface) {
            $options = is_array($options) ? $options : [];
            $options = new Options($options);
        }

        $this->options = $options;
    }
1167543
protected function initialize($options)
    {
        if (is_array($options) === false && ($options instanceof Traversable) === false) {
            throw new Exception('The $options argument must be either an array or Traversable');
        }

        foreach ($options as $key => $value) {
            if (in_array($key, $this->configurable, true) === false) {
                continue;
            }

            $method = 'set'.ucfirst($key);

            if (method_exists($this, $method) === true) {
                $this->$method($value);
            }
        }
    }
828780
protected function childInitialize(array $options = array())
    {
        $this->prepared = false;
        $this->removeAllListeners();
        $this->master = false;
        $pid = posix_getpid();
        $this->ppid = $this->pid;
        $this->pid = $pid;
        $this->queue = null;
        $this->process = new Process($this, $this->pid, $this->ppid);
        $this->children = array();
        $this->prepared = true;

        $options = $options + self::$child_options;

        $this->childProcessOptions($options);
    }
6784
public function config(array $options)
    {
        $this->options = $options;
    
        $this->initializeOptions($options);
    
        if ($this->getSession()->debug == true) {
            $this->setDebug(true);
        }
    }
1320889
protected function startSession()
    {
        if (@session_status() === \PHP_SESSION_ACTIVE) {
            throw new SessionNotStartedException('Session started already!');
        }

        if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
            throw new SessionNotStartedException(sprintf('Unable to start session, headers already sent by "%s" at line %d.', $file, $line));
        }

        $this->setSessionConfig();

        /*
         | We will start session, if fails
         | we will throw exception to user
         */
        if (!session_start()) {
            throw new SessionNotStartedException('Unable to start session');
        }
    }
1107918
public function init($options = [])
    {
        $auth = new Authentication();

        if (!$auth->check()) {
            $url = (isset($options['auth_login_url']))
            ? $options['auth_login_url']
            : '/auth/login';

            $this->redirect = $url;
        }
    }
941513
public function start(array $options = array())
    {
        $currentBundleOptions = array(
            'docroot' => $this->getDocRoot(),
            'bypass'  => $this->getBypass()
        );

        $this->currentBundleOptions = array_merge($currentBundleOptions, $options);
        ob_start();

        return $this;
    }
1217555
public function beginFooter($options = [])
    {
        $this->_setBeginning(true);
        $this->footerOptions = ArrayHelper::merge($this->footerOptions, $options);
        ob_start();
    }
1008232
public function start()
	{
		if ($this->getState() === 'active')
		{
			return;
		}

		$this->_start();

		$this->setState('active');

		// Initialise the session
		$this->_setCounter();
		$this->_setTimers();

		// Perform security checks
		$this->_validate();

		if ($this->dispatcher instanceof DispatcherInterface)
		{
			$this->dispatcher->triggerEvent('onAfterSessionStart');
		}
	}
630857
protected function setOptions(array $options)
	{
		// Set name
		if (isset($options['name']))
		{
			session_name(md5($options['name']));
		}

		// Set id
		if (isset($options['id']))
		{
			session_id($options['id']);
		}

		// Set expire time
		if (isset($options['expire']))
		{
			$this->setExpire($options['expire']);
		}

		// Get security options
		if (isset($options['security']))
		{
			$this->security = explode(',', $options['security']);
		}

		if (isset($options['force_ssl']))
		{
			$this->force_ssl = (bool) $options['force_ssl'];
		}

		if (isset($options['cookie_domain']))
		{
			$this->cookie_domain = $options['cookie_domain'];
		}

		if (isset($options['cookie_path']))
		{
			$this->cookie_path = $options['cookie_path'];
		}

		// Sync the session maxlifetime
		if (!headers_sent())
		{
			ini_set('session.gc_maxlifetime', $this->getExpire());
		}

		return true;
	}
616677
public function setOptions(array $options): void
    {
        if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
            return;
        }
        $validOptions = array_flip([
            'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
            'cookie_lifetime', 'cookie_path', 'cookie_secure',
            'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'auto_start',
            'lazy_write', 'name', 'referer_check', 'save_path', 'save_handler',
            'serialize_handler', 'use_strict_mode', 'use_cookies',
            'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
            'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
            'upload_progress.freq', 'upload_progress.min_freq',
            'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
        ]);
        foreach ($options as $key => $value) {
            if (isset($validOptions[$key])) {
                ini_set('session.' . $key, (string) $value);
            }
        }
    }
250087
private function applyOptions(array $options)
    {
        foreach ($options as $option => $value) {
            if (isset($this->$option) && isset($value)) {
                $this->$option = $value;
            }
        }
    }
710716
public function setOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $this->setOption($name, $value);
        }
    }
973824
protected function configure(array $options): void
    {
        $options = array_merge([
            'timeout_socket' => self::TIMEOUT_SOCKET,
        ], $options);

        parent::configure($options);
    }
440498
public function setup(array $options)
    {
        foreach ($options as $method => $value) {
            $method = 'set' . ucfirst($method);
            if (method_exists($this, $method)) {
                $this->{$method}($value);
            }
        }
    }
1191580
public function setOptions(array $options)
    {
        if (count($options)) {
            foreach ($options as $method => $value) {
                $method = camelcase('set_' . $method);

                if (method_exists($this, $method)) {
                    call_user_func_array([&$this, $method], [$value]);
                }
            }
        }

        return $this;
    }