';
}
if (empty($installationProfile)) {
$installationProfile = '';
if (!empty($_POST['installationProfile'])) {
$installationProfile = api_htmlentities($_POST['installationProfile']);
}
}
?>
getManager();
$tmp = get_config_param_from_db('platformLanguage');
if (!empty($tmp)) {
$languageForm = $tmp;
}
$tmp = get_config_param_from_db('emailAdministrator');
if (!empty($tmp)) {
$emailForm = $tmp;
}
$tmp = get_config_param_from_db('administratorName');
if (!empty($tmp)) {
$adminFirstName = $tmp;
}
$tmp = get_config_param_from_db('administratorSurname');
if (!empty($tmp)) {
$adminLastName = $tmp;
}
$tmp = get_config_param_from_db('administratorTelephone');
if (!empty($tmp)) {
$adminPhoneForm = $tmp;
}
$tmp = get_config_param_from_db('siteName');
if (!empty($tmp)) {
$campusForm = $tmp;
}
$tmp = get_config_param_from_db('Institution');
if (!empty($tmp)) {
$institutionForm = $tmp;
}
$tmp = get_config_param_from_db('InstitutionUrl');
if (!empty($tmp)) {
$institutionUrlForm = $tmp;
}
// For version 1.9
$urlForm = $_configuration['root_web'];
$encryptPassForm = get_config_param('password_encryption');
// Managing the $encryptPassForm
if ($encryptPassForm == '1') {
$encryptPassForm = 'sha1';
} elseif ($encryptPassForm == '0') {
$encryptPassForm = 'none';
}
$allowSelfReg = 'approval';
$tmp = get_config_param_from_db('allow_registration');
if (!empty($tmp)) {
$allowSelfReg = $tmp;
}
$allowSelfRegProf = false;
$tmp = get_config_param_from_db('allow_registration_as_teacher');
if (!empty($tmp)) {
$allowSelfRegProf = $tmp;
}
}
display_configuration_settings_form(
$installType,
$urlForm,
$languageForm,
$emailForm,
$adminFirstName,
$adminLastName,
$adminPhoneForm,
$campusForm,
$institutionForm,
$institutionUrlForm,
$encryptPassForm,
$allowSelfReg,
$allowSelfRegProf,
$loginForm,
$passForm
);
} elseif (@$_POST['step5']) {
//STEP 6 : LAST CHECK BEFORE INSTALL?>
'.$loginForm.'
';
echo get_lang('AdminPass').' :
'.$passForm.''; /* TODO: Maybe this password should be hidden too? */
}
$allowSelfRegistrationLiteral = ($allowSelfReg == 'true') ? get_lang('Yes') : ($allowSelfReg == 'approval' ? get_lang('Approval') : get_lang('No'));
echo get_lang('AdminFirstName').' : '.$adminFirstName, '
', get_lang('AdminLastName').' : '.$adminLastName, '
';
echo get_lang('AdminEmail').' : '.$emailForm; ?>
'.$dbNameForm; ?>
'.get_lang(
'Warning'
).''.get_lang('TheInstallScriptWillEraseAllTables'),
'warning',
false
);
} ?>
'.display_step_sequence().$msg.'
';
if (!empty($installationProfile)) {
echo '
('.$installationProfile.')
';
}
echo '
'.get_lang('PleaseWaitThisCouldTakeAWhile').'
';
// Push the web server to send these strings before we start the real
// installation process
flush();
$f = ob_get_contents();
if (!empty($f)) {
ob_flush(); //#5565
}
if ($installType == 'update') {
$database = connectToDatabase(
$dbHostForm,
$dbUsernameForm,
$dbPassForm,
$dbNameForm,
$dbPortForm
);
$manager = $database->getManager();
$perm = api_get_permissions_for_new_directories();
$perm_file = api_get_permissions_for_new_files();
migrateSwitch($my_old_version, $manager);
} else {
set_file_folder_permissions();
$database = connectToDatabase(
$dbHostForm,
$dbUsernameForm,
$dbPassForm,
null,
$dbPortForm
);
$manager = $database->getManager();
$dbNameForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbNameForm);
// Drop and create the database anyways
$manager->getConnection()->getSchemaManager()->dropAndCreateDatabase($dbNameForm);
$database = connectToDatabase(
$dbHostForm,
$dbUsernameForm,
$dbPassForm,
$dbNameForm,
$dbPortForm
);
$manager = $database->getManager();
$sql = getVersionTable();
$manager->getConnection()->executeQuery($sql);
$envFile = api_get_path(SYS_PATH).'.env';
$params = [
'{{DATABASE_HOST}}' => $dbHostForm,
'{{DATABASE_PORT}}' => $dbPortForm,
'{{DATABASE_NAME}}' => $dbNameForm,
'{{DATABASE_USER}}' => $dbUsernameForm,
'{{DATABASE_PASSWORD}}' => $dbPassForm,
'{{APP_INSTALLED}}' => 1,
'{{APP_ENCRYPT_METHOD}}' => $encryptPassForm
];
updateEnvFile($envFile, $params);
(new Dotenv())->load($envFile);
$kernel = new Kernel('dev', true);
$application = new Application($kernel);
$input = new \Symfony\Component\Console\Input\ArrayInput([]);
$command = $application->find('doctrine:schema:create');
$result = $command->run($input, new ConsoleOutput());
// No errors
if ($result == 0) {
$kernel->boot();
$doctrine = $kernel->getContainer()->get('doctrine');
$manager = $doctrine->getManager();
$sysPath = api_get_path(SYS_PATH);
finishInstallation(
$manager,
$sysPath,
$encryptPassForm,
$passForm,
$adminLastName,
$adminFirstName,
$loginForm,
$emailForm,
$adminPhoneForm,
$languageForm,
$institutionForm,
$institutionUrlForm,
$campusForm,
$allowSelfReg,
$allowSelfRegProf,
$installationProfile
);
include 'install_files.inc.php';
}
}
display_after_install_message($installType);
// Hide the "please wait" message sent previously
echo '';
} elseif (@$_POST['step1'] || $badUpdatePath) {
//STEP 1 : REQUIREMENTS
//make sure that proposed path is set, shouldn't be necessary but...
if (empty($proposedUpdatePath)) {
$proposedUpdatePath = $_POST['updatePath'];
}
display_requirements($installType, $badUpdatePath, $proposedUpdatePath, $update_from_version_8);
} else {
// This is the start screen.
display_language_selection();
if (!empty($_GET['profile'])) {
$installationProfile = api_htmlentities($_GET['profile'], ENT_QUOTES);
}
echo '
';
}
$poweredBy = 'Powered by
Chamilo © '.date('Y');
?>