* The aim is, as always, to have good default settings and suggestions. * * @todo reduce high level of duplication in this code * @todo (busy) organise code into functions * @package chamilo.install */ use ChamiloSession as Session; require_once __DIR__ . '/../../vendor/autoload.php'; define('SYSTEM_INSTALLATION', 1); define('INSTALL_TYPE_UPDATE', 'update'); define('FORM_FIELD_DISPLAY_LENGTH', 40); define('DATABASE_FORM_FIELD_DISPLAY_LENGTH', 25); define('MAX_FORM_FIELD_LENGTH', 80); // Including necessary libraries. require_once '../inc/lib/api.lib.php'; api_check_php_version('../inc/'); /* INITIALIZATION SECTION */ ob_implicit_flush(true); session_start(); require_once api_get_path(LIBRARY_PATH) . 'database.constants.inc.php'; require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'; require_once 'install.lib.php'; // The function api_get_setting() might be called within the installation scripts. // We need to provide some limited support for it through initialization of the // global array-type variable $_setting. $_setting = array('platform_charset' => 'UTF-8', 'server_type' => 'production', 'permissions_for_new_directories' => '0770', 'permissions_for_new_files' => '0660', 'stylesheets' => 'chamilo'); // Determination of the language during the installation procedure. if (!empty($_POST['language_list'])) { $search = array('../', '\\0'); $install_language = str_replace($search, '', urldecode($_POST['language_list'])); Session::write('install_language', $install_language);
foreach ($helpers as $name => $helper) { $helperSet->set($helper, $name); } $blockInstallation = function () use($app) { if (file_exists($app['root_sys'] . 'config/configuration.php') || file_exists($app['root_sys'] . 'config/configuration.yml')) { return $app->abort(500, "A Chamilo installation was found. You can't reinstall."); } $defaultTimeZone = ini_get('date.timezone'); if (empty($defaultTimeZone)) { $app->abort(500, "Please set your 'date.timezone' setting in your php.ini file"); } // Check the PHP version. if (api_check_php_version() == false) { $app->abort(500, "Incorrect PHP version."); } if (api_check_php_version() == false) { $app->abort(500, "Incorrect PHP version."); } // @todo move this in the req page if (extension_loaded('json') == false) { $app->abort(500, "php5-json extension must be installed."); } }; // Controllers $app->match('/', function () use($app) { // in order to get a list of countries //var_dump(Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()); $languages = array('english' => 'english', 'spanish' => 'spanish', 'french' => 'french'); $request = $app['request']; $form = $app['form.factory']->createBuilder('form')->add('languages', 'choice', array('choices' => $languages, 'required' => true))->add('continue', 'submit', array('attr' => array('class' => 'btn')))->getForm(); if ('POST' == $request->getMethod()) {
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('profile.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);