<commit_before><?php /** @file */

namespace Zotlabs\Web;

class WebServer {

	public function run() {


		/*
		 * Bootstrap the application, load configuration, load modules, load theme, etc.
		 */

		require_once('boot.php');

		sys_boot();


		\App::$language = get_best_language();
		load_translation_table(\App::$language,\App::$install);


		/**
		 *
		 * Important stuff we always need to do.
		 *
		 * The order of these may be important so use caution if you think they're all
		 * intertwingled with no logical order and decide to sort it out. Some of the
		 * dependencies have changed, but at least at one time in the recent past - the
		 * order was critical to everything working properly
		 *
		 */

		if(\App::$session) {
			\App::$session->start();
	  	}
  		else {
			session_start();
			register_shutdown_function('session_write_close');
  		}

		/**
		 * Language was set earlier, but we can over-ride it in the session.
		 * We have to do it here because the session was just now opened.
		 */

		if(array_key_exists('system_language',$_POST)) {
			if(strlen($_POST['system_language']))
				$_SESSION['language'] = $_POST['system_language'];
			else
				unset($_SESSION['language']);
		}
		if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
			\App::$language = $_SESSION['language'];
			load_translation_table(\App::$language);
		}

		if((x($_GET,'zid')) && (! \App::$install)) {
			\App::$query_string = strip_zids(\App::$query_string);
			if(! local_channel()) {
				$_SESSION['my_address'] = $_GET['zid'];
				zid_init();
			}
		}

		if((x($_GET,'zat')) && (! \App::$install)) {
			\App::$query_string = strip_zats(\App::$query_string);
			if(! local_channel()) {
				zat_init();
			}
		}

		if((x($_REQUEST,'owt')) && (! \App::$install)) {
			$token = $_REQUEST['owt'];
			\App::$query_string = strip_query_param(\App::$query_string,'owt');
			owt_init($token);
		}

		if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (\App::$module === 'login'))
			require('include/auth.php');

		if(! x($_SESSION, 'sysmsg'))
			$_SESSION['sysmsg'] = array();
<commit_msg>prevent 'my_address' being set with bogus info<commit_after><?php /** @file */

namespace Zotlabs\Web;

class WebServer {

	public function run() {


		/*
		 * Bootstrap the application, load configuration, load modules, load theme, etc.
		 */

		require_once('boot.php');

		sys_boot();


		\App::$language = get_best_language();
		load_translation_table(\App::$language,\App::$install);


		/**
		 *
		 * Important stuff we always need to do.
		 *
		 * The order of these may be important so use caution if you think they're all
		 * intertwingled with no logical order and decide to sort it out. Some of the
		 * dependencies have changed, but at least at one time in the recent past - the
		 * order was critical to everything working properly
		 *
		 */

		if(\App::$session) {
			\App::$session->start();
	  	}
  		else {
			session_start();
			register_shutdown_function('session_write_close');
  		}

		/**
		 * Language was set earlier, but we can over-ride it in the session.
		 * We have to do it here because the session was just now opened.
		 */

		if(array_key_exists('system_language',$_POST)) {
			if(strlen($_POST['system_language']))
				$_SESSION['language'] = $_POST['system_language'];
			else
				unset($_SESSION['language']);
		}
		if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
			\App::$language = $_SESSION['language'];
			load_translation_table(\App::$language);
		}

		if((x($_GET,'zid')) && (! \App::$install)) {
			\App::$query_string = strip_zids(\App::$query_string);
			if(! local_channel()) {
                                if ($_SESSION['my_address']!=$_GET['zid'])
                                {
                                        $_SESSION['my_address'] = $_GET['zid'];
                                        $_SESSION['authenticated'] = 0;
                                }
				zid_init();
			}
		}

		if((x($_GET,'zat')) && (! \App::$install)) {
			\App::$query_string = strip_zats(\App::$query_string);
			if(! local_channel()) {
				zat_init();
			}
		}

		if((x($_REQUEST,'owt')) && (! \App::$install)) {
			$token = $_REQUEST['owt'];
			\App::$query_string = strip_query_param(\App::$query_string,'owt');
			owt_init($token);
		}

		if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (\App::$module === 'login'))
			require('include/auth.php');

		if(! x($_SESSION, 'sysmsg'))
			$_SESSION['sysmsg'] = array();

{'fraction_non_alphanumeric': 0.1818382677861246, 'fraction_numerical': 0.0002209456473707468, 'mean_word_length': 3.20724907063197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7116938', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1413, 'n_words': 328}