<commit_before><?php
require_once dirname(__DIR__, 3) . "/php/classes/autoload.php";
require_once dirname(__DIR__, 3) . "/php/lib/xsrf.php";
require_once("/etc/apache2/capstone-mysql/encrypted-config.php");
use Edu\Cnm\Ourvibe\Venue;


if(session_status() !== PHP_SESSION_ACTIVE) {
	session_start();
}
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
try {

	$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/ourvibe.ini");
	$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
	$activation = filter_input(INPUT_GET, "activation", FILTER_SANITIZE_STRING);
	if(strlen($activation) !== 32) {
		throw(new InvalidArgumentException("activation has an incorrect length", 405));
	}

	if(ctype_xdigit($activation) === false) {
		throw (new \InvalidArgumentException("activation is empty or has invalid contents", 405));
	}
	if($method === "GET") {
		setXsrfCookie();
		$venue = Edu\Cnm\OurVibe\Venue::getVenueByVenueActivationToken($pdo,$activation);
		if($venue !== null) {
			if($activation === $venue->getVenueActivationToken()) {
				$venue->setVenueActivationToken(null);
				$venue->update($pdo);
				$reply->data = "Thank you for activating your account, you will be auto-redirected to your venue shortly.";
			}
		} else throw (new RuntimeException("venue with this activation code does not exist",404));

	}else throw(new RuntimeException("invalid http request"));
} catch(Exception $exception) {
	$reply->status = $exception->getCode();
	$reply->message =$exception->getMessage();
}catch(TypeError $typeError){
	$reply->status = $typeError->getCode();
	$reply->message = $typeError->getMessage();
}
header("Content-type: application/json");
if($reply->data === null) {
		unset($reply->data);
	}
	echo json_encode($reply);
<commit_msg>fixed bracing<commit_after><?php
require_once dirname(__DIR__, 3) . "/php/classes/autoload.php";
require_once dirname(__DIR__, 3) . "/php/lib/xsrf.php";
require_once("/etc/apache2/capstone-mysql/encrypted-config.php");
use Edu\Cnm\Ourvibe\Venue;


if(session_status() !== PHP_SESSION_ACTIVE) {
	session_start();
}
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
try {

	$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/ourvibe.ini");
	$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
	$activation = filter_input(INPUT_GET, "activation", FILTER_SANITIZE_STRING);
	if(strlen($activation) !== 32) {
		throw(new InvalidArgumentException("activation has an incorrect length", 405));
	}

	if(ctype_xdigit($activation) === false) {
		throw (new \InvalidArgumentException("activation is empty or has invalid contents", 405));
	}
	if($method === "GET") {
		setXsrfCookie();
		$venue = Edu\Cnm\OurVibe\Venue::getVenueByVenueActivationToken($pdo, $activation);
		if($venue !== null) {
			if($activation === $venue->getVenueActivationToken()) {
				$venue->setVenueActivationToken(null);
				$venue->update($pdo);
				$reply->data = "Thank you for activating your account, you will be auto-redirected to your venue shortly.";
			}
		} else {
			throw (new RuntimeException("venue with this activation code does not exist", 404));
		}

	} else {
		throw(new RuntimeException("invalid http request"));
	}
} catch(Exception $exception) {
	$reply->status = $exception->getCode();
	$reply->message = $exception->getMessage();
} catch(TypeError $typeError) {
	$reply->status = $typeError->getCode();
	$reply->message = $typeError->getMessage();
}
header("Content-type: application/json");
if($reply->data === null) {
	unset($reply->data);
}
echo json_encode($reply);

{'fraction_non_alphanumeric': 0.17195551939245998, 'fraction_numerical': 0.009764035801464606, 'mean_word_length': 5.919324577861163, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5919986', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1198, 'n_words': 235}