<commit_before><?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// <NAME> <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
//		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".


@include_once mnminclude.'ads-credits-functions.php';

// Warning, it redirects to the content of the variable
if (!empty($globals['lounge'])) {
	header('Location: http://'.get_server_name().$globals['base_url_general'].$globals['lounge']);
	die;
}

if (!empty($globals['force_ssl']) && ! $globals['https'] && ! isset($_GET['force'])) {
	header('HTTP/1.1 301 Moved');
	header('Location: https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
	die;
}

$globals['extra_js'] = Array();
$globals['extra_css'] = Array();

if (! $globals['bot'] && ($globals['allow_partial'] || preg_match('/meneame/i', $_SERVER['HTTP_USER_AGENT']))) {
	if (! $globals['mobile']) $globals['ads'] = false;
	if (isset($_REQUEST['partial'])) {
		$globals['partial'] = true;
		$_SERVER['QUERY_STRING'] =preg_replace('/partial&|\?partial$|&partial/', '', $_SERVER['QUERY_STRING']);
	} else {
		$globals['partial'] = false;
	}
}


class MenuOption{
	// Small helper class to store links' information
	function __construct($text, $url, $active = false, $title = '') {
		$this->text = $text;
		$this->url = $url;
		$this->title = $title;
		if ($active && $active == $this->text) {
			$this->selected = true;
		} else {
			$this->selected = false;
		}
	}
}


function do_tabs($tab_name, $tab_selected = false, $extra_tab = false) {
	/* Not used any more */
}


function do_header($title, $id='home', $options = false) {
	global $current_user, $dblang, $globals, $db;

	header('Content-Type: text/html; charset=utf-8');
	header('X-Frame-Options: SAMEORIGIN');
	header('X-UA-Compatible: IE=edge,chrome=1');
	http_cache();

	$globals['security_key'] = get_security_key();
	setcookie('k', $globals['security_key'], 0, $globals['base_url']);

	if (!empty($_REQUEST['q'])) $globals['q'] = $_REQUEST['q'];<commit_msg>Added Strict-Transport-Security header if https is forced.<commit_after><?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// <NAME> <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
//		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".


@include_once mnminclude.'ads-credits-functions.php';

// Warning, it redirects to the content of the variable
if (!empty($globals['lounge'])) {
	header('Location: http://'.get_server_name().$globals['base_url_general'].$globals['lounge']);
	die;
}

if (!empty($globals['force_ssl']) && ! $globals['https'] && ! isset($_GET['force'])) {
	header('HTTP/1.1 301 Moved');
	header('Location: https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
	die;
}

$globals['extra_js'] = Array();
$globals['extra_css'] = Array();

if (! $globals['bot'] && ($globals['allow_partial'] || preg_match('/meneame/i', $_SERVER['HTTP_USER_AGENT']))) {
	if (! $globals['mobile']) $globals['ads'] = false;
	if (isset($_REQUEST['partial'])) {
		$globals['partial'] = true;
		$_SERVER['QUERY_STRING'] =preg_replace('/partial&|\?partial$|&partial/', '', $_SERVER['QUERY_STRING']);
	} else {
		$globals['partial'] = false;
	}
}


class MenuOption{
	// Small helper class to store links' information
	function __construct($text, $url, $active = false, $title = '') {
		$this->text = $text;
		$this->url = $url;
		$this->title = $title;
		if ($active && $active == $this->text) {
			$this->selected = true;
		} else {
			$this->selected = false;
		}
	}
}


function do_tabs($tab_name, $tab_selected = false, $extra_tab = false) {
	/* Not used any more */
}


function do_header($title, $id='home', $options = false) {
	global $current_user, $dblang, $globals, $db;

	header('Content-Type: text/html; charset=utf-8');

	// Security headers
	header('X-Frame-Options: SAMEORIGIN');
	header('X-UA-Compatible: IE=edge,chrome=1');
	if ($globals['force_ssl'] && $globals['https']) {
		header('Strict-Transport-Security: max-age=2592000');
	}


	http_cache();

	$globals['security_key'] = get_security_key();
	setcookie('k', $globals['security_key'], 0, $globals['base_url']);

	if (!empty($_REQUEST['q'])) $globals['q'] = $_REQUEST['q'];
{'fraction_non_alphanumeric': 0.20505431168255375, 'fraction_numerical': 0.006872090445577478, 'mean_word_length': 5.163934426229508, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5919588', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1547, 'n_words': 352}