global.inc.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * It is recommended that ALL Chamilo scripts include this important file.
  5. * This script manages
  6. * - http get, post, post_files, session, server-vars extraction into global namespace;
  7. * (which doesn't occur anymore when servertype config setting is set to test,
  8. * and which will disappear completely in Dokeos 1.6.1)
  9. * - include of /conf/configuration.php;
  10. * - include of several libraries: main_api, database, display, text, security;
  11. * - selecting the main database;
  12. * - include of language files.
  13. *
  14. * @package chamilo.include
  15. * @todo isn't configuration.php renamed to configuration.inc.php yet?
  16. * @todo use the $_configuration array for all the needed variables
  17. * @todo remove the code that displays the button that links to the install page
  18. * but use a redirect immediately. By doing so the $alreadyInstalled variable can be removed.
  19. * @todo make it possible to enable / disable the tracking through the Chamilo config page.
  20. *
  21. */
  22. // Showing/hiding error codes in global error messages.
  23. define('SHOW_ERROR_CODES', false);
  24. // Include the libraries that are necessary everywhere
  25. require_once __DIR__.'/../../vendor/autoload.php';
  26. require_once __DIR__.'/../../app/AppKernel.php';
  27. $kernel = new AppKernel('', '');
  28. // Determine the directory path where this current file lies.
  29. // This path will be useful to include the other initialisation files.
  30. $includePath = __DIR__;
  31. // Include the main Chamilo platform configuration file.
  32. $alreadyInstalled = false;
  33. if (file_exists($kernel->getConfigurationFile())) {
  34. require_once $kernel->getConfigurationFile();
  35. $alreadyInstalled = true;
  36. // Recalculate a system absolute path symlinks insensible.
  37. $includePath = $_configuration['root_sys'].'main/inc/';
  38. } else {
  39. $_configuration = array();
  40. //Redirects to the main/install/ page
  41. if (!$alreadyInstalled) {
  42. $global_error_code = 2;
  43. // The system has not been installed yet.
  44. require_once __DIR__ . '/../inc/global_error_message.inc.php';
  45. die();
  46. }
  47. }
  48. // Ensure that _configuration is in the global scope before loading
  49. // main_api.lib.php. This is particularly helpful for unit tests
  50. if (!isset($GLOBALS['_configuration'])) {
  51. $GLOBALS['_configuration'] = $_configuration;
  52. }
  53. // Include the main Chamilo platform library file.
  54. require_once $_configuration['root_sys'].'main/inc/lib/api.lib.php';
  55. $passwordEncryption = api_get_configuration_value('password_encryption');
  56. if ($passwordEncryption == 'bcrypt') {
  57. require_once __DIR__.'/../../vendor/ircmaxell/password-compat/lib/password.php';
  58. }
  59. // Check the PHP version
  60. api_check_php_version($includePath.'/');
  61. // Specification for usernames:
  62. // 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
  63. // 2. Empty username is formally valid, but it is reserved for the anonymous user.
  64. // 3. Checking the login_is_email portal setting in order to accept 100 chars maximum
  65. $defaultUserNameLength = 40;
  66. if (api_get_setting('login_is_email') == 'true') {
  67. $defaultUserNameLength = 100;
  68. }
  69. define('USERNAME_MAX_LENGTH', $defaultUserNameLength);
  70. // Fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI'].
  71. api_request_uri();
  72. define('_MPDF_TEMP_PATH', __DIR__.'/../../app/cache/mpdf/');
  73. define('_MPDF_TTFONTDATAPATH', __DIR__.'/../../app/cache/mpdf/');
  74. // Include the libraries that are necessary everywhere
  75. require_once __DIR__.'/../../vendor/autoload.php';
  76. // Do not over-use this variable. It is only for this script's local use.
  77. $libraryPath = api_get_path(LIBRARY_PATH);
  78. // @todo convert this libs in classes
  79. require_once $libraryPath.'database.constants.inc.php';
  80. require_once $libraryPath.'text.lib.php';
  81. require_once $libraryPath.'array.lib.php';
  82. require_once $libraryPath.'online.inc.php';
  83. require_once $libraryPath.'banner.lib.php';
  84. require_once $libraryPath.'fileManage.lib.php';
  85. require_once $libraryPath.'fileUpload.lib.php';
  86. require_once $libraryPath.'fileDisplay.lib.php';
  87. require_once $libraryPath.'course_category.lib.php';
  88. if (!is_dir(_MPDF_TEMP_PATH)) {
  89. mkdir(_MPDF_TEMP_PATH, api_get_permissions_for_new_directories(), true);
  90. }
  91. // Connect to the server database and select the main chamilo database.
  92. // When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
  93. /*$dbPersistConnection = api_get_configuration_value('db_persistent_connection');
  94. // $_configuration['db_client_flags'] can be set in configuration.php to pass
  95. // flags to the DB connection
  96. $dbFlags = api_get_configuration_value('db_client_flags');
  97. $params = array(
  98. 'server' => $_configuration['db_host'],
  99. 'username' => $_configuration['db_user'],
  100. 'password' => $_configuration['db_password'],
  101. 'persistent' => $dbPersistConnection,
  102. 'client_flags' => $dbFlags,
  103. );*/
  104. // Doctrine ORM configuration
  105. $dbParams = array(
  106. 'driver' => 'pdo_mysql',
  107. 'host' => $_configuration['db_host'],
  108. 'user' => $_configuration['db_user'],
  109. 'password' => $_configuration['db_password'],
  110. 'dbname' => $_configuration['main_database'],
  111. // Only relevant for pdo_sqlite, specifies the path to the SQLite database.
  112. 'path' => isset($_configuration['db_path']) ? $_configuration['db_path'] : '',
  113. // Only relevant for pdo_mysql, pdo_pgsql, and pdo_oci/oci8,
  114. 'port' => isset($_configuration['db_port']) ? $_configuration['db_port'] : ''
  115. );
  116. try {
  117. $database = new \Database();
  118. $database->connect($dbParams);
  119. } catch (Exception $e) {
  120. $global_error_code = 3;
  121. // The database server is not available or credentials are invalid.
  122. require $includePath.'/global_error_message.inc.php';
  123. die();
  124. }
  125. /* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/
  126. if (!empty($_configuration['multiple_access_urls'])) {
  127. $_configuration['access_url'] = 1;
  128. $access_urls = api_get_access_urls();
  129. $root_rel = api_get_self();
  130. $root_rel = substr($root_rel, 1);
  131. $pos = strpos($root_rel, '/');
  132. $root_rel = substr($root_rel, 0, $pos);
  133. $protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
  134. //urls with subdomains (HTTP_HOST is preferred - see #6764)
  135. $request_url_root = '';
  136. if (empty($_SERVER['HTTP_HOST'])) {
  137. if (empty($_SERVER['SERVER_NAME'])) {
  138. $request_url_root = $protocol . 'localhost/';
  139. } else {
  140. $request_url_root = $protocol . $_SERVER['SERVER_NAME'] . '/';
  141. }
  142. } else {
  143. $request_url_root = $protocol.$_SERVER['HTTP_HOST'].'/';
  144. }
  145. //urls with subdirs
  146. $request_url_sub = $request_url_root.$root_rel.'/';
  147. // You can use subdirs as multi-urls, but in this case none of them can be
  148. // the root dir. The admin portal should be something like https://host/adm/
  149. // At this time, subdirs will still hold a share cookie, so not ideal yet
  150. // see #6510
  151. foreach ($access_urls as $details) {
  152. if ($request_url_sub == $details['url']) {
  153. $_configuration['access_url'] = $details['id'];
  154. break; //found one match with subdir, get out of foreach
  155. }
  156. // Didn't find any? Now try without subdirs
  157. if ($request_url_root == $details['url']) {
  158. $_configuration['access_url'] = $details['id'];
  159. break; //found one match, get out of foreach
  160. }
  161. }
  162. } else {
  163. $_configuration['access_url'] = 1;
  164. }
  165. $charset = 'UTF-8';
  166. // Enables the portablity layer and configures PHP for UTF-8
  167. \Patchwork\Utf8\Bootup::initAll();
  168. // Start session after the internationalization library has been initialized.
  169. ChamiloSession::instance()->start($alreadyInstalled);
  170. // Remove quotes added by PHP - get_magic_quotes_gpc() is deprecated in PHP 5 see #2970
  171. if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
  172. array_walk_recursive_limited($_GET, 'stripslashes', true);
  173. array_walk_recursive_limited($_POST, 'stripslashes', true);
  174. array_walk_recursive_limited($_COOKIE, 'stripslashes', true);
  175. array_walk_recursive_limited($_REQUEST, 'stripslashes', true);
  176. }
  177. // access_url == 1 is the default chamilo location
  178. if ($_configuration['access_url'] != 1) {
  179. $url_info = api_get_access_url($_configuration['access_url']);
  180. if ($url_info['active'] == 1) {
  181. $settings_by_access = & api_get_settings(null, 'list', $_configuration['access_url'], 1);
  182. foreach ($settings_by_access as & $row) {
  183. if (empty($row['variable'])) {
  184. $row['variable'] = 0;
  185. }
  186. if (empty($row['subkey'])) {
  187. $row['subkey'] = 0;
  188. }
  189. if (empty($row['category'])) {
  190. $row['category'] = 0;
  191. }
  192. $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
  193. }
  194. }
  195. }
  196. $result = & api_get_settings(null, 'list', 1);
  197. foreach ($result as & $row) {
  198. if ($_configuration['access_url'] != 1) {
  199. if ($url_info['active'] == 1) {
  200. $var = empty($row['variable']) ? 0 : $row['variable'];
  201. $subkey = empty($row['subkey']) ? 0 : $row['subkey'];
  202. $category = empty($row['category']) ? 0 : $row['category'];
  203. }
  204. if ($row['access_url_changeable'] == 1 && $url_info['active'] == 1) {
  205. if (isset($settings_by_access_list[$var]) &&
  206. $settings_by_access_list[$var][$subkey][$category]['selected_value'] != '') {
  207. if ($row['subkey'] == null) {
  208. $_setting[$row['variable']] = $settings_by_access_list[$var][$subkey][$category]['selected_value'];
  209. } else {
  210. $_setting[$row['variable']][$row['subkey']] = $settings_by_access_list[$var][$subkey][$category]['selected_value'];
  211. }
  212. } else {
  213. if ($row['subkey'] == null) {
  214. $_setting[$row['variable']] = $row['selected_value'];
  215. } else {
  216. $_setting[$row['variable']][$row['subkey']] = $row['selected_value'];
  217. }
  218. }
  219. } else {
  220. if ($row['subkey'] == null) {
  221. $_setting[$row['variable']] = $row['selected_value'];
  222. } else {
  223. $_setting[$row['variable']][$row['subkey']] = $row['selected_value'];
  224. }
  225. }
  226. } else {
  227. if ($row['subkey'] == null) {
  228. $_setting[$row['variable']] = $row['selected_value'];
  229. } else {
  230. $_setting[$row['variable']][$row['subkey']] = $row['selected_value'];
  231. }
  232. }
  233. }
  234. $result = & api_get_settings('Plugins', 'list', $_configuration['access_url']);
  235. $_plugins = array();
  236. foreach ($result as & $row) {
  237. $key = & $row['variable'];
  238. if (is_string($_setting[$key])) {
  239. $_setting[$key] = array();
  240. }
  241. $_setting[$key][] = $row['selected_value'];
  242. $_plugins[$key][] = $row['selected_value'];
  243. }
  244. // Error reporting settings.
  245. if (api_get_setting('server_type') == 'test') {
  246. ini_set('display_errors', '1');
  247. ini_set('log_errors', '1');
  248. error_reporting(-1);
  249. } else {
  250. error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
  251. }
  252. // Load allowed tag definitions for kses and/or HTMLPurifier.
  253. require_once $libraryPath.'formvalidator/Rule/allowed_tags.inc.php';
  254. // Before we call local.inc.php, let's define a global $this_section variable
  255. // which will then be usable from the banner and header scripts
  256. $this_section = SECTION_GLOBAL;
  257. // Include Chamilo Mail conf this is added here because the api_get_setting works
  258. // Fixes bug in Chamilo 1.8.7.1 array was not set
  259. $administrator['email'] = isset($administrator['email']) ? $administrator['email'] : 'admin@example.com';
  260. $administrator['name'] = isset($administrator['name']) ? $administrator['name'] : 'Admin';
  261. // Including configuration files
  262. $configurationFiles = array(
  263. 'mail.conf.php',
  264. 'profile.conf.php',
  265. 'course_info.conf.php',
  266. 'add_course.conf.php',
  267. 'events.conf.php',
  268. 'auth.conf.php',
  269. 'portfolio.conf.php'
  270. );
  271. foreach ($configurationFiles as $file) {
  272. $file = api_get_path(CONFIGURATION_PATH).$file;
  273. if (file_exists($file)) {
  274. require_once $file;
  275. }
  276. }
  277. /* LOAD LANGUAGE FILES SECTION */
  278. // if we use the javascript version (without go button) we receive a get
  279. // if we use the non-javascript version (with the go button) we receive a post
  280. $user_language = '';
  281. $browser_language = '';
  282. // see #8149
  283. if (!empty($_SESSION['user_language_choice'])) {
  284. $user_language = $_SESSION['user_language_choice'];
  285. }
  286. if (!empty($_GET['language'])) {
  287. $user_language = $_GET['language'];
  288. }
  289. if (!empty($_POST['language_list'])) {
  290. $user_language = str_replace('index.php?language=', '', $_POST['language_list']);
  291. }
  292. if (empty($user_language) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !isset($_SESSION['_user'])) {
  293. $l = SubLanguageManager::getLanguageFromBrowserPreference($_SERVER['HTTP_ACCEPT_LANGUAGE']);
  294. if (!empty($l)) {
  295. $user_language = $browser_language = $l;
  296. }
  297. }
  298. // Include all files (first english and then current interface language)
  299. $langpath = api_get_path(SYS_LANG_PATH);
  300. /* This will only work if we are in the page to edit a sub_language */
  301. if (isset($this_script) && $this_script == 'sub_language') {
  302. // getting the arrays of files i.e notification, trad4all, etc
  303. $language_files_to_load = SubLanguageManager:: get_lang_folder_files_list(
  304. api_get_path(SYS_LANG_PATH).'english',
  305. true
  306. );
  307. //getting parent info
  308. $parent_language = SubLanguageManager::get_all_information_of_language($_REQUEST['id']);
  309. //getting sub language info
  310. $sub_language = SubLanguageManager::get_all_information_of_language($_REQUEST['sub_language_id']);
  311. $english_language_array = $parent_language_array = $sub_language_array = array();
  312. foreach ($language_files_to_load as $language_file_item) {
  313. $lang_list_pre = array_keys($GLOBALS);
  314. //loading english
  315. $path = $langpath.'english/'.$language_file_item.'.inc.php';
  316. if (file_exists($path)) {
  317. include $path;
  318. }
  319. $lang_list_post = array_keys($GLOBALS);
  320. $lang_list_result = array_diff($lang_list_post, $lang_list_pre);
  321. unset($lang_list_pre);
  322. // english language array
  323. $english_language_array[$language_file_item] = compact($lang_list_result);
  324. //cleaning the variables
  325. foreach ($lang_list_result as $item) {
  326. unset(${$item});
  327. }
  328. $parent_file = $langpath.$parent_language['dokeos_folder'].'/'.$language_file_item.'.inc.php';
  329. if (file_exists($parent_file) && is_file($parent_file)) {
  330. include_once $parent_file;
  331. }
  332. // parent language array
  333. $parent_language_array[$language_file_item] = compact($lang_list_result);
  334. //cleaning the variables
  335. foreach ($lang_list_result as $item) {
  336. unset(${$item});
  337. }
  338. $sub_file = $langpath.$sub_language['dokeos_folder'].'/'.$language_file_item.'.inc.php';
  339. if (file_exists($sub_file) && is_file($sub_file)) {
  340. include $sub_file;
  341. }
  342. // sub language array
  343. $sub_language_array[$language_file_item] = compact($lang_list_result);
  344. //cleaning the variables
  345. foreach ($lang_list_result as $item) {
  346. unset(${$item});
  347. }
  348. }
  349. }
  350. // Checking if we have a valid language. If not we set it to the platform language.
  351. $valid_languages = api_get_languages();
  352. if (!empty($valid_languages)) {
  353. if (!in_array($user_language, $valid_languages['folder'])) {
  354. $user_language = api_get_setting('platformLanguage');
  355. }
  356. $language_priority1 = api_get_setting('languagePriority1');
  357. $language_priority2 = api_get_setting('languagePriority2');
  358. $language_priority3 = api_get_setting('languagePriority3');
  359. $language_priority4 = api_get_setting('languagePriority4');
  360. if (isset($_GET['language']) ||
  361. (isset($_POST['language_list']) && !empty($_POST['language_list'])) ||
  362. !empty($browser_language)
  363. ) {
  364. $user_selected_language = $user_language; // $_GET['language']; or HTTP_ACCEPT_LANGUAGE
  365. $_SESSION['user_language_choice'] = $user_selected_language;
  366. $platformLanguage = $user_selected_language;
  367. }
  368. if (!empty($language_priority4) && api_get_language_from_type($language_priority4) !== false) {
  369. $language_interface = api_get_language_from_type($language_priority4);
  370. } else {
  371. $language_interface = api_get_setting('platformLanguage');
  372. }
  373. if (!empty($language_priority3) && api_get_language_from_type($language_priority3) !== false) {
  374. $language_interface = api_get_language_from_type($language_priority3);
  375. } else {
  376. if (isset($_SESSION['user_language_choice'])) {
  377. $language_interface = $_SESSION['user_language_choice'];
  378. }
  379. }
  380. if (!empty($language_priority2) && api_get_language_from_type($language_priority2) !== false) {
  381. $language_interface = api_get_language_from_type($language_priority2);
  382. } else {
  383. if (isset($_user['language'])) {
  384. $language_interface = $_user['language'];
  385. }
  386. }
  387. if (!empty($language_priority1) && api_get_language_from_type($language_priority1) !== false) {
  388. $language_interface = api_get_language_from_type($language_priority1);
  389. } else {
  390. if (isset($_course['language'])) {
  391. $language_interface = $_course['language'];
  392. }
  393. }
  394. // If language is set via browser ignore the priority
  395. if (isset($_GET['language'])) {
  396. $language_interface = $user_language;
  397. }
  398. }
  399. // Sometimes the variable $language_interface is changed
  400. // temporarily for achieving translation in different language.
  401. // We need to save the genuine value of this variable and
  402. // to use it within the function get_lang(...).
  403. $language_interface_initial_value = $language_interface;
  404. /**
  405. * Include the trad4all language file
  406. */
  407. // if the sub-language feature is on
  408. $parent_path = SubLanguageManager::get_parent_language_path($language_interface);
  409. if (!empty($parent_path)) {
  410. // include English
  411. include $langpath.'english/trad4all.inc.php';
  412. // prepare string for current language and its parent
  413. $lang_file = $langpath.$language_interface.'/trad4all.inc.php';
  414. $parent_lang_file = $langpath.$parent_path.'/trad4all.inc.php';
  415. // load the parent language file first
  416. if (file_exists($parent_lang_file)) {
  417. include $parent_lang_file;
  418. }
  419. // overwrite the parent language translations if there is a child
  420. if (file_exists($lang_file)) {
  421. include $lang_file;
  422. }
  423. } else {
  424. // if the sub-languages feature is not on, then just load the
  425. // set language interface
  426. // include English
  427. include $langpath.'english/trad4all.inc.php';
  428. // prepare string for current language
  429. $langfile = $langpath.$language_interface.'/trad4all.inc.php';
  430. if (file_exists($langfile)) {
  431. include $langfile;
  432. }
  433. }
  434. // include the local (contextual) parameters of this course or section
  435. require $includePath.'/local.inc.php';
  436. // The global variable $text_dir has been defined in the language file trad4all.inc.php.
  437. // For determining text direction correspondent to the current language
  438. // we use now information from the internationalization library.
  439. $text_dir = api_get_text_direction();
  440. // ===== "who is logged in?" module section =====
  441. // check and modify the date of user in the track.e.online table
  442. if (!$x = strpos($_SERVER['PHP_SELF'], 'whoisonline.php')) {
  443. preventMultipleLogin($_user["user_id"]);
  444. LoginCheck(isset($_user['user_id']) ? $_user['user_id'] : '');
  445. }
  446. // ===== end "who is logged in?" module section =====
  447. //Update of the logout_date field in the table track_e_login
  448. // (needed for the calculation of the total connection time)
  449. if (!isset($_SESSION['login_as']) && isset($_user)) {
  450. // if $_SESSION['login_as'] is set, then the user is an admin logged as the user
  451. $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
  452. $sql = "SELECT login_id, login_date
  453. FROM $tbl_track_login
  454. WHERE
  455. login_user_id='".$_user["user_id"]."'
  456. ORDER BY login_date DESC
  457. LIMIT 0,1";
  458. $q_last_connection = Database::query($sql);
  459. if (Database::num_rows($q_last_connection) > 0) {
  460. $i_id_last_connection = Database::result($q_last_connection, 0, 'login_id');
  461. // is the latest logout_date still relevant?
  462. $sql = "SELECT logout_date FROM $tbl_track_login
  463. WHERE login_id = $i_id_last_connection";
  464. $q_logout_date = Database::query($sql);
  465. $res_logout_date = convert_sql_date(Database::result($q_logout_date, 0, 'logout_date'));
  466. if ($res_logout_date < time() - $_configuration['session_lifetime']) {
  467. // it isn't, we should create a fresh entry
  468. Event::event_login($_user['user_id']);
  469. // now that it's created, we can get its ID and carry on
  470. $i_id_last_connection = Database::result($q_last_connection, 0, 'login_id');
  471. }
  472. $now = api_get_utc_datetime(time());
  473. $sql = "UPDATE $tbl_track_login SET logout_date = '$now'
  474. WHERE login_id='$i_id_last_connection'";
  475. Database::query($sql);
  476. $tableUser = Database::get_main_table(TABLE_MAIN_USER);
  477. $sql = "UPDATE $tableUser SET last_login = '$now'
  478. WHERE user_id = ".$_user["user_id"];
  479. Database::query($sql);
  480. }
  481. }
  482. // Add language_measure_frequency to your main/inc/conf/configuration.php in
  483. // order to generate language variables frequency measurements (you can then
  484. // see them through main/cron/lang/langstats.php)
  485. // The langstat object will then be used in the get_lang() function.
  486. // This block can be removed to speed things up a bit as it should only ever
  487. // be used in development versions.
  488. if (isset($_configuration['language_measure_frequency']) &&
  489. $_configuration['language_measure_frequency'] == 1
  490. ) {
  491. require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
  492. $langstats = new langstats();
  493. }
  494. //Default quota for the course documents folder
  495. $default_quota = api_get_setting('default_document_quotum');
  496. //Just in case the setting is not correctly set
  497. if (empty($default_quota)) {
  498. $default_quota = 100000000;
  499. }
  500. define('DEFAULT_DOCUMENT_QUOTA', $default_quota);
  501. // Sets the ascii_math plugin see #7134
  502. $_SESSION['ascii_math_loaded'] = false;