2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
16 * constants, some more constants are loaded from table 'config' @ include/vitals.inc.php
19 /* config variables. if they're not in the db then it uses the installation default values: */
20 $_config_defaults = array();
21 $_config_defaults['site_name'] = '';
22 $_config_defaults['contact_email'] = '';
23 $_config_defaults['max_file_size'] = 10485760; // 10MB
24 $_config_defaults['max_course_size'] = 104857600; // 100 MB
25 $_config_defaults['max_file_size'] = 10485760; // 10MB
26 $_config_defaults['illegal_extentions'] = 'exe|asp|php|php3|bat|cgi|pl|com|vbs|reg|pcd|pif|scr|bas|inf|vb|vbe|wsc|wsf|wsh';
27 $_config_defaults['default_language'] = 'en';
28 $_config_defaults['use_captcha'] = 0; //use captcha?
29 $_config_defaults['latex_server'] = 'http://www.atutor.ca/cgi/mimetex.cgi?'; // the full URL to an external LaTeX parse
30 $_config_defaults['pref_defaults'] = 'a:1:{s:10:"PREF_THEME";s:7:"default";}';
31 $_config = $_config_defaults;
33 define('VERSION', '1.1');
35 define('UPDATE_SERVER', 'http://update.atutor.ca/acontent');
36 define('SVN_TAG_FOLDER', 'http://atutorsvn.atrc.utoronto.ca/repos/transformable2/tags/');
37 define('RESULTS_PER_PAGE', 15);
40 define('DEFAULT_LANGUAGE_CODE', 'en');
41 define('DEFAULT_CHARSET', 'utf-8');
42 define('TR_LANGUAGE_LOCALE_SEP', '-');
43 //$_config['default_language'] = DEFAULT_LANGUAGE_CODE;
46 define('TR_USER_GROUP_ADMIN', 1);
47 define('TR_USER_GROUP_USER', 2);
50 define('TR_STATUS_DISABLED', 0);
51 define('TR_STATUS_ENABLED', 1);
52 define('TR_STATUS_DEFAULT', 2);
53 define('TR_STATUS_UNCONFIRMED', 3);
56 define('TR_USERROLE_AUTHOR', 1);
57 define('TR_USERROLE_VIEWER', 2);
60 define('TR_PRIV_ISAUTHOR', 1);
61 define('TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE', 2);
62 define('TR_PRIV_IN_A_COURSE', 3);
65 define('TR_COURSESIZE_UNLIMITED', -1);
66 define('TR_COURSESIZE_DEFAULT', -2); /* can be changed in config.inc.php */
69 define('TR_COURSECATEGORY_UNCATEGORIZED', 0);
71 // the maximum length of the category name in category picker
72 define('TR_MAX_LAN_CATEGORY_NAME', 28);
75 define('CONTENT_TYPE_CONTENT', 0);
76 define('CONTENT_TYPE_FOLDER', 1);
77 define('CONTENT_TYPE_WEBLINK', 2);
79 /* ways of releasing a test */
80 //define('TR_RELEASE_NEVER', 0); // do not release
81 define('TR_RELEASE_IMMEDIATE', 1); // release after submitted
82 //define('TR_RELEASE_MARKED', 2); // release after all q's marked
84 define('TR_KBYTE_SIZE', 1024);
86 /* valid date format_types: */
87 /* @see ./include/lib/output.inc.php */
88 define('TR_DATE_MYSQL_DATETIME', 1); /* YYYY-MM-DD HH:MM:SS */
89 define('TR_DATE_MYSQL_TIMESTAMP_14', 2); /* YYYYMMDDHHMMSS */
90 define('TR_DATE_UNIX_TIMESTAMP', 3); /* seconds since epoch */
91 define('TR_DATE_INDEX_VALUE', 4); /* index to the date arrays */
93 function get_status_by_code($status_code)
95 if ($status_code == TR_STATUS_DISABLED)
96 return _AT('disabled');
97 else if ($status_code == TR_STATUS_ENABLED)
98 return _AT('enabled');
99 else if ($status_code == TR_STATUS_DEFAULT)
100 return _AT('default');
101 else if ($status_code == TR_STATUS_UNCONFIRMED)
102 return _AT('unconfirmed');
108 /* how many days until the password reminder link expires */
109 define('TR_PASSWORD_REMINDER_EXPIRY', 2);
111 /* how long cache objects can persist */
112 /* in seconds. should be low initially, but doesn't really matter. */
113 /* in practice should be 0 (ie. INF) */
114 define('CACHE_TIME_OUT', 60);
116 // separator used in composing URL
117 if (strpos(@ini_get('arg_separator.input'), ';') !== false) {
123 /* get the base url */
124 if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) {
125 $server_protocol = 'https://';
127 $server_protocol = 'http://';
130 $dir_deep = substr_count(TR_INCLUDE_PATH, '..');
131 $url_parts = explode('/', $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
132 $_base_href = array_slice($url_parts, 0, count($url_parts) - $dir_deep-1);
133 $_base_href = $server_protocol . implode('/', $_base_href).'/';
135 $endpos = strlen($_base_href);
137 $_base_href = substr($_base_href, 0, $endpos);
138 $_base_path = substr($_base_href, strlen($server_protocol . $_SERVER['HTTP_HOST']));
140 define('TR_BASE_HREF', $_base_href);
141 define('TR_GUIDES_PATH', $_base_path . 'documentation/');
143 // third party URL for web accessibility validation
144 define('TR_ACHECKER_URL', 'http://www.achecker.ca/');
145 define('TR_ACHECKER_WEB_SERVICE_ID', '2f4149673d93b7f37eb27506905f19d63fbdfe2d');
148 $_rel_url = '/'.implode('/', array_slice($url_parts, count($url_parts) - $dir_deep-1));