b5d58dba62ca3f396a929817a4db45b9e1e9b16d
[acontent.git] / docs / include / constants.inc.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 /************************************************************************/
12
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14
15 /**
16  * constants, some more constants are loaded from table 'config' @ include/vitals.inc.php
17  **/
18
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;
32
33 define('VERSION',               '1.0');
34
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);
38
39 // language constants
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;
44
45 // User group type
46 define('TR_USER_GROUP_ADMIN', 1);
47 define('TR_USER_GROUP_USER', 2);
48
49 // User status
50 define('TR_STATUS_DISABLED', 0);
51 define('TR_STATUS_ENABLED', 1);
52 define('TR_STATUS_DEFAULT', 2);
53 define('TR_STATUS_UNCONFIRMED', 3);
54
55 // User role
56 define('TR_USERROLE_AUTHOR', 1);
57 define('TR_USERROLE_VIEWER', 2);
58
59 // User privilege
60 define('TR_PRIV_ISAUTHOR', 1);
61 define('TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE', 2);
62 define('TR_PRIV_IN_A_COURSE', 3);
63
64 // course size
65 define('TR_COURSESIZE_UNLIMITED',          -1); 
66 define('TR_COURSESIZE_DEFAULT',            -2);  /* can be changed in config.inc.php */
67
68 // course category
69 define('TR_COURSECATEGORY_UNCATEGORIZED',   0); 
70
71 // the maximum length of the category name in category picker
72 define('TR_MAX_LAN_CATEGORY_NAME', 28);
73
74 // content type
75 define('CONTENT_TYPE_CONTENT',  0);
76 define('CONTENT_TYPE_FOLDER', 1);
77 define('CONTENT_TYPE_WEBLINK', 2);
78
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
83
84 define('TR_KBYTE_SIZE', 1024);
85
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 */
92
93 function get_status_by_code($status_code)
94 {
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');
103         else
104                 return '';
105 }
106
107 /* User status */
108 /* how many days until the password reminder link expires */
109 define('TR_PASSWORD_REMINDER_EXPIRY', 2);
110
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);
115
116 // separator used in composing URL
117 if (strpos(@ini_get('arg_separator.input'), ';') !== false) {
118         define('SEP', ';');
119 } else {
120         define('SEP', '&');
121 }
122
123 /* get the base url     */
124 if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) {
125         $server_protocol = 'https://';
126 } else {
127         $server_protocol = 'http://';
128 }
129
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).'/';
134
135 $endpos = strlen($_base_href); 
136
137 $_base_href      = substr($_base_href, 0, $endpos);
138 $_base_path  = substr($_base_href, strlen($server_protocol . $_SERVER['HTTP_HOST']));
139
140 define('TR_BASE_HREF', $_base_href);
141 define('TR_GUIDES_PATH', $_base_path . 'documentation/');
142
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');
146
147 /* relative uri */
148 $_rel_url = '/'.implode('/', array_slice($url_parts, count($url_parts) - $dir_deep-1));
149
150 ?>