<commit_before><?php

system("echo \"{$_SERVER["HTTP_USER_AGENT"]}\" >> user_agents");

$platform = "android";
$app_version = "1.0";

if(empty($_GET["platform"])) {
	header("X-Error: no platform specified, defaulting to " . $platform);
} else {
	$platform = $_GET["platform"];
}
if(empty($_GET["app_version"])) {
	header("X-Error: no app_version specified, defaulting to " . $app_version);
} else {
	$app_version = $_GET["app_version"];
}


function trim_array($arr) {
	/*while(count($arr) && !$arr[0]) {
		array_shift($arr);
	}*/
        while(count($arr) && !$arr[count($arr) - 1]) {
                array_pop($arr);
        }
	return $arr;
}

function comparble_version($version_number) {
	$version_number = explode(".", $version_number);
	$version_number = array_map("intval", $version_number);
	$version_number = trim_array($version_number);
	$version_number = array_map(function($e){return str_pad($e, 10, "0", STR_PAD_LEFT);}, $version_number);
	return implode(".", $version_number);
}


function echo_compatible($arr) {
	global $platform;
	$lower_platform = strtolower($platform);
	if($lower_platform == "ios" || $lower_platform == "win") {
		return json_encode($arr);
	}
	$out = "";
	foreach($arr as $k => $v) {
		if(is_array($v)) {
			$v = implode(",", $v);
		}
		$out .= "$k=$v\n";
	}
	return $out;
}

/*
if($_SERVER['REMOTE_ADDR'] == "172.16.58.3") {
	$resp = array();
	$resp["SERVER_PROTOCOL"] = "http";
	$resp["SERVER_PORT"] = "9090";
	$resp["SERVER_ADDRESS"] = "172.16.58.3";
	die(echo_compatible($resp));
}
*/

// BACKWARD COMPATIBILITY

if($platform == "ios" && comparble_version($app_version) < comparble_version("1.2")) {
	$resp = array();
        $resp["status"] = 200;
        $resp["server_protocol"] = "https";
        $resp["server_address"] = "pocketcampus.epfl.ch";
        $resp["server_port"] = "14611";
        $resp["server_uri"] = "v3r1";
	die(echo_compatible($resp));
}


// MAIN LOGIC

$resp = array();

$resp["SERVER_PROTOCOL"] = "https";
//$resp["SERVER_PROTOCOL"] = "http";
//$resp["GCM_SENDER_ID"] = "384589660983";
$resp["SERVER_PORT"] = "14611";
//$resp["SERVER_PORT"] = "4433";
//$resp["SERVER_PORT"] = "9090";
//$resp["GA_TRACKING_CODE"] = "UA-22135241-3"; //Old Google Analytics
//$resp["GA_TRACKING_CODE"] = "UA-22135241-5"; //New Google Universal Analytics
$resp["SERVER_ADDRESS"] = "pocketcampus.epfl.ch";
$resp["ENABLED_PLUGINS"] = array("Camipro", "Moodle", "Food", "Transport", "News", "Satellite", "Map", "Directory", "MyEdu", "Events", "Authentication", "PushNotif", "IsAcademia", /*"FreeRoom",*/ "CloudPrint", "RecommendedApps", "Alumni");
//$resp["SERVER_URI"] = "v3r1";
$resp["FOOD_RATINGS_ENABLED"] = 1; //0 = disabled, 1 = enabled

// iOS6 does not support https
if($platform == "ios" && comparble_version($app_version) < comparble_version("2.0")) {
	$resp["SERVER_PROTOCOL"] = "http";
	$resp["SERVER_PORT"] = "14610";
}

echo echo_compatible($resp);

?>
<commit_msg>[website.backend] enable freeroom in getconfig<commit_after><?php

system("echo \"{$_SERVER["HTTP_USER_AGENT"]}\" >> user_agents");

$platform = "android";
$app_version = "1.0";

if(empty($_GET["platform"])) {
	header("X-Error: no platform specified, defaulting to " . $platform);
} else {
	$platform = $_GET["platform"];
}
if(empty($_GET["app_version"])) {
	header("X-Error: no app_version specified, defaulting to " . $app_version);
} else {
	$app_version = $_GET["app_version"];
}


function trim_array($arr) {
	/*while(count($arr) && !$arr[0]) {
		array_shift($arr);
	}*/
        while(count($arr) && !$arr[count($arr) - 1]) {
                array_pop($arr);
        }
	return $arr;
}

function comparble_version($version_number) {
	$version_number = explode(".", $version_number);
	$version_number = array_map("intval", $version_number);
	$version_number = trim_array($version_number);
	$version_number = array_map(function($e){return str_pad($e, 10, "0", STR_PAD_LEFT);}, $version_number);
	return implode(".", $version_number);
}


function echo_compatible($arr) {
	global $platform;
	$lower_platform = strtolower($platform);
	if($lower_platform == "ios" || $lower_platform == "win") {
		return json_encode($arr);
	}
	$out = "";
	foreach($arr as $k => $v) {
		if(is_array($v)) {
			$v = implode(",", $v);
		}
		$out .= "$k=$v\n";
	}
	return $out;
}

/*
if($_SERVER['REMOTE_ADDR'] == "172.16.58.3") {
	$resp = array();
	$resp["SERVER_PROTOCOL"] = "http";
	$resp["SERVER_PORT"] = "9090";
	$resp["SERVER_ADDRESS"] = "172.16.58.3";
	die(echo_compatible($resp));
}
*/

// BACKWARD COMPATIBILITY

if($platform == "ios" && comparble_version($app_version) < comparble_version("1.2")) {
	$resp = array();
        $resp["status"] = 200;
        $resp["server_protocol"] = "https";
        $resp["server_address"] = "pocketcampus.epfl.ch";
        $resp["server_port"] = "14611";
        $resp["server_uri"] = "v3r1";
	die(echo_compatible($resp));
}


// MAIN LOGIC

$resp = array();

$resp["SERVER_PROTOCOL"] = "https";
//$resp["SERVER_PROTOCOL"] = "http";
//$resp["GCM_SENDER_ID"] = "384589660983";
$resp["SERVER_PORT"] = "14611";
//$resp["SERVER_PORT"] = "4433";
//$resp["SERVER_PORT"] = "9090";
//$resp["GA_TRACKING_CODE"] = "UA-22135241-3"; //Old Google Analytics
//$resp["GA_TRACKING_CODE"] = "UA-22135241-5"; //New Google Universal Analytics
$resp["SERVER_ADDRESS"] = "pocketcampus.epfl.ch";
$resp["ENABLED_PLUGINS"] = array("Camipro", "Moodle", "Food", "Transport", "News", "Satellite", "Map", "Directory", "MyEdu", "Events", "Authentication", "PushNotif", "IsAcademia", "FreeRoom", "CloudPrint", "RecommendedApps", "Alumni");
//$resp["SERVER_URI"] = "v3r1";
$resp["FOOD_RATINGS_ENABLED"] = 1; //0 = disabled, 1 = enabled

// iOS6 does not support https
if($platform == "ios" && comparble_version($app_version) < comparble_version("2.0")) {
	$resp["SERVER_PROTOCOL"] = "http";
	$resp["SERVER_PORT"] = "14610";
}

echo echo_compatible($resp);

?>

{'fraction_non_alphanumeric': 0.2249276349395539, 'fraction_numerical': 0.032351438787672396, 'mean_word_length': 5.183157894736842, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '101134', 'n_tokens_mistral': 2333, 'n_tokens_neox': 2196, 'n_words': 376}