1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| // global.inc.php
if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
require_once __DIR__.'/../../app/AppKernel.php';
$kernel = new AppKernel();
// Determine the directory path where this current file lies.
// This path will be useful to include the other initialisation files.
$includePath = __DIR__;
// Include the main Chamilo platform configuration file.
$alreadyInstalled = false;
if (file_exists($kernel->getConfigurationFile())) {
require_once $kernel->getConfigurationFile();
$alreadyInstalled = true;
} else {
$_configuration = array();
}
//Redirects to the main/install/ page
if (!$alreadyInstalled) {
$global_error_code = 2;
// The system has not been installed yet.
require $includePath.'/global_error_message.inc.php';
die();
}
// Ensure that _configuration is in the global scope before loading
// main_api.lib.php. This is particularly helpful for unit tests
if (!isset($GLOBALS['_configuration'])) {
$GLOBALS['_configuration'] = $_configuration;
}
// Include the main Chamilo platform library file.
require_once $includePath.'/lib/api.lib.php';
$passwordEncryption = api_get_configuration_value('password_encryption');
if ($passwordEncryption == 'bcrypt') {
require_once __DIR__.'/../../vendor/ircmaxell/password-compat/lib/password.php';
}
// Check the PHP version
api_check_php_version($includePath.'/');
// Specification for usernames:
// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
// 2. Empty username is formally valid, but it is reserved for the anonymous user.
// 3. Checking the login_is_email portal setting in order to accept 100 chars maximum
$defaultUserNameLength = 40;
if (api_get_setting('login_is_email') == 'true') {
$defaultUserNameLength = 100;
}
define('USERNAME_MAX_LENGTH', $defaultUserNameLength);
// Fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI'].
api_request_uri();
// Include the libraries that are necessary everywhere
require_once __DIR__.'/../../vendor/autoload.php';
// Do not over-use this variable. It is only for this script's local use.
$libraryPath = api_get_path(LIBRARY_PATH);
// @todo convert this libs in classes
require_once $libraryPath.'database.constants.inc.php'; |
Partager