<?php
/*
Runtime Envirment file
位置: /passport
*/
require('../rte.php');

#根据目录自动判断MODULE
define('MODULE',str_replace(str_replace('\\','/',ROOT),'',str_replace('\\','/',dirname(__FILE__))));
#固定MODUL
//define('MODULE','exam');

define('WORK_DIR',ROOT.MODULE."/");

require(WORK_DIR.'config/baseconfig.php');
require(WORK_DIR.'config/config_txdb.php');
require(WORK_DIR.'rte_functions.php');
if ($base_config['exam_close']) {
	header('HTTP/1.1 404 Not Found');
	exit;
}

Iimport('Exam_User');
$exam_user = new Exam_User();

function Login_check() {
	global $exam_user;
	if (!$exam_user->IsLogined()) {
		PassportLogin(GetRtFullUrlAndPost(),'no.login');
		exit;
	}else {
		//insert user;
		if (!$exam_user -> U[$exam_user -> U_UniqueID] || $exam_user -> U['email'] != $exam_user->BU['email'] || $exam_user -> BU['class'] != $exam_user ->U['class'] || $exam_user->U['classes'] != $exam_user->BU['classes']) {
			$exam_user -> SetInsertInfo(array(
			$exam_user -> PriKey => $exam_user -> U_ID,
			$exam_user->U_UniqueID => $exam_user -> U_Uname,
			'email' => $exam_user ->BU['email'],
			'class' => $exam_user ->BU['class'],
			'classes' => $exam_user -> BU['classes'],
			));
			$exam_user -> DoRecordUser(array(),1,'replace');			
		}
	}
}
$Lang -> LoadLangFromFile('i18n_exam');
if(empty($base_config['kaojuan_autotime']))  $base_config['kaojuan_autotime'] = 300;
if(empty($base_config['exam_online_timelimit'])) $base_config['exam_online_timelimit'] = 600;
?>