skala
Yannick Warnier 16 years ago
commit efa71972d8
  1. 1
      main/inc/lib/database.lib.php
  2. 45
      main/inc/lib/internationalization.lib.php
  3. 39
      main/inc/lib/internationalization_internal.lib.php
  4. 10
      main/inc/lib/main_api.lib.php
  5. 60
      main/install/index.php
  6. 62
      main/install/install_db.inc.php
  7. 6
      main/install/install_files.inc.php
  8. 268
      main/install/install_functions.inc.php
  9. 115
      main/install/install_upgrade.lib.php
  10. 10
      main/install/update-db-1.6.x-1.8.0.inc.php
  11. 8
      main/install/update-db-1.8.0-1.8.2.inc.php
  12. 8
      main/install/update-db-1.8.2-1.8.3.inc.php
  13. 8
      main/install/update-db-1.8.3-1.8.4.inc.php
  14. 8
      main/install/update-db-1.8.4-1.8.5.inc.php
  15. 8
      main/install/update-db-1.8.5-1.8.6.inc.php
  16. 8
      main/install/update-db-1.8.6-1.8.6.1.inc.php
  17. 8
      main/install/update-db-1.8.6.1-1.8.6.2.inc.php
  18. 8
      main/install/update-db-1.8.6.2-1.8.7.inc.php
  19. 12
      main/install/update-files-1.6.x-1.8.0.inc.php
  20. 2
      main/install/update-files-1.8.3-1.8.4.inc.php
  21. 2
      main/install/update-files-1.8.4-1.8.5.inc.php
  22. 2
      main/install/update-files-1.8.5-1.8.6.inc.php
  23. 2
      main/install/update-files-1.8.6-1.8.6.1.inc.php
  24. 2
      main/install/update-files-1.8.6.1-1.8.6.2.inc.php
  25. 2
      main/install/update-files-1.8.6.2-1.8.7.inc.php
  26. 8
      main/install/update_db.inc.php
  27. 14
      main/install/update_files.inc.php
  28. 25
      main/install/upgrade.php
  29. 8
      plugin/dashboard/block_course/css/index.html
  30. 8
      plugin/dashboard/block_course/index.html
  31. 8
      plugin/dashboard/block_session/css/index.html
  32. 8
      plugin/dashboard/block_session/index.html
  33. 8
      plugin/dashboard/block_student/css/index.html
  34. 8
      plugin/dashboard/block_student/index.html
  35. 8
      plugin/dashboard/block_teacher/css/index.html
  36. 8
      plugin/dashboard/block_teacher/index.html
  37. 8
      plugin/dashboard/index.html
  38. 8
      plugin/search/client/index.html
  39. 8
      plugin/search/client/www/index.html
  40. 8
      plugin/search/server/cron.d/index.html
  41. 8
      plugin/search/server/etc/index.html
  42. 8
      plugin/search/server/www/index.html
  43. 1
      tests/main/inc/lib/main_api.lib.test.php

@ -239,7 +239,6 @@ define('TABLE_USER_COURSE_CATEGORY', 'user_course_category');
// @TODO: Are these MAIN tables or course tables?
// @TODO: Probably these constants are obsolete.
define('TABLE_MAIN_SURVEY', 'survey');
define('TABLE_MAIN_GROUP', 'survey_group');
define('TABLE_MAIN_SURVEYQUESTION', 'questions');
// Survey

@ -3243,10 +3243,11 @@ function api_is_valid_utf8(&$string) {
// wrongly detected as UTF-8. Possibly, there would be problems with other
// languages too. An alternative implementation will be used.
$len = api_byte_count($string);
$str = (string)$string;
$len = api_byte_count($str);
$i = 0;
while ($i < $len) {
$byte1 = ord($string[$i++]); // Here the current character begins. Its size is
$byte1 = ord($str[$i++]); // Here the current character begins. Its size is
// determined by the senior bits in the first byte.
if (($byte1 & 0x80) == 0x00) { // 0xxxxxxx
@ -3267,7 +3268,7 @@ function api_is_valid_utf8(&$string) {
return false; // Here the string ends unexpectedly.
}
if (!((ord($string[$i++]) & 0xC0) == 0x80))
if (!((ord($str[$i++]) & 0xC0) == 0x80))
return false; // Invalid second byte, invalid string.
}
@ -3280,13 +3281,13 @@ function api_is_valid_utf8(&$string) {
if ($i == $len) {
return false; // Unexpected end of the string.
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false; // Invalid second byte.
}
if ($i == $len) {
return false; // Unexpected end of the string.
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false; // Invalid third byte, invalid string.
}
}
@ -3300,19 +3301,19 @@ function api_is_valid_utf8(&$string) {
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
}
@ -3326,25 +3327,25 @@ function api_is_valid_utf8(&$string) {
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
}
@ -3358,31 +3359,31 @@ function api_is_valid_utf8(&$string) {
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
if ($i == $len) {
return false;
}
if (!((ord($string[$i++]) & 0xC0) == 0x80)) {
if (!((ord($str[$i++]) & 0xC0) == 0x80)) {
return false;
}
}
@ -3428,17 +3429,21 @@ function api_is_valid_ascii(&$string) {
* @link http://php.net/manual/en/function.str-getcsv.php (exists as of PHP 5 >= 5.3.0)
*/
function & api_str_getcsv(& $string, $delimiter = ',', $enclosure = '"', $escape = '\\') {
$delimiter = (string)$delimiter;
if (api_byte_count($delimiter) > 1) { $delimiter = $delimiter[1]; }
$enclosure = (string)$enclosure;
if (api_byte_count($enclosure) > 1) { $enclosure = $enclosure[1]; }
$escape = (string)$escape;
if (api_byte_count($escape) > 1) { $escape = $escape[1]; }
$len = api_byte_count($string);
$str = (string)$string;
$len = api_byte_count($str);
$enclosed = false;
$escaped = false;
$value = '';
$result = array();
for ($i = 0; $i < $len; $i++) {
$char = $string[$i];
$char = $str[$i];
if ($char == $escape) {
if (!$escaped) {
$escaped = true;
@ -3448,7 +3453,7 @@ function & api_str_getcsv(& $string, $delimiter = ',', $enclosure = '"', $escape
$escaped = false;
switch ($char) {
case $enclosure:
if ($enclosed && $string[$i + 1] == $enclosure) {
if ($enclosed && $str[$i + 1] == $enclosure) {
$value .= $char;
$i++;
} else {

@ -331,45 +331,46 @@ function _api_clean_person_name($person_name) {
* @param string $from_encoding The encoding that $string is being converted from.
* @return string Returns the converted string.
*/
function _api_convert_encoding($string, $to_encoding, $from_encoding) {
function _api_convert_encoding(&$string, $to_encoding, $from_encoding) {
$str = (string)$string;
static $character_map = array();
static $utf8_compatible = array('UTF-8', 'US-ASCII');
if (empty($string)) {
return $string;
if (empty($str)) {
return $str;
}
$to_encoding = api_refine_encoding_id($to_encoding);
$from_encoding = api_refine_encoding_id($from_encoding);
if (api_equal_encodings($to_encoding, $from_encoding)) {
return $string;
return $str;
}
if ($to_encoding == 'HTML-ENTITIES') {
return api_htmlentities($string, ENT_QUOTES, $from_encoding);
return api_htmlentities($str, ENT_QUOTES, $from_encoding);
}
if ($from_encoding == 'HTML-ENTITIES') {
return api_html_entity_decode($string, ENT_QUOTES, $to_encoding);
return api_html_entity_decode($str, ENT_QUOTES, $to_encoding);
}
$to = _api_get_character_map_name($to_encoding);
$from = _api_get_character_map_name($from_encoding);
if (empty($to) || empty($from) || $to == $from || (in_array($to, $utf8_compatible) && in_array($from, $utf8_compatible))) {
return $string;
return $str;
}
if (!isset($character_map[$to])) {
$character_map[$to] = &_api_parse_character_map($to);
}
if ($character_map[$to] === false) {
return $string;
return $str;
}
if (!isset($character_map[$from])) {
$character_map[$from] = &_api_parse_character_map($from);
}
if ($character_map[$from] === false) {
return $string;
return $str;
}
if ($from != 'UTF-8') {
$len = api_byte_count($string);
$len = api_byte_count($str);
$codepoints = array();
for ($i = 0; $i < $len; $i++) {
$ord = ord($string[$i]);
$ord = ord($str[$i]);
if ($ord > 127) {
if (isset($character_map[$from]['local'][$ord])) {
$codepoints[] = $character_map[$from]['local'][$ord];
@ -381,7 +382,7 @@ function _api_convert_encoding($string, $to_encoding, $from_encoding) {
}
}
} else {
$codepoints = _api_utf8_to_unicode($string);
$codepoints = _api_utf8_to_unicode($str);
}
if ($to != 'UTF-8') {
foreach ($codepoints as $i => &$codepoint) {
@ -395,11 +396,11 @@ function _api_convert_encoding($string, $to_encoding, $from_encoding) {
$codepoint = chr($codepoint);
}
}
$string = implode($codepoints);
$str = implode($codepoints);
} else {
$string = _api_utf8_from_unicode($codepoints);
$str = _api_utf8_from_unicode($codepoints);
}
return $string;
return $str;
}
/**
@ -468,16 +469,16 @@ function &_api_parse_character_map($name) {
* @link http://hsivonen.iki.fi/php-utf8/
* @author Ivan Tcholakov, August 2009, adaptation for the Dokeos LMS.
*/
function _api_utf8_to_unicode($string) {
if (!is_string($string)) { $string = (string)$string; } // A quick workaround after testing.
function _api_utf8_to_unicode(&$string) {
$str = (string)$string;
$state = 0; // cached expected number of octets after the current octet
// until the beginning of the next UTF8 character sequence
$codepoint = 0; // cached Unicode character
$bytes = 1; // cached expected number of octets in the current sequence
$result = array();
$len = api_byte_count($string);
$len = api_byte_count($str);
for ($i = 0; $i < $len; $i++) {
$byte = ord($string[$i]);
$byte = ord($str[$i]);
if ($state == 0) {
// When state is zero we expect either a US-ASCII character or a multi-octet sequence.
if (0 == (0x80 & ($byte))) {

@ -331,7 +331,6 @@ function api_get_path($path_type, $path = null) {
WEB_PATH => '',
SYS_PATH => '',
REL_PATH => '',
REL_SYS_PATH => '',
WEB_SERVER_ROOT_PATH => '',
SYS_SERVER_ROOT_PATH => '',
WEB_COURSE_PATH => '',
@ -2557,20 +2556,21 @@ function api_get_languages_combo($name = 'language') {
* @return void Display the box directly
*/
function api_display_language_form($hide_if_no_choice = false) {
$platformLanguage = api_get_setting('platformLanguage');
$dirname = api_get_path(SYS_PATH).'main/lang/'; // TODO: this line is probably no longer needed
// retrieve a complete list of all the languages.
$language_list = api_get_languages();
if (count($language_list['name']) <= 1 && $hide_if_no_choice) {
return; //don't show any form
}
// the the current language of the user so that his/her language occurs as selected in the dropdown menu
if (isset($_SESSION['user_language_choice'])) {
$user_selected_language = $_SESSION['user_language_choice'];
}
if (!isset($user_selected_language)) {
$user_selected_language = $platformLanguage;
if (empty($user_selected_language)) {
$user_selected_language = api_get_setting('platformLanguage');
}
$original_languages = $language_list['name'];
$folder = $language_list['folder']; // this line is probably no longer needed
?>

@ -40,7 +40,6 @@ if (!function_exists('version_compare') || version_compare( phpversion(), REQUIR
session_start();
// Including necessary core libraries.
//@include '../inc/installedVersion.inc.php'; //TODO: This line is to be removed.
require '../inc/lib/main_api.lib.php';
require api_get_path(LIBRARY_PATH).'database.lib.php';
@ -54,6 +53,7 @@ $_setting = array(
);
// Loading language files.
// TODO: It would be nice browser's intrface language to be detected at this point.
require api_get_path(SYS_LANG_PATH).'english/trad4all.inc.php';
require api_get_path(SYS_LANG_PATH).'english/install.inc.php';
if (!empty($_POST['language_list'])) {
@ -91,7 +91,7 @@ require_once 'install_upgrade.lib.php'; //also defines constants
require_once 'install_functions.inc.php';
// Some constants
define('DOKEOS_INSTALL', 1);
define('SYSTEM_INSTALLATION', 1);
define('MAX_COURSE_TRANSFER', 100);
define('INSTALL_TYPE_UPDATE', 'update');
define('FORM_FIELD_DISPLAY_LENGTH', 40);
@ -155,14 +155,7 @@ if ($_POST['step2_install'] || $_POST['step2_update_8'] || $_POST['step2_update_
$installType = 'update';
if ($_POST['step2_update_8']) {
$emptyUpdatePath = false;
if (empty($_POST['updatePath'])) {
$proposedUpdatePath = $_SERVER['DOCUMENT_ROOT'];
} else {
$proposedUpdatePath = $_POST['updatePath'];
}
if (substr($proposedUpdatePath,-1) != '/') {
$proposedUpdatePath .= '/';
}
$proposedUpdatePath = api_add_trailing_slash(empty($_POST['updatePath']) ? $_SERVER['DOCUMENT_ROOT'] : $_POST['updatePath']);
if (file_exists($proposedUpdatePath)) {
if (in_array($my_old_version, $update_from_version_8)) {
$_POST['step2'] = 1;
@ -177,10 +170,7 @@ if ($_POST['step2_install'] || $_POST['step2_update_8'] || $_POST['step2_update_
$_POST['step1'] = 1;
} else {
$emptyUpdatePath = false;
if (substr($_POST['updatePath'], -1) != '/') {
$_POST['updatePath'] .= '/';
}
$_POST['updatePath'] = api_add_trailing_slash($_POST['updatePath']);
if (file_exists($_POST['updatePath'])) {
//1.6.x
$my_old_version = get_config_param('clarolineVersion', $_POST['updatePath']);
@ -213,14 +203,14 @@ if ($installType == 'update' && in_array($my_old_version, $update_from_version_8
if (!isset($_GET['running'])) {
$dbHostForm ='localhost';
$dbUsernameForm ='root';
$dbPassForm ='';
$dbPrefixForm ='';
$dbNameForm ='chamilo_main';
$dbStatsForm ='chamilo_stats';
$dbScormForm ='chamilo_scorm';
$dbUserForm ='chamilo_user';
$dbHostForm = 'localhost';
$dbUsernameForm = 'root';
$dbPassForm = '';
$dbPrefixForm = '';
$dbNameForm = 'chamilo_main';
$dbStatsForm = 'chamilo_stats';
$dbScormForm = 'chamilo_scorm';
$dbUserForm = 'chamilo_user';
// Extract the path to append to the url if Chamilo is not installed on the web root directory.
$urlAppendPath = api_remove_trailing_slash(api_get_path(REL_PATH));
@ -243,21 +233,23 @@ if (!isset($_GET['running'])) {
$institutionForm = 'My Organisation';
$institutionUrlForm = 'http://www.chamilo.org';
$languageForm = 'english';
// TODO: A better choice to be tested:
//$languageForm = api_get_interface_language();
$checkEmailByHashSent = 0;
$checkEmailByHashSent = 0;
$ShowEmailnotcheckedToStudent = 1;
$userMailCanBeEmpty = 1;
$allowSelfReg = 1;
$allowSelfRegProf = 1;
$enableTrackingForm = 1;
$singleDbForm = 0;
$encryptPassForm = 'md5';
$session_lifetime = 360000;
$userMailCanBeEmpty = 1;
$allowSelfReg = 1;
$allowSelfRegProf = 1;
$enableTrackingForm = 1;
$singleDbForm = 0;
$encryptPassForm = 'md5';
$session_lifetime = 360000;
} else {
foreach ($_POST as $key => $val) {
$magic_quotes_gpc = ini_get('magic_quotes_gpc') ? true : false;
$magic_quotes_gpc = ini_get('magic_quotes_gpc');
if (is_string($val)) {
if ($magic_quotes_gpc) {
$val = stripslashes($val);
@ -547,7 +539,7 @@ if ($_POST['step2']) {
}
display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $allowSelfRegProf, $loginForm, $passForm);
} elseif($_POST['step5']) {
} elseif ($_POST['step5']) {
//STEP 6 : LAST CHECK BEFORE INSTALL
?>
@ -600,7 +592,7 @@ if ($_POST['step2']) {
?>
<?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br />
<?php if($installType == 'new'): ?>
<?php if ($installType == 'new'): ?>
<?php echo get_lang('AdminLogin').' : <strong>'.$loginForm; ?></strong><br />
<?php echo get_lang('AdminPass').' : <strong>'.$passForm; /* TODO: Maybe this password should be hidden too? */ ?></strong><br /><br />
<?php else: ?>
@ -617,7 +609,7 @@ if ($_POST['step2']) {
<?php if ($installType == 'new'): ?>
<div style="background-color:#FFFFFF">
<p align="center"><strong><font color="red">
<?php echo get_lang('Warning');?> !<br />
<?php echo get_lang('Warning'); ?> !<br />
<?php echo get_lang('TheInstallScriptWillEraseAllTables'); ?>
</font></strong></p>
</div>

@ -2,7 +2,7 @@
/* For licensing terms, see /chamilo_license.txt */
/**
==============================================================================
* Install the Dokeos database
* Install the Chamilo database
* Notice : This script has to be included by index.php
*
* @package chamilo.install
@ -17,9 +17,9 @@ require_once 'install_upgrade.lib.php';
==============================================================================
*/
//this page can only be access through including from the install script.
// This page can only be access through including from the install script.
if (!defined('DOKEOS_INSTALL')) {
if (!defined('SYSTEM_INSTALLATION')) {
echo 'You are not allowed here!';
exit;
}
@ -53,9 +53,7 @@ Database::query("SET SESSION character_set_server='utf8';");
Database::query("SET SESSION collation_server='utf8_general_ci';");
Database::query("SET CHARACTER SET 'utf8';");
if ($urlForm[strlen($urlForm) - 1] != '/') {
$urlForm = $urlForm.'/';
}
$urlForm = api_add_trailing_slash($urlForm);
switch ($encryptPassForm) {
case 'md5' :
@ -69,36 +67,34 @@ switch ($encryptPassForm) {
break;
}
$dbPrefixForm = eregi_replace('[^a-z0-9_-]', '', $dbPrefixForm);
$dbNameForm = eregi_replace('[^a-z0-9_-]', '', $dbNameForm);
$dbStatsForm = eregi_replace('[^a-z0-9_-]', '', $dbStatsForm);
$dbUserForm = eregi_replace('[^a-z0-9_-]', '', $dbUserForm);
$dbPrefixForm = preg_replace('/[^a-zA-Z0-9_-]/', '', $dbPrefixForm);
if (!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm, $dbNameForm)) {
$dbNameForm = preg_replace('/[^a-zA-Z0-9_-]/', '', $dbNameForm);
if (!empty($dbPrefixForm) && strpos($dbNameForm, $dbPrefixForm) !== 0) {
$dbNameForm = $dbPrefixForm.$dbNameForm;
}
if (!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm, $dbStatsForm)) {
$dbStatsForm = preg_replace('/[^a-zA-Z0-9_-]/', '', $dbStatsForm);
if (!empty($dbPrefixForm) && strpos($dbStatsForm, $dbPrefixForm) !== 0) {
$dbStatsForm = $dbPrefixForm.$dbStatsForm;
}
if (!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm, $dbUserForm)) {
$dbUserForm = preg_replace('/[^a-zA-Z0-9_-]/', '', $dbUserForm);
if (!empty($dbPrefixForm) && strpos($dbUserForm, $dbPrefixForm) !== 0) {
$dbUserForm = $dbPrefixForm.$dbUserForm;
}
$mysqlMainDb = $dbNameForm;
$mysqlStatsDb = $dbStatsForm;
$mysqlUserDb = $dbUserForm;
if (empty($mysqlMainDb) || $mysqlMainDb == 'mysql' || $mysqlMainDb == $dbPrefixForm) {
$mysqlMainDb = $dbPrefixForm.'main';
}
$mysqlStatsDb = $dbStatsForm;
if (empty($mysqlStatsDb) || $mysqlStatsDb == 'mysql' || $mysqlStatsDb == $dbPrefixForm) {
$mysqlStatsDb = $dbPrefixForm.'stats';
}
$mysqlUserDb = $dbUserForm;
if (empty($mysqlUserDb) || $mysqlUserDb == 'mysql' || $mysqlUserDb == $dbPrefixForm) {
$mysqlUserDb = $dbPrefixForm.'user';
}
@ -113,13 +109,13 @@ if (!$singleDbForm) {
}
Database::query("CREATE DATABASE IF NOT EXISTS `$mysqlMainDb`") or die(Database::error());
if($mysqlStatsDb == $mysqlMainDb && $mysqlUserDb == $mysqlMainDb) {
if ($mysqlStatsDb == $mysqlMainDb && $mysqlUserDb == $mysqlMainDb) {
$singleDbForm = true;
}
/**
* CREATING THE STATISTICS DATABASE
*/
* CREATING THE STATISTICS DATABASE
*/
if ($mysqlStatsDb != $mysqlMainDb) {
if (!$singleDbForm) {
// multi DB mode AND tracking has its own DB so create it
@ -132,8 +128,8 @@ if ($mysqlStatsDb != $mysqlMainDb) {
}
/**
* CREATING THE USER DATABASE
*/
* CREATING THE USER DATABASE
*/
if ($mysqlUserDb != $mysqlMainDb) {
if (!$singleDbForm) {
// multi DB mode AND user data has its own DB so create it
@ -145,23 +141,23 @@ if ($mysqlUserDb != $mysqlMainDb) {
}
}
include '../lang/english/create_course.inc.php';
include api_get_path(SYS_LANG_PATH).'english/create_course.inc.php';
if ($languageForm != 'english') {
include '../lang/'.$languageForm.'/create_course.inc.php';
include api_get_path(SYS_LANG_PATH).$languageForm.'/create_course.inc.php';
}
/**
* creating the tables of the main database
*/
* creating the tables of the main database
*/
Database::select_db($mysqlMainDb) or die(Database::error());
$installation_settings['{ORGANISATIONNAME}'] = $institutionForm;
$installation_settings['{ORGANISATIONURL}'] = $institutionUrlForm;
$installation_settings['{CAMPUSNAME}'] = $campusForm;
$installation_settings['{PLATFORMLANGUAGE}'] = $languageForm;
$installation_settings['{ALLOWSELFREGISTRATION}'] = trueFalse($allowSelfReg);
$installation_settings['{ALLOWTEACHERSELFREGISTRATION}'] = trueFalse($allowSelfRegProf);
$installation_settings['{ALLOWSELFREGISTRATION}'] = true_false($allowSelfReg);
$installation_settings['{ALLOWTEACHERSELFREGISTRATION}'] = true_false($allowSelfRegProf);
$installation_settings['{ADMINLASTNAME}'] = $adminLastName;
$installation_settings['{ADMINFIRSTNAME}'] = $adminFirstName;
$installation_settings['{ADMINLOGIN}'] = $loginForm;
@ -174,8 +170,8 @@ $installation_settings['{HASHFUNCTIONMODE}'] = $encryptPassForm;
load_main_database($installation_settings);
/**
* creating the tables of the tracking database
*/
* creating the tables of the tracking database
*/
Database::select_db($mysqlStatsDb) or die(Database::error());
@ -185,9 +181,9 @@ $track_countries_table = "track_c_countries";
fill_track_countries_table($track_countries_table);
/**
* creating the tables of the USER database
* this is where the personal agenda items are storen, the user defined course categories (sorting of my courses)
*/
* creating the tables of the USER database
* this is where the personal agenda items are storen, the user defined course categories (sorting of my courses)
*/
Database::select_db($mysqlUserDb) or die(Database::error());

@ -15,13 +15,13 @@
==============================================================================
*/
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
// Write the system config file
write_dokeos_config_file('../inc/conf/configuration.php');
write_system_config_file('../inc/conf/configuration.php');
// Write a distribution file with the config as a backup for the admin
write_dokeos_config_file('../inc/conf/configuration.dist.php');
write_system_config_file('../inc/conf/configuration.dist.php');
// Write a .htaccess file in the course repository
write_courses_htaccess_file($urlAppendPath);

@ -69,8 +69,7 @@ function check_php_setting($php_setting, $recommended_value, $return_success = f
* @author Joomla <http://www.joomla.org>
*/
function get_php_setting($val) {
$r = ini_get($val) == '1' ? 1 : 0;
return $r ? 'ON' : 'OFF';
return ini_get($val) == '1' ? 'ON' : 'OFF';
}
/**
@ -95,7 +94,7 @@ function check_writable($folder, $suggestion = false) {
* @return string the string "true" or "false"
* @author Christophe Gesché
*/
function trueFalse($var) {
function true_false($var) {
return $var ? 'true' : 'false';
}
@ -122,11 +121,12 @@ function file_to_array($filename) {
* @param string If we want to give the path rather than take it from POST
* @return string the value of the parameter
* @author Olivier Brouckaert
* @author Reworked by Ivan Tcholakov, 2010
*/
function get_config_param($param, $updatePath = '') {
global $configFile, $updateFromConfigFile;
//look if we already have the queried param
// Look if we already have the queried parameter.
if (is_array($configFile) && isset($configFile[$param])) {
return $configFile[$param];
}
@ -136,14 +136,16 @@ function get_config_param($param, $updatePath = '') {
$updatePath = realpath($updatePath).'/';
$updateFromInstalledVersionFile = '';
if (empty($updateFromConfigFile)) { //if update from previous install was requested
//try to recover old config file from dokeos 1.8.x
if (empty($updateFromConfigFile)) {
// If update from previous install was requested,
// try to recover old config file from dokeos 1.8.x.
if (file_exists($updatePath.'main/inc/conf/configuration.php')) {
$updateFromConfigFile='main/inc/conf/configuration.php';
$updateFromConfigFile = 'main/inc/conf/configuration.php';
} elseif (file_exists($updatePath.'claroline/inc/conf/claro_main.conf.php')) {
$updateFromConfigFile='claroline/inc/conf/claro_main.conf.php';
} else { //give up recovering
error_log('Could not find config file in '.$updatePath.' in get_config_param()',0);
$updateFromConfigFile = 'claroline/inc/conf/claro_main.conf.php';
} else {
// Give up recovering.
error_log('Could not find config file in '.$updatePath.' in get_config_param()', 0);
return null;
}
}
@ -152,60 +154,93 @@ function get_config_param($param, $updatePath = '') {
$updateFromInstalledVersionFile = $updatePath.'main/inc/installedVersion.inc.php';
} elseif (file_exists($updatePath.$updateFromConfigFile)) { //the param was not found in global vars, so look into the old config file
} elseif (file_exists($updatePath.$updateFromConfigFile)) {
// The parameter was not found among the global variables, so look into the old configuration file.
//make sure the installedVersion file is read first so it is overwritten
//by the config file if the config file contains the version (from 1.8.4)
$temp2 = array();
// Make sure the installedVersion file is read first so it is overwritten
// by the config file if the config file contains the version (from 1.8.4).
$config_data_2 = array();
if (file_exists($updatePath.$updateFromInstalledVersionFile)) {
$temp2 = file_to_array($updatePath.$updateFromInstalledVersionFile);
$config_data_2 = file_to_array($updatePath.$updateFromInstalledVersionFile);
}
$configFile = array();
$temp = file_to_array($updatePath.$updateFromConfigFile);
$temp = array_merge($temp, $temp2);
$config_data = file_to_array($updatePath.$updateFromConfigFile);
$config_data = array_merge($config_data, $config_data_2);
$val = '';
//parse the config file (TODO clarify why it has to be so complicated)
foreach ($temp as $enreg) {
if (strstr($enreg, '=')) {
$enreg = explode('=', $enreg);
$enreg[0] = trim($enreg[0]);
if ($enreg[0][0] == '$') {
list($enreg[1]) = explode(' //', $enreg[1]);
$enreg[0] = trim(str_replace('$', '', $enreg[0]));
$enreg[1] = str_replace('\"', '"', ereg_replace('(^"|"$)', '', substr(trim($enreg[1]), 0, -1)));
$enreg[1] = str_replace('\'', '"', ereg_replace('(^\'|\'$)', '', $enreg[1]));
if (strtolower($enreg[1]) == 'true') {
$enreg[1] = 1;
}
if (strtolower($enreg[1]) == 'false') {
$enreg[1] = 0;
// Parse the configuration file, statement by statement (line by line, actually).
foreach ($config_data as $php_statement) {
if (strpos($php_statement, '=') !== false) {
// Variable assignment statement have been detected (probably).
// It is expected to be as follows:
// $variable = 'some_value'; // A comment that is not mandatory.
// Split the statement into its left and right sides.
$php_statement = explode('=', $php_statement);
$variable = trim($php_statement[0]);
$value = $php_statement[1];
if (substr($variable, 0, 1) == '$') {
// We have for sure a php variable assignment detected.
// On the left side: Retrieve the pure variable's name
$variable = trim(str_replace('$', '', $variable));
// On the right side: Remove the comment, if it exists.
list($value) = explode(' //', $value);
// Remove extra whitespace, if any. Remove the trailing semicolon (;).
$value = substr(trim($value), 0, -1);
// Remove surroundig quotes, restore escaped quotes.
$value = str_replace('\"', '"', preg_replace('/^"|"$/', '', $value));
$value = str_replace('\'', '"', preg_replace('/^\'|\'$/', '', $value));
if (strtolower($value) == 'true') {
// A boolean true value have been recognized.
$value = 1;
} elseif (strtolower($value) == 'false') {
// A boolean false value have been recognized.
$value = 0;
} else {
$implode_string=' ';
if (!strstr($enreg[1], '." ".') && strstr($enreg[1], '.$')) {
$enreg[1] = str_replace('.$', '." ".$', $enreg[1]);
// Probably we have a string value, but also we have to check
// possible string concatenations that may include string values
// and other configuration variables. I this case we have to
// get the calculated result of the concatenation.
$implode_string = ' ';
if (!strstr($value, '." ".') && strstr($value, '.$')) {
// Yes, there is concatenation, insert a special separator string.
$value = str_replace('.$', '." ".$', $value);
$implode_string = '';
}
$tmp = explode('." ".', $enreg[1]);
// Split the concatenated values, if they are more than one.
$sub_strings = explode('." ".', $value);
foreach ($tmp as $tmp_key => $tmp_val) {
if (eregi('^\$[a-z_][a-z0-9_]*$', $tmp_val)) {
$tmp[$tmp_key] = get_config_param(str_replace('$', '', $tmp_val));
// Seek for variables and retrieve their values.
foreach ($sub_strings as $key => & $sub_string) {
if (preg_match('/^\$[a-zA-Z_][a-zA-Z0-9_]*$/', $sub_string)) {
// A variable has been detected, read it by recursive call.
$sub_string = get_config_param(str_replace('$', '', $sub_string));
}
}
$enreg[1] = implode($implode_string, $tmp);
// Concatenate everything into the final, the calculated string value.
$value = implode($implode_string, $sub_strings);
}
$configFile[$enreg[0]] = $enreg[1];
// Cache the result value.
$configFile[$variable] = $value;
$a = explode("'", $enreg[0]);
$a = explode("'", $variable);
$key_tmp = $a[1];
if ($key_tmp == $param) {
$val = $enreg[1];
$val = $value;
}
}
}
@ -230,50 +265,17 @@ function get_config_param($param, $updatePath = '') {
*/
function get_config_param_from_db($host, $login, $pass, $db_name, $param = '') {
$mydb = mysql_connect($host, $login, $pass);
@mysql_query("set session sql_mode='';"); // Disabling special SQL modes (MySQL 5)
$myconnect = mysql_select_db($db_name);
Database::connect(array('server' => $host, 'username' => $login, 'password' => $pass));
Database::query("set session sql_mode='';"); // Disabling special SQL modes (MySQL 5)
Database::select_db($db_name);
$sql = "SELECT * FROM settings_current WHERE variable = '$param'";
$res = mysql_query($sql);
if ($res === false) {
return null;
}
if (mysql_num_rows($res) > 0) {
$row = mysql_fetch_array($res);
$value = $row['selected_value'];
return $value;
}
return null;
}
/**
* TODO: The main API is accessible here. Then we could use a function for this purpose from there?
*
* Return a list of language directories.
* @todo function does not belong here, move to code library,
* also see infocours.php which contains similar function
*/
function get_language_folder_list($dirname) {
if ($dirname[strlen($dirname) - 1] != '/') {
$dirname .= '/';
}
$handle = opendir($dirname);
$language_list = array();
while ($entries = readdir($handle)) {
if ($entries == '.' || $entries == '..' || $entries=='CVS' || $entries == '.svn') {
continue;
}
if (is_dir($dirname.$entries)) {
$language_list[] = $entries;
if (($res = Database::query("SELECT * FROM settings_current WHERE variable = '$param'")) !== false) {
if (Database::num_rows($res) > 0) {
$row = Database::fetch_array($res);
return $row['selected_value'];
}
}
closedir($handle);
return $language_list;
return null;
}
/*
@ -283,35 +285,53 @@ function get_language_folder_list($dirname) {
*/
/**
* Displays a form (drop down menu) so the user can select
* his/her preferred language.
* Displays a drop down box for selection the preferred language.
*/
function display_language_selection_box() {
//get language list
$dirname = '../lang/'; // TODO: Check api_get_path() and use it.
$language_list = get_language_folder_list($dirname);
sort($language_list);
//Reduce the number of languages shown to only show those with higher than 90% translation in DLTT
//This option can be easily removed later on. The aim is to test people response to less choice
//$language_to_display = $language_list;
function display_language_selection_box($name = 'language_list', $default_language = 'english') {
// Reading language list.
$language_list = get_language_folder_list();
/*
// Reduction of the number of languages shown. Enable this fragment of code for customization purposes.
// Modify the language list according to your preference. Don't exclude the 'english' item.
$language_to_display = array('asturian', 'bulgarian', 'english', 'italian', 'french', 'slovenian', 'slovenian_unicode', 'spanish');
foreach ($language_list as $key => & $value) {
if (!in_array($key, $language_to_display)) {
unset($language_list[$key]);
}
}
*/
//display
echo "\t\t<select name=\"language_list\">\n";
// Sanity checks due to the possibility for customizations.
if (!is_array($language_list) || empty($language_list)) {
$language_list = array('english' => 'English');
}
$default_language = 'english';
foreach ($language_to_display as $key => $value) {
if ($value == $default_language) {
// Sorting again, if it is necessary.
//asort($language_list);
// More sanity checks.
if (!array_key_exists($default_language, $language_list)) {
if (array_key_exists('english', $language_list)) {
$default_language = 'english';
} else {
$language_keys = array_keys($language_list);
$default_language = $language_keys[0];
}
}
// Displaying the box.
echo "\t\t<select name=\"$name\">\n";
foreach ($language_list as $key => $value) {
if ($key == $default_language) {
$option_end = ' selected="selected">';
} else {
$option_end = '>';
}
echo "\t\t\t<option value=\"$value\"$option_end";
echo api_ucfirst($value);
echo "\t\t\t<option value=\"$key\"$option_end";
echo $value;
echo "</option>\n";
}
echo "\t\t</select>\n";
}
@ -324,7 +344,7 @@ function display_language_selection() { ?>
<h2><?php echo display_step_sequence(); ?><?php echo get_lang('InstallationLanguage'); ?></h2>
<p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
<form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
<?php display_language_selection_box(); ?>
<?php display_language_selection_box('language_list', api_get_interface_language()); ?>
<button type="submit" name="step1" class="next" value="<?php get_lang('Next'); ?> &gt;"><?php echo get_lang('Next'); ?></button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
</form>
@ -932,44 +952,8 @@ function display_configuration_settings_form($installType, $urlForm, $languageFo
echo '<td>';
$array_lang = array('asturian', 'bulgarian', 'english', 'italian', 'french', 'slovenian', 'spanish');
////Only display Language have 90% + // TODO: Ivan: Is this policy actual? I am going to change it.
echo "\t\t<select name=\"languageForm\">\n";
foreach ($array_lang as $key => $value) {
echo '<option value="'.$value.'"';
if ($value == $languageForm) {
echo ' selected="selected"';
}
echo ">$value</option>\n";
}
echo "\t\t</select>\n";
//Display all language
/*echo "<select name=\"languageForm\">\n";
$dirname = '../lang/';
display_language_selection_box('languageForm', $languageForm);
if ($dir = @opendir($dirname)) {
$lang_files = array();
while (($file = readdir($dir)) !== false) {
if($file != '.' && $file != '..' && $file != 'CVS' && $file != '.svn' && is_dir($dirname.$file)){
array_push($lang_files, $file);
}
}
closedir($dir);
}
sort($lang_files);
foreach ($lang_files as $file) {
echo '<option value="'.$file.'"';
if ($file == $languageForm) {
echo ' selected="selected"';
}
echo ">$file</option>\n";
}
echo '</select>';*/
echo "</td>\n";
}
echo "</tr>\n";

@ -19,10 +19,10 @@
CONSTANTS
==============================================================================
*/
define("DOKEOS_MAIN_DATABASE_FILE", "dokeos_main.sql");
define("SYSTEM_MAIN_DATABASE_FILE", "dokeos_main.sql");
define("COUNTRY_DATA_FILENAME", "country_data.csv");
define("COURSES_HTACCESS_FILENAME", "htaccess.dist");
define("DOKEOS_CONFIG_FILENAME", "configuration.dist.php");
define("SYSTEM_CONFIG_FILENAME", "configuration.dist.php");
require_once api_get_path(LIBRARY_PATH).'database.lib.php';
@ -46,8 +46,8 @@ function set_file_folder_permissions() {
*/
function fill_track_countries_table($track_countries_table) {
$file_path = dirname(__FILE__).'/'.COUNTRY_DATA_FILENAME;
$add_country_sql = "LOAD DATA INFILE '".mysql_real_escape_string($file_path)."' INTO TABLE $track_countries_table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'';";
@ mysql_query($add_country_sql);
$add_country_sql = "LOAD DATA INFILE '".Database::escape_string($file_path)."' INTO TABLE $track_countries_table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'';";
@ Database::query($add_country_sql);
}
/**
@ -70,7 +70,7 @@ function write_courses_htaccess_file($url_append) {
* Write the main system config file
* @param string $path Path to the config file
*/
function write_dokeos_config_file($path) {
function write_system_config_file($path) {
global $dbHostForm;
global $dbUsernameForm;
@ -93,19 +93,15 @@ function write_dokeos_config_file($path) {
global $new_version;
global $new_version_stable;
// TODO: api_get_path() to be tested here.
$seek = array('\\', '//');
$destroy = array('/', '/');
$rootSys = str_replace($seek, $destroy, realpath($pathForm).'/');
$file_path = dirname(__FILE__).'/'.DOKEOS_CONFIG_FILENAME;
$root_sys = api_add_trailing_slash(str_replace('\\', '/', realpath($pathForm)));
$content = file_get_contents(dirname(__FILE__).'/'.SYSTEM_CONFIG_FILENAME);
$content = file_get_contents($file_path);
$config['{DATE_GENERATED}'] = date('r');
$config['{DATABASE_HOST}'] = $dbHostForm;
$config['{DATABASE_USER}'] = $dbUsernameForm;
$config['{DATABASE_PASSWORD}'] = $dbPassForm;
$config['TRACKING_ENABLED'] = trueFalse($enableTrackingForm);
$config['SINGLE_DATABASE'] = trueFalse($singleDbForm);
$config['TRACKING_ENABLED'] = true_false($enableTrackingForm);
$config['SINGLE_DATABASE'] = true_false($singleDbForm);
$config['{COURSE_TABLE_PREFIX}'] = ($singleDbForm ? 'crs_' : '');
$config['{DATABASE_GLUE}'] = ($singleDbForm ? '_' : '`.`');
$config['{DATABASE_PREFIX}'] = $dbPrefixForm;
@ -114,7 +110,7 @@ function write_dokeos_config_file($path) {
$config['{DATABASE_SCORM}'] = (($singleDbForm && empty($dbScormForm)) ? $dbNameForm : $dbScormForm);
$config['{DATABASE_PERSONAL}'] =(($singleDbForm && empty($dbUserForm)) ? $dbNameForm : $dbUserForm);
$config['{ROOT_WEB}'] = $urlForm;
$config['{ROOT_SYS}'] = $rootSys;
$config['{ROOT_SYS}'] = $root_sys;
$config['{URL_APPEND_PATH}'] = $urlAppendPath;
$config['{PLATFORM_LANGUAGE}'] = $languageForm;
$config['{SECURITY_KEY}'] = md5(uniqid(rand().time()));
@ -122,7 +118,7 @@ function write_dokeos_config_file($path) {
$config['SESSION_LIFETIME'] = $session_lifetime;
$config['{NEW_VERSION}'] = $new_version;
$config['NEW_VERSION_STABLE'] = trueFalse($new_version_stable);
$config['NEW_VERSION_STABLE'] = true_false($new_version_stable);
foreach ($config as $key => $value) {
$content = str_replace($key, $value, $content);
@ -162,25 +158,25 @@ function write_dokeos_config_file($path) {
*/
function load_main_database($installation_settings, $db_script = '') {
if (!empty($db_script)) {
$dokeos_main_sql_file_string = file_get_contents($db_script);
$sql_text = file_get_contents($db_script);
} else {
$dokeos_main_sql_file_string = file_get_contents(DOKEOS_MAIN_DATABASE_FILE);
$sql_text = file_get_contents(SYSTEM_MAIN_DATABASE_FILE);
}
//replace symbolic parameters with user-specified values
foreach ($installation_settings as $key => $value) {
$dokeos_main_sql_file_string = str_replace($key, mysql_real_escape_string($value), $dokeos_main_sql_file_string);
$sql_text = str_replace($key, Database::escape_string($value), $sql_text);
}
//split in array of sql strings
$sql_instructions = array();
$success = split_sql_file($sql_instructions, $dokeos_main_sql_file_string);
$success = split_sql_file($sql_instructions, $sql_text);
//execute the sql instructions
$count = count($sql_instructions);
for ($i = 0; $i < $count; $i++) {
$this_sql_query = $sql_instructions[$i]['query'];
mysql_query($this_sql_query);
Database::query($this_sql_query);
}
}
@ -189,17 +185,17 @@ function load_main_database($installation_settings, $db_script = '') {
* @param string Name of the file containing the SQL script inside the install directory
*/
function load_database_script($db_script) {
$dokeos_sql_file_string = file_get_contents($db_script);
$sql_text = file_get_contents($db_script);
//split in array of sql strings
$sql_instructions = array();
$success = split_sql_file($sql_instructions, $dokeos_sql_file_string);
$success = split_sql_file($sql_instructions, $sql_text);
//execute the sql instructions
$count = count($sql_instructions);
for ($i = 0; $i < $count; $i++) {
$this_sql_query = $sql_instructions[$i]['query'];
mysql_query($this_sql_query);
Database::query($this_sql_query);
}
}
@ -226,8 +222,8 @@ function split_sql_file(&$ret, $sql) {
$sql_len = strlen($sql);
$char = '';
$string_start = '';
$in_string = FALSE;
$nothing = TRUE;
$in_string = false;
$nothing = true;
$time0 = time();
for ($i = 0; $i < $sql_len; ++$i) {
@ -242,21 +238,21 @@ function split_sql_file(&$ret, $sql) {
// returned array
if (!$i) {
$ret[] = $sql;
return TRUE;
return true;
}
// Backquotes or no backslashes before quotes: it's indeed the
// end of the string -> exit the loop
else if ($string_start == '`' || $sql[$i-1] != '\\') {
elseif ($string_start == '`' || $sql[$i - 1] != '\\') {
$string_start = '';
$in_string = FALSE;
$in_string = false;
break;
}
// one or more Backslashes before the presumed end of string...
else {
// ... first checks for escaped backslashes
$j = 2;
$escaped_backslash = FALSE;
while ($i-$j > 0 && $sql[$i-$j] == '\\') {
$escaped_backslash = false;
while ($i - $j > 0 && $sql[$i - $j] == '\\') {
$escaped_backslash = !$escaped_backslash;
$j++;
}
@ -264,7 +260,7 @@ function split_sql_file(&$ret, $sql) {
// string -> exit the loop
if ($escaped_backslash) {
$string_start = '';
$in_string = FALSE;
$in_string = false;
break;
}
// ... else loop
@ -276,39 +272,39 @@ function split_sql_file(&$ret, $sql) {
} // end if (in string)
// lets skip comments (/*, -- and #)
else if (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) {
elseif (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) {
$i = strpos($sql, $char == '/' ? '*/' : "\n", $i);
// didn't we hit end of string?
if ($i === FALSE) {
if ($i === false) {
break;
}
if ($char == '/') $i++;
}
// We are not in a string, first check for delimiter...
else if ($char == ';') {
elseif ($char == ';') {
// if delimiter found, add the parsed part to the returned array
$ret[] = array('query' => substr($sql, 0, $i), 'empty' => $nothing);
$nothing = TRUE;
$nothing = true;
$sql = ltrim(substr($sql, min($i + 1, $sql_len)));
$sql_len = strlen($sql);
if ($sql_len) {
$i = -1;
} else {
// The submited statement(s) end(s) here
return TRUE;
return true;
}
} // end else if (is delimiter)
} // end elseif (is delimiter)
// ... then check for start of a string,...
else if (($char == '"') || ($char == '\'') || ($char == '`')) {
$in_string = TRUE;
$nothing = FALSE;
elseif (($char == '"') || ($char == '\'') || ($char == '`')) {
$in_string = true;
$nothing = false;
$string_start = $char;
} // end else if (is start of string)
} // end elseif (is start of string)
elseif ($nothing) {
$nothing = FALSE;
$nothing = false;
}
// loic1: send a fake header each 30 sec. to bypass browser timeout
@ -324,8 +320,8 @@ function split_sql_file(&$ret, $sql) {
$ret[] = array('query' => $sql, 'empty' => $nothing);
}
return TRUE;
} // end of the 'PMA_splitSqlFile()' function
return true;
} // end of the 'split_sql_file()' function
/**
* Get an SQL file's contents
@ -371,7 +367,7 @@ function get_sql_file_contents($file, $section, $print_errors = true) {
if (substr($line, 0, 2) == '--') {
//This is a comment. Check if section name, otherwise ignore
$result = array();
if (preg_match('/^-- xx([A-Z]*)xx/', $line,$result)) { //we got a section name here
if (preg_match('/^-- xx([A-Z]*)xx/', $line, $result)) { //we got a section name here
if ($result[1] == strtoupper($section)) {
//we have the section we are looking for, start recording
$record = true;
@ -395,6 +391,29 @@ function get_sql_file_contents($file, $section, $print_errors = true) {
return $section_contents;
}
/**
* Returns a list of language directories.
*/
function get_language_folder_list() {
$result = array();
$exceptions = array('.', '..', 'CVS', '.svn');
$search = array('_latin', '_unicode', '_corporate', '_org' , '_KM', '_');
$replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' ');
$dirname = api_get_path(SYS_LANG_PATH);
$handle = opendir($dirname);
while ($entries = readdir($handle)) {
if (in_array($entries, $exceptions)) {
continue;
}
if (is_dir($dirname.$entries)) {
$result[$entries] = ucwords(str_replace($search, $replace_with, $entries));
}
}
closedir($handle);
asort($result);
return $result;
}
// TODO: Maybe within the main API there is already a suitable function?
function my_directory_to_array($directory) {
$array_items = array();
@ -430,10 +449,10 @@ function add_document_180($_course, $path, $filetype, $filesize, $title, $commen
VALUES ('$path','$filetype','$filesize','".
Database::escape_string($title)."', '$comment')";
if (Database::query($sql)) {
//display_message("Added to database (id ".mysql_insert_id().")!");
return mysql_insert_id();
//display_message("Added to database (id ".Database::insert_id().")!");
return Database::insert_id();
} else {
//display_error("The uploaded file could not be added to the database (".mysql_error().")!");
//display_error("The uploaded file could not be added to the database (".Database::error().")!");
return false;
}
}

@ -54,7 +54,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (empty ($updateFromConfigFile) || !file_exists($_POST['updatePath'].$updateFromConfigFile) || !in_array(get_config_param('clarolineVersion'), $update_from_version_6)) {
@ -98,8 +98,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
@ -123,7 +123,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
if (empty($dbStatsForm)) $dbStatsForm = $dbNameForm;
@ -445,7 +445,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (!$only_test){
include('update-db-scorm-1.6.x-1.8.0.inc.php');
}
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
if(empty($dbStatsForm)) $dbStatsForm = $dbNameForm;
if(empty($dbScormForm)) $dbScormForm = $dbNameForm;

@ -54,7 +54,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -97,8 +97,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
@ -121,7 +121,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;
$dbScormForm = $dbNameForm;

@ -54,7 +54,7 @@ if( function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -97,8 +97,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -120,7 +120,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -54,7 +54,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
@ -96,8 +96,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -119,7 +119,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -36,7 +36,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
@ -78,8 +78,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -101,7 +101,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -36,7 +36,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -79,8 +79,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -105,7 +105,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -36,7 +36,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -79,8 +79,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -102,7 +102,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -36,7 +36,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -79,8 +79,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -102,7 +102,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -36,7 +36,7 @@ if (function_exists('ini_set')) {
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
@ -79,8 +79,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><button type="submit" class="back" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -102,7 +102,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
$dbStatsForm = $dbNameForm;

@ -27,13 +27,13 @@
* IMPORTANT: This script has to be included by install/index.php or
* update_courses.php
*
* DOKEOS_INSTALL is defined in the install/index.php (means that we are in
* SYSTEM_INSTALLATION is defined in the install/index.php (means that we are in
* the regular upgrade process)
*
* DOKEOS_COURSE_UPDATE is defined in update_courses.php (means we are
* executing update_courses.php to update courses separately)
*
* When DOKEOS_INSTALL or DOKEOS_COURSE_UPDATE are defined, do for every course:
* When SYSTEM_INSTALLATION or DOKEOS_COURSE_UPDATE are defined, do for every course:
* - create a new set of directories that reflect the new tools offered by 1.8
* - record an item_property for each directory added
*
@ -67,7 +67,7 @@ function insert_db($db_name, $folder_name, $text) {
==============================================================================
*/
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$sys_course_path = $pathForm.'courses/';
//$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
@ -170,9 +170,9 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
//umask($old_umask); // This function is not thread-safe.
// Write the Dokeos config file
write_dokeos_config_file('../inc/conf/configuration.php');
write_system_config_file('../inc/conf/configuration.php');
// Write a distribution file with the config as a backup for the admin
write_dokeos_config_file('../inc/conf/configuration.dist.php');
write_system_config_file('../inc/conf/configuration.dist.php');
// Write a .htaccess file in the course repository
write_courses_htaccess_file($urlAppendPath);
copy($updatePath.'claroline/inc/conf/add_course.conf.php', $pathForm.'main/inc/conf/add_course.conf.php');
@ -192,7 +192,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
rename($updatePath.'claroline/upload/video', $pathForm.'main/upload/video');
/*
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
//nothing to do this time
}
*/

@ -40,7 +40,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');

@ -19,7 +19,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');

@ -19,7 +19,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');

@ -19,7 +19,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');

@ -13,7 +13,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');

@ -13,7 +13,7 @@ require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Start coding here...

@ -48,7 +48,7 @@ require_once("install_upgrade.lib.php");
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE'))
{
//check if the current Dokeos install is elligible for update
if (empty ($updateFromConfigFile) || !file_exists($_POST['updatePath'].$updateFromConfigFile) || !in_array(get_config_param('clarolineVersion'), $update_from_version))
@ -95,8 +95,8 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
<strong>'.get_lang('DBHost').'</strong> : '.$dbHostForm.'<br />
<strong>'.get_lang('DBLogin').'</strong> : '.$dbUsernameForm.'<br />
<strong>'.get_lang('DBPassword').'</strong> : '.$dbPassForm.'<br /><br />
'.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
<p><buton class="back" type="submit" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
'.get_lang('PleaseGoBackToStep').' '. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'.
<p><buton class="back" type="submit" name="step'. (defined('SYSTEM_INSTALLATION') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
@ -113,7 +113,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
//if this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
if (defined('DOKEOS_INSTALL'))
if (defined('SYSTEM_INSTALLATION'))
{
/**
* Update the databases "pre" migration

@ -29,10 +29,10 @@
* Updates the Dokeos files from an older version
* IMPORTANT: This script has to be included by install/index.php and update_courses.php
*
* DOKEOS_INSTALL is defined in the install/index.php
* SYSTEM_INSTALLATION is defined in the install/index.php
* DOKEOS_COURSE_UPDATE is defined in update_courses.php
*
* When DOKEOS_INSTALL or DOKEOS_COURSE_UPDATE is defined, do for every course:
* When SYSTEM_INSTALLATION or DOKEOS_COURSE_UPDATE is defined, do for every course:
* - remove the .htaccess in the document folder
* - remove the index.php in the group folder
* - write a new group/index.php file, make it an empty html file
@ -46,7 +46,7 @@
* - remove the visibility field from the document table
* - update the item properties of the group documents
*
* Additionally, when DOKEOS_INSTALL is defined
* Additionally, when SYSTEM_INSTALLATION is defined
* - write a config file, configuration.php, with important settings
* - write a .htaccess file (with instructions for Apache) in the courses directory
* - remove the new main/upload/users directory and rename the main/img/users
@ -138,7 +138,7 @@ function fill_document_table($dir)
==============================================================================
*/
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$newPath = str_replace('\\', '/', realpath('../..')).'/';
$oldPath = $_POST['updatePath'];
@ -199,13 +199,13 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
if (defined('DOKEOS_INSTALL')) {
if (defined('SYSTEM_INSTALLATION')) {
// Write the Dokeos config file
write_dokeos_config_file($newPath.'main/inc/conf/configuration.php');
write_system_config_file($newPath.'main/inc/conf/configuration.php');
// Write a distribution file with the config as a backup for the admin
write_dokeos_config_file($newPath.'main/inc/conf/configuration.dist.php');
write_system_config_file($newPath.'main/inc/conf/configuration.dist.php');
// Write a .htaccess file in the course repository
write_courses_htaccess_file($urlAppendPath);

@ -62,7 +62,7 @@ require '../lang/english/install.inc.php';
require_once 'install_upgrade.lib.php';
require_once 'upgrade_lib.php';
define('DOKEOS_INSTALL', 1);
define('SYSTEM_INSTALLATION', 1);
define('MAX_COURSE_TRANSFER', 100);
define('INSTALL_TYPE_UPDATE', 'update');
define('FORM_FIELD_DISPLAY_LENGTH', 40);
@ -589,29 +589,6 @@ function display_upgrade_header($text_dir, $dokeos_version, $install_type, $upda
<?php
}
/**
* TODO: Copy/paste again. Find an existing function for this job.
* Return a list of language directories.
* @todo function does not belong here, move to code library,
* also see infocours.php which contains similar function
*/
function get_language_folder_list() {
$dirname = dirname(__FILE__).'/../lang';
if ($dirname[strlen($dirname) - 1] != '/')
$dirname .= '/';
$handle = opendir($dirname);
while ($entries = readdir($handle)) {
if ($entries == '.' || $entries == '..' || $entries == '.svn')
continue;
if (is_dir($dirname.$entries)) {
$language_list[$entries] = api_ucfirst($entries);
}
}
closedir($handle);
asort($language_list);
return $language_list;
}
function display_installation_overview() {
echo '<div id="installation_steps">';
echo '<img src="../img/bluelogo.gif" hspace="10" vspace="10" alt="Dokeos logo" />';

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<br />
</body>
</html>

@ -49,7 +49,6 @@ class TestMainApi extends UnitTestCase {
WEB_PATH => '',
SYS_PATH => '',
REL_PATH => '',
REL_SYS_PATH => '',
WEB_SERVER_ROOT_PATH => '',
SYS_SERVER_ROOT_PATH => '',
WEB_COURSE_PATH => '',

Loading…
Cancel
Save