<commit_before><?php

include_once 'model.inc';
require_once 'config.php';

/*
 * Defintion of the methods in this file
 * Importing parameters: depends
 * Exporting parameters: is an array
 * 		First element in the array: error string. If it's not empty, error occurs;
 * 		Second element in the array: the real output ;
 * 
 * 
 * Call to MySql Stored Procedure
 * Exporting parameters:
 * 		CODE: CHAR(5); '00000' stands for success;
 *  	MSG: TEXT 
 */


//
// 0. Utility part
//
// extra useful function to make POST variables more safe
function escape($data) {
	$data = trim ( $data );
	$data = stripslashes ( $data );
	$data = htmlspecialchars ( $data );
	return $data;
}

function IsNullOrEmptyString($question){
	return (!isset($question) || trim($question)==='');
}

function SetLanguage($lan) {
	if ( $lan  ==  'zh_CN' ){
		putenv('LANG=zh_CN' );
		setlocale(LC_ALL, 'zh_CN' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	} elseif  ( $lan  ==  'zh_TW' ){
		putenv('LANG=zh_TW' );
		setlocale(LC_ALL, 'zh_TW' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	} elseif  ( $lan  ==  'en_US' ) {
		putenv('LANG=en_US' );
		setlocale(LC_ALL, 'en_US' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	}	

	//bindtextdomain ( HIH_I18N_DOMAIN ,  HIH_I18N_DOMAIN_PATH ); //设置某个域的mo文件路径
	//bind_textdomain_codeset(HIH_I18N_DOMAIN ,  'UTF-8' );  //设置mo文件的编码为UTF-8
	//textdomain(HIH_I18N_DOMAIN );
}

//
// 1. Database part
//
function user_login($userid, $userpwd) {
	/*
	 * $con = mysql_connect($MySqlHost, $MySqlUser, $MySqlPwd);
	 * if (!$con)
	 * {
	 * die('Could not connect: ' . mysql_error());<commit_msg>Changes - why PHP didn't updated?<commit_after><?php

include_once 'model.inc';
require_once 'config.php';

/*
 * Defintion of the methods in this file
 * Importing parameters: depends
 * Exporting parameters: is an array
 * 		First element in the array: error string. If it's not empty, error occurs;
 * 		Second element in the array: the real output ;
 * 
 * 
 * Call to MySql Stored Procedure
 * Exporting parameters:
 * 		CODE: CHAR(5); '00000' stands for success;
 *  	MSG: TEXT 
 */


//
// 0. Utility part
//
// extra useful function to make POST variables more safe
function escape($data) {
	$data = trim ( $data );
	$data = stripslashes ( $data );
	$data = htmlspecialchars ( $data );
	return $data;
}

function IsNullOrEmptyString($question){
	return (!isset($question) || trim($question)==='');
}

function SetLanguage($lan) {
	if ( $lan  ==  'zh_CN' ){
		putenv('LANG=zh_CN' );
		setlocale(LC_ALL, 'zh_CN' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	} elseif  ( $lan  ==  'zh_TW' ){
		putenv('LANG=zh_TW' );
		setlocale(LC_ALL, 'zh_TW' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	} elseif  ( $lan  ==  'en_US' ) {
		putenv('LANG=en_US' );
		setlocale(LC_ALL, 'en_US' );  //指定要用的语系，如：en_US、zh_CN、zh_TW
	}	

	//bindtextdomain ( HIH_I18N_DOMAIN ,  HIH_I18N_DOMAIN_PATH ); //设置某个域的mo文件路径
	//bind_textdomain_codeset(HIH_I18N_DOMAIN ,  'UTF-8' );  //设置mo文件的编码为UTF-8
	//textdomain(HIH_I18N_DOMAIN );
}
function export_error($error) {
	header('HTTP/1.1 500 Internal Server Error');
	echo json_encode(array(
			'type'=>'E',
			'Message'=>$error
	));	
}

//
// 1. Database part
//
function user_login($userid, $userpwd) {
	/*
	 * $con = mysql_connect($MySqlHost, $MySqlUser, $MySqlPwd);
	 * if (!$con)
	 * {
	 * die('Could not connect: ' . mysql_error());
{'fraction_non_alphanumeric': 0.16440012088244182, 'fraction_numerical': 0.0123904502870958, 'mean_word_length': 3.874815905743741, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6299801', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1338, 'n_words': 280}