<commit_before><?php
require_once __DIR__ . '/confing.php';
require_once __DIR__ . '/Smarty-3.1.21/libs/Smarty.class.php';

function connectDb() {
	return getPdoInstance();
}

function &getPdoInstance() {
	static $dbh;
	if (!isset($dbh)) {
		try {
			$dbh = new PDO(DSN, DB_USER, DB_PASSWORD);
		} catch (PDOException $e) {
			echo $e->getMessage();
			exit;
		}
	}
	return $dbh;
}

function &getSmartyInstance() {
	static $smarty;
	if (!isset($smarty)) {
		$smarty = new Smarty;
	}
	return $smarty;
}

function h($s) {
	return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
}

function setToken() {
	$token = sha1(uniqid(mt_rand(), true));
	$_SESSION['token'] = $token;
}

function checkToken() {
	if (empty($_SESSION['token']) || $_SESSION['token'] != $_POST['token']) {
		echo '不正なPOSTが行われました。';
		exit;
	}
}

function emailExists($email) {
	$sql = 'select * from users where email = :email limit 1';
	$stmt = connectDb()->prepare($sql);
	$stmt->execute(array(':email' => $email));
	$user = $stmt->fetch();
	return $user ? true : false;
}

function getSha1Password($s) {
	return sha1(PASSWORD_KEY . $s);
}
<commit_msg>Set template_dir<commit_after><?php
require_once __DIR__ . '/confing.php';
require_once __DIR__ . '/Smarty-3.1.21/libs/Smarty.class.php';

function connectDb() {
	return getPdoInstance();
}

function &getPdoInstance() {
	static $dbh;
	if (!isset($dbh)) {
		try {
			$dbh = new PDO(DSN, DB_USER, DB_PASSWORD);
		} catch (PDOException $e) {
			echo $e->getMessage();
			exit;
		}
	}
	return $dbh;
}

function &getSmartyInstance() {
	static $smarty;
	if (!isset($smarty)) {
		$smarty = new Smarty;
		$smarty->template_dir = 'views';
	}
	return $smarty;
}

function h($s) {
	return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
}

function setToken() {
	$token = sha1(uniqid(mt_rand(), true));
	$_SESSION['token'] = $token;
}

function checkToken() {
	if (empty($_SESSION['token']) || $_SESSION['token'] != $_POST['token']) {
		echo '不正なPOSTが行われました。';
		exit;
	}
}

function emailExists($email) {
	$sql = 'select * from users where email = :email limit 1';
	$stmt = connectDb()->prepare($sql);
	$stmt->execute(array(':email' => $email));
	$user = $stmt->fetch();
	return $user ? true : false;
}

function getSha1Password($s) {
	return sha1(PASSWORD_KEY . $s);
}

{'fraction_non_alphanumeric': 0.19410211267605634, 'fraction_numerical': 0.007922535211267605, 'mean_word_length': 4.571078431372549, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '2292714', 'n_tokens_mistral': 932, 'n_tokens_neox': 894, 'n_words': 183}