您的位置:首页 > 编程语言 > PHP开发

TCExam文件代码注释分析(shard/config/tcd_config.php)

2013-05-21 15:52 621 查看
TCExam文件代码注释分析(shard/config/tcd_config.php),此版本为:12.0.012
<?php
define ('K_TCEXAM_VERSION', '12.0.012');
define ('K_LANGUAGE', 'cn');                        //默认语言种类
define ('K_LANGUAGE_SELECTOR', false);              //是否可以选择语言
define ('K_AVAILABLE_LANGUAGES', serialize(array(   //语言种类
'ar' => 'Arabian',
'az' => 'Azerbaijani',
'bg' => 'Bulgarian',
'br' => 'Brazilian Portuguese',
'cn' => 'Chinese',
'de' => 'German',
'el' => 'Greek',
'en' => 'English',
'es' => 'Spanish',
'fr' => 'French',
'hi' => 'Hindi',
'he' => 'Hebrew',
'hu' => 'Hungarian',
'id' => 'Indonesian',
'it' => 'Italian',
'jp' => 'Japanese',
'mr' => 'Marathi',
'ms' => 'Malay (Bahasa Melayu)',
'nl' => 'Dutch',
'pl' => 'Polish',
'ro' => 'Romanian',
'ru' => 'Russian',
'tr' => 'Turkish',
'vn' => 'Vietnamese'
)));
ini_set('zend.ze1_compatibility_mode', false);  //php.ini此项配置是:如果要在PHP5上运行php4特定的程序,就要设置为true
require_once('../../shared/config/tce_paths.php');
require_once('../../shared/config/tce_general_constants.php');
define ('K_OTP_LOGIN', false);                  //如果这里设置为true,就表示需要用密码进行一次登录验证
define ('K_BRUTE_FORCE_DELAY_RATIO', 2);        //Ratio at which the delay will be increased after every failed login attempt
define ('K_QUESTION_DIFFICULTY_LEVELS', 10);    //Number of difficulty levels for questions.
define('K_ENABLE_VIRTUAL_KEYBOARD', true);      //If true enable virtual keyboard on some textarea fields
define ('K_TEST_INFO_HEIGHT', 400);             //Popup window height in pixels for test info.弹出窗口的高度,以像素为单位
define ('K_TEST_INFO_WIDTH', 700);              //弹出窗口的宽度,以像素为单位
define ('K_ANSWER_TEXTAREA_COLS', 70);          //Number of columns for answer textarea
define ('K_ANSWER_TEXTAREA_ROWS', 15);          //Number of rows for answer textarea
define ('K_ENABLE_QUESTION_EXPLANATION', true); //If true enable explanation field for questions
define ('K_ENABLE_ANSWER_EXPLANATION', true);   //If true enable explanation field for answers
define ('K_DISPLAY_TEST_DESCRIPTION', true);    //If true display test description before executing the test
define ('K_SHORT_ANSWERS_BINARY', false);       //If true compare short answers in binary mode
define ('K_SESSION_LIFE', K_SECONDS_IN_HOUR);   //User's session life time in seconds
/**
* When an alternate authentication method is used,
* if this constant is true the default user groups for the selected
* authentication method are always added to the user.
*/
define ('K_USER_GROUP_RSYNC', false);
define ('K_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');   //Define timestamp format using PHP notation (do not change)    定义php的时间显示格式(不要修改)
define ('K_QUESTION_LINE_MAX_LENGTH', 70);      //Define max line length in chars for question navigator on test execution interface
define ('K_CHECK_SESSION_FINGERPRINT', false);  //If true, check for possible session hijacking (set to false if you have login problems)
define ('K_STRONG_PASSWORD_ENCRYPTION', true);  //If true uses a strong encryption algorithm for passwords 使用一个强大的加密算法对密码进行加密
/**************************start 客户端cookie设置*******************************/
define ('K_COOKIE_DOMAIN', '');                 //Cookie domain
define ('K_COOKIE_PATH', '/');                  //Cookie path
define ('K_COOKIE_SECURE', false);              //If true use secure cookies
define ('K_COOKIE_EXPIRE', K_SECONDS_IN_DAY);   //Expiration time for cookies
/**
* Various pages redirection modes after login (valid values are 1, 2, 3 and 4).
* 1 = relative redirect.
* 2 = absolute redirect.
* 3 = html redirect.
* 4 = full redirect.
*/
define ('K_REDIRECT_LOGIN_MODE', 4);
define ('K_PASSWORD_RESET', TRUE);              //If true enable password reset feature
define ('K_LOGOUT_URL', '');                    //URL to be redirected at logout (leave empty for default),退出时url重定向
/********************************start 报错设置 **********************************/
define ('K_ERROR_TYPES', E_ALL | E_STRICT);     //定义错误调试类型
//define ('K_ERROR_TYPES', E_ERROR | E_WARNING | E_PARSE);
define ('K_USE_ERROR_LOG', false);              //Enable error logs (../log/tce_errors.log) 是否记录错误日志
define ('K_ENABLE_JSERRORS', false);            //是否在弹出框中显示错误提示
define ('K_TIMEZONE', 'UTC');                   //设置系统时区
define('K_EXTEND_TIME_MINUTES', 5);             //Default minutes used to extend test duration 默认分钟用来延长测试时间
require_once('../../shared/code/tce_functions_errmsg.php'); //引入错误处理文件
/********************************start 语言设置 *********************************/
if(isset($_REQUEST['lang']) AND (strlen($_REQUEST['lang']) == 2) AND (array_key_exists($_REQUEST['lang'],unserialize(K_AVAILABLE_LANGUAGES)))){ //用户自己选择语言操作
define ('K_USER_LANG', $_REQUEST['lang']);
setcookie('SessionUserLang', K_USER_LANG, time() + K_COOKIE_EXPIRE, K_COOKIE_PATH, K_COOKIE_DOMAIN, K_COOKIE_SECURE);   //在用户客户端给他生成语言cookie,记住他的选择
}
elseif (isset($_COOKIE['SessionUserLang'])  AND (strlen($_COOKIE['SessionUserLang']) == 2)  AND (array_key_exists($_COOKIE['SessionUserLang'],unserialize(K_AVAILABLE_LANGUAGES)))){    //读取cookie中用户选择的语言
define ('K_USER_LANG', $_COOKIE['SessionUserLang']);
}
else{                                           //否则就是用系统配置中“默认语言”
define ('K_USER_LANG', K_LANGUAGE);
}
/********************************start XML文件处理设置 *****************************/
require_once('../../shared/code/tce_tmx.php');
// istantiate new TMXResourceBundle object
$lang_resources = new TMXResourceBundle(K_PATH_TMX_FILE, K_USER_LANG, K_PATH_LANG_CACHE.basename(K_PATH_TMX_FILE, '.xml').'_'.K_USER_LANG.'.php');
$l = $lang_resources->getResource(); // language array
ini_set('arg_separator.output', '&');       //默认值:&    php能自动生成URL,并使用标准的&符号分隔输入变量。该配置可以更改此约定
//date_default_timezone_set(K_TIMEZONE);
/********************************start php版本设置 *********************************/
if(!defined('PHP_VERSION_ID')){
$version = PHP_VERSION;
define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4}));
}
if(PHP_VERSION_ID < 50300) {
@set_magic_quotes_runtime(false); //disable magic quotes
ini_set('magic_quotes_gpc', 'On');
ini_set('magic_quotes_runtime', 'Off');
ini_set('register_long_arrays', 'On');
//ini_set('register_globals', 'On');
}
// --- get 'post', 'get' and 'cookie' variables
/********************************start 对输入字符(包括cookie)字符串安全过滤 *********************************/
foreach ($_REQUEST as $postkey => $postvalue){
if (($postkey{0} != '_') AND (!preg_match('/[A-Z]/', $postkey{0}))) {
if (!get_magic_quotes_gpc() AND !is_array($postvalue)) {
// emulate magic_quotes_gpc
$postvalue = addslashes($postvalue);
$_REQUEST[$postkey] = $postvalue;
if(isset($_GET[$postkey])){
$_GET[$postkey] = $postvalue;
}
elseif(isset($_POST[$postkey])) {
$_POST[$postkey] = $postvalue;
}
elseif(isset($_COOKIE[$postkey])) {
$_COOKIE[$postkey] = $postvalue;
}
}
$$postkey = $postvalue;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息