diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql
index 42ca4d473c..297803069c 100644
--- a/main/install/dokeos_main.sql
+++ b/main/install/dokeos_main.sql
@@ -636,7 +636,7 @@ VALUES
('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0),
('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0),
('wcag_anysurfer_public_pages', NULL, 'radio','Platform','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0),
-('stylesheets', NULL, 'textfield','stylesheets','public_admin','',NULL, NULL, NULL, 1),
+('stylesheets', NULL, 'textfield','stylesheets','dokeos_blue','',NULL, NULL, NULL, 1),
('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0),
('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0),
('upload_extensions_whitelist', NULL, 'textfield', 'Security', 'htm;html;jpg;jpeg;gif;png;swf;avi;mpg;mpeg', 'UploadExtensionsWhitelist', 'UploadExtensionsWhitelistComment', NULL, NULL, 0),
diff --git a/main/install/update_courses.php b/main/install/update_courses.php
index 1d89a017fc..6b47232b24 100644
--- a/main/install/update_courses.php
+++ b/main/install/update_courses.php
@@ -122,7 +122,7 @@ elseif($_POST['step1'])
-- Dokeos course update -- version
-
+
@@ -217,7 +217,7 @@ else
-
+
_formBuilt = true;
- $this->addElement('select', 'install_language', get_lang('InstallationLanguage'), get_language_folder_list());
- $buttons[0] = & HTML_QuickForm :: createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($buttons, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-/**
- * Class for requirements page
- * This checks and informs about some requirements for installing Dokeos:
- * - necessary and optional extensions
- * - folders which have to be writable
- */
-class Page_Requirements extends HTML_QuickForm_Page
-{
- /**
- * this function checks if a php extension exists or not
- *
- * @param string $extentionName name of the php extension to be checked
- * @param boolean $echoWhenOk true => show ok when the extension exists
- * @author Christophe Gesche
- */
- function check_extension($extentionName)
- {
- if (extension_loaded($extentionName))
- {
- return ''.$extentionName.' - ok ';
- }
- else
- {
- return ''.$extentionName.' is missing (Dokeos can work without) ('.$extentionName.' ) ';
- }
- }
- function get_not_writable_folders()
- {
- $writable_folders = array ('../inc/conf', '../upload', '../../archive', '../../courses', '../../home');
- $not_writable = array ();
- $perm = api_get_setting('permissions_for_new_directories');
- $perm = octdec(!empty($perm)?$perm:'0770');
- foreach ($writable_folders as $index => $folder)
- {
- if (!is_writable($folder) && !@ chmod($folder, $perm))
- {
- $not_writable[] = $folder;
- }
- }
- return $not_writable;
- }
- function get_title()
- {
- return get_lang("Requirements");
- }
- function get_info()
- {
- $not_writable = $this->get_not_writable_folders();
-
- if (count($not_writable) > 0)
- {
- $info[] = '';
- $info[] = 'Some files or folders don\'t have writing permission. To be able to install Dokeos you should first change their permissions (using CHMOD). Please read the
installation guide .';
- $info[] = '
';
- foreach ($not_writable as $index => $folder)
- {
- $info[] = ''.$folder.' ';
- }
- $info[] = ' ';
- $info[] = '
';
- $this->disableNext = true;
- }
- elseif (file_exists('../inc/conf/claro_main.conf.php'))
- {
- $info[] = '';
- $info[] = get_lang("WarningExistingDokeosInstallationDetected");
- $info[] = '
';
- }
- $info[] = ''.get_lang("ReadThoroughly").' ';
- $info[] = ' ';
- $info[] = get_lang("DokeosNeedFollowingOnServer");
- $info[] = "";
- $info[] = "Webserver with PHP 5.x";
- $info[] = '';
- $info[] = $this->check_extension('standard');
- $info[] = $this->check_extension('session');
- $info[] = $this->check_extension('mysql');
- $info[] = $this->check_extension('zlib');
- $info[] = $this->check_extension('pcre');
- $info[] = ' ';
- $info[] = "MySQL + login/password allowing to access and create at least one database ";
- $info[] = "Write access to web directory where Dokeos files have been put ";
- $info[] = " ";
- $info[] = get_lang('MoreDetails').", read the installation guide .";
- return implode("\n",$info);
- }
- function buildForm()
- {
- global $updateFromVersion;
- $this->_formBuilt = true;
- $this->addElement('radio', 'installation_type', get_lang('InstallType'), get_lang('NewInstall'), 'new');
- $update_group[0] = & HTML_QuickForm :: createElement('radio', 'installation_type', null, 'Update from Dokeos '.implode('|', $updateFromVersion).'', 'update');
- //$this->addGroup($update_group, 'update_group', '', ' ', false);
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $not_writable = $this->get_not_writable_folders();
- if (count($not_writable) > 0)
- {
- $el = $prevnext[1];
- $el->updateAttributes('disabled="disabled"');
- }
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-/**
- * Page in the install wizard to select the location of the old Dokeos installation.
- */
-class Page_LocationOldVersion extends HTML_QuickForm_Page
-{
- function get_title()
- {
- return 'Old version root path';
- }
- function get_info()
- {
- return 'Give location of your old Dokeos installation ';
- }
- function buildForm()
- {
- $this->_formBuilt = true;
- $this->addElement('text', 'old_version_path', 'Old version root path');
- $this->applyFilter('old_version_path', 'trim');
- $this->addRule('old_version_path', get_lang('ThisFieldIsRequired'), 'required');
- $this->addRule('old_version_path', get_lang('BadUpdatePath'), 'callback', 'check_update_path');
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-/**
- * Class for license page
- * Displays the GNU GPL license that has to be accepted to install Dokeos.
- */
-class Page_License extends HTML_QuickForm_Page
-{
- function get_title()
- {
- return get_lang('Licence');
- }
- function get_info()
- {
- return get_lang('DokeosLicenseInfo');
- }
- function buildForm()
- {
- $this->_formBuilt = true;
- $this->addElement('textarea', 'license', get_lang('Licence'), array ('cols' => 80, 'rows' => 20, 'disabled' => 'disabled', 'style'=>'background-color: white;'));
- $this->addElement('checkbox','license_accept','',get_lang('IAccept'));
- $this->addRule('license_accept',get_lang('ThisFieldIsRequired'),'required');
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-/**
- * Class for database settings page
- * Displays a form where the user can enter the installation settings
- * regarding the databases - login and password, names, prefixes, single
- * or multiple databases, tracking or not...
- */
-class Page_DatabaseSettings extends HTML_QuickForm_Page
-{
- function get_title()
- {
- return get_lang('DBSetting');
- }
- function get_info()
- {
- return get_lang('DBSettingIntro');
- }
- function buildForm()
- {
- $this->_formBuilt = true;
- $this->addElement('text', 'database_host', get_lang("DBHost"), array ('size' => '40'));
- $this->addRule('database_host', 'ThisFieldIsRequired', 'required');
- $this->addElement('text', 'database_username', get_lang("DBLogin"), array ('size' => '40'));
- $this->addElement('password', 'database_password', get_lang("DBPassword"), array ('size' => '40'));
- $this->addRule(array('database_host','database_username','database_password'),get_lang('CouldNotConnectToDatabase'),new ValidateDatabaseConnection());
- $this->addElement('text', 'database_prefix', get_lang("DbPrefixForm"), array ('size' => '40'));
- $this->addElement('text', 'database_main_db', get_lang("MainDB"), array ('size' => '40'));
- $this->addRule('database_main_db', 'ThisFieldIsRequired', 'required');
- $this->addElement('text', 'database_tracking', get_lang("StatDB"), array ('size' => '40'));
- $this->addRule('database_tracking', 'ThisFieldIsRequired', 'required');
- $this->addElement('text', 'database_scorm', get_lang("ScormDB"), array ('size' => '40'));
- $this->addRule('database_scorm', 'ThisFieldIsRequired', 'required');
- $this->addElement('text', 'database_user', get_lang("UserDB"), array ('size' => '40'));
- $this->addRule('database_user', 'ThisFieldIsRequired', 'required');
- //$this->addElement('text', 'database_repository', get_lang("RepositoryDatabase"), array ('size' => '40'));
- //$this->addRule('database_repository', 'ThisFieldIsRequired', 'required');
- //$this->addElement('text', 'database_weblcms', get_lang("WeblcmsDatabase"), array ('size' => '40'));
- //$this->addRule('database_weblcms', 'ThisFieldIsRequired', 'required');
- //$this->addElement('text', 'database_personal_calendar', get_lang("PersonalCalendarDatabase"), array ('size' => '40'));
- //$this->addRule('database_personal_calendar', 'ThisFieldIsRequired', 'required');
- //$this->addElement('text', 'database_personal_messenger', get_lang("PersonalMessageDatabase"), array ('size' => '40'));
- //$this->addRule('database_personal_messenger', 'ThisFieldIsRequired', 'required');
- //$this->addElement('text', 'database_profiler', get_lang("ProfilerDatabase"), array ('size' => '40'));
- //$this->addRule('database_profiler', 'ThisFieldIsRequired', 'required');
-
- $enable_tracking[] = & $this->createElement('radio', 'enable_tracking', null, get_lang("Yes"), 1);
- $enable_tracking[] = & $this->createElement('radio', 'enable_tracking', null, get_lang("No"), 0);
- $this->addGroup($enable_tracking, 'tracking', get_lang("EnableTracking"), ' ', false);
- $several_db[] = & $this->createElement('radio', 'database_single', null, get_lang("One"),1);
- $several_db[] = & $this->createElement('radio', 'database_single', null, get_lang("Several"),0);
- $this->addGroup($several_db, 'db', get_lang("SingleDb"), ' ', false);
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-class ValidateDatabaseConnection extends HTML_QuickForm_Rule
-{
- public function validate($parameters)
- {
- $db_host = $parameters[0];
- $db_user = $parameters[1];
- $db_password = $parameters[2];
- if(mysql_connect($db_host,$db_user,$db_password))
- {
- return true;
- }
- return false;
- }
-}
-
-/**
- * Page in the install wizard in which some config settings are asked to the
- * user.
- */
-class Page_ConfigSettings extends HTML_QuickForm_Page
-{
- function get_title()
- {
- return get_lang('CfgSetting');
- }
- function get_info()
- {
- return get_lang('ConfigSettingsInfo');
- }
- function buildForm()
- {
- $this->_formBuilt = true;
- $languages = array ();
- $languages['dutch'] = 'dutch';
- $this->addElement('select', 'platform_language', get_lang("MainLang"), get_language_folder_list());
- $this->addElement('text', 'platform_url', get_lang("DokeosURL"), array ('size' => '40'));
- $this->addRule('platform_url', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'admin_email', get_lang("AdminEmail"), array ('size' => '40'));
- $this->addRule('admin_email', get_lang('ThisFieldIsRequired'), 'required');
- $this->addRule('admin_email', get_lang('WrongEmail'), 'email');
- $this->addElement('text', 'admin_lastname', get_lang("AdminLastName"), array ('size' => '40'));
- $this->addRule('admin_lastname', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'admin_firstname', get_lang("AdminFirstName"), array ('size' => '40'));
- $this->addRule('admin_firstname', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'admin_phone', get_lang("AdminPhone"), array ('size' => '40'));
- $this->addElement('text', 'admin_username', get_lang("AdminLogin"), array ('size' => '40'));
- $this->addRule('admin_username', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'admin_password', get_lang("AdminPass"), array ('size' => '40'));
- $this->addRule('admin_password', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'platform_name', get_lang("CampusName"), array ('size' => '40'));
- $this->addRule('platform_name', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'organization_name', get_lang("InstituteShortName"), array ('size' => '40'));
- $this->addRule('organization_name', get_lang('ThisFieldIsRequired'), 'required');
- $this->addElement('text', 'organization_url', get_lang("InstituteURL"), array ('size' => '40'));
- $this->addRule('organization_url', get_lang('ThisFieldIsRequired'), 'required');
- $encrypt[] = & $this->createElement('radio', 'encrypt_password', null, get_lang('Yes'), 1);
- $encrypt[] = & $this->createElement('radio', 'encrypt_password', null, get_lang('No'), 0);
- $this->addGroup($encrypt, 'tracking', get_lang("EncryptUserPass"), ' ', false);
- $self_reg[] = & $this->createElement('radio', 'self_reg', null, get_lang('Yes'), 1);
- $self_reg[] = & $this->createElement('radio', 'self_reg', null, get_lang('No'), 0);
- $this->addGroup($self_reg, 'tracking', get_lang("AllowSelfReg"), ' ', false);
- $self_reg_teacher[] = & $this->createElement('radio', 'self_reg_teacher', null, get_lang('Yes'), 1);
- $self_reg_teacher[] = & $this->createElement('radio', 'self_reg_teacher', null, get_lang('No'), 0);
- $this->addGroup($self_reg_teacher, 'tracking', get_lang("AllowSelfRegProf"), ' ', false);
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-/**
- * Page in the install wizard in which a final overview of all settings is
- * displayed.
- */
-class Page_ConfirmSettings extends HTML_QuickForm_Page
-{
- function get_title()
- {
- return get_lang('LastCheck');
- }
- function get_info()
- {
- return 'Here are the values you entered
-
- Print this page to remember your password and other settings ';
-
- }
- function buildForm()
- {
- $wizard = $this->controller;
- $values = $wizard->exportValues();
- $this->addElement('static', 'confirm_platform_language', get_lang("MainLang"), $values['platform_language']);
- $this->addElement('static', 'confirm_platform_url', get_lang("DokeosURL"), $values['platform_url']);
- $this->addElement('static', 'confirm_admin_email', get_lang("AdminEmail"), $values['admin_email']);
- $this->addElement('static', 'confirm_admin_lastname', get_lang("AdminLastName"), $values['admin_lastname']);
- $this->addElement('static', 'confirm_admin_firstname', get_lang("AdminFirstName"), $values['admin_firstname']);
- $this->addElement('static', 'confirm_admin_phone', get_lang("AdminPhone"), $values['admin_phone']);
- $this->addElement('static', 'confirm_admin_username', get_lang("AdminLogin"), $values['admin_username']);
- $this->addElement('static', 'confirm_admin_password', get_lang("AdminPass"), $values['admin_password']);
- $this->addElement('static', 'confirm_platform_name', get_lang("CampusName"), $values['platform_name']);
- $this->addElement('static', 'confirm_organization_name', get_lang("InstituteShortName"), $values['organization_name']);
- $this->addElement('static', 'confirm_organization_url', get_lang("InstituteURL"), $values['organization_url']);
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
- $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
- $this->addGroup($prevnext, 'buttons', '', ' ', false);
- $this->setDefaultAction('next');
- }
-}
-
-
-/**
- * Class to render a page in the install wizard.
- */
-class ActionDisplay extends HTML_QuickForm_Action_Display
-{
- /**
- * Displays the HTML-code of a page in the wizard
- * @param HTML_Quickform_Page $page The page to display.
- */
- function _renderForm(& $current_page)
- {
- global $charset;
-
- global $dokeos_version, $installType, $updateFromVersion;
- $renderer = & $current_page->defaultRenderer();
- $current_page->setRequiredNote('* '.get_lang('ThisFieldIsRequired'));
- $element_template = "\n\t\n\t\t* {label} \n\t\t{error} \t{element} \n\t ";
- $renderer->setElementTemplate($element_template);
- $header_template = "\n\t\n\t\t{header} \n\t ";
- $renderer->setHeaderTemplate($header_template);
- HTML_QuickForm :: setRequiredNote('* '.get_lang('ThisFieldIsRequired').' ');
- $current_page->accept($renderer);
-?>
-
-
-
- -- Dokeos - upgrade to version
-
-
-
-
-
-
-
- controller->_pages;
- $total_number_of_pages = count($all_pages);
- $current_page_number = 0;
- $page_number = 0;
- echo '
';
- foreach($all_pages as $index => $page)
- {
- $page_number++;
- if($page->get_title() == $current_page->get_title())
- {
- $current_page_number = $page_number;
- echo ''.$page->get_title().' ';
- }
- else
- {
- echo ''.$page->get_title().' ';
- }
- }
- echo ' ';
- echo '
';
- echo '';
- echo '
'.get_lang('Step').' '.$current_page_number.' '.get_lang('of').' '.$total_number_of_pages.' – '.$current_page->get_title().' ';
- echo '
';
- echo $current_page->get_info();
- echo '
';
- echo $renderer->toHtml();
- ?>
-
-
-
-
-
- controller->exportValues();
- ?>
-
-
-
- -- Dokeos installation -- version
-
-
-
-
-
- Dokeos installation - version
-
-
-
- ';
-
- global $repository_database;
- global $weblcms_database;
- global $personal_calendar_database;
- global $user_database;
- global $personal_messenger_database;
- global $profiler_database;
-
- $repository_database = $values['database_repository'];
- $weblcms_database = $values['database_weblcms'];
- $personal_calendar_database = $values['database_personal_calendar'];
- $user_database = $values['database_user'];
- $personal_messenger_database = $values['database_personal_messenger'];
- $profiler_database = $values['database_profiler'];
-
- /*full_database_install($values);
- full_file_install($values);
- create_admin_in_user_table($values);
- create_default_categories_in_weblcms();*/
- echo "
Performing upgrade to latest version....
";
-
- //upgrade_16x_to_180($values);
-
- echo '';
- $page->controller->container(true);
- ?>
-
-
-
-
-
-
-
-
- —
-
-
-
-
-
-
-
-
- ';
- echo ' ';
- echo '';
- echo ' ' . get_lang('InstallationLanguage') . ' ';
- echo ' ' . get_lang('Requirements') . ' ';
- echo ' ' . get_lang('Licence') . ' ';
- echo ' ' . get_lang('DBSetting') . ' ';
- echo ' ' . get_lang('CfgSetting') . ' ';
- echo ' ' . get_lang('PrintOverview') . ' ';
- echo ' ' . get_lang('Installing') . ' ';
- echo ' ';
- echo '';
-}
-
-/**
- * This function prints class=active_step $current_step=$param
- * @author Patrick Cool , Ghent University
- */
-function step_active($this_step)
-{
- global $current_active_step;
- if ($current_active_step == $this_step)
- {
- return ' class="current_step" ';
- }
-}
-
-// Rule to check update path
-function check_update_path($path)
-{
- global $update_from_version;
- // Make sure path has a trailing /
- $path = substr($path,-1) != '/' ? $path.'/' : $path;
- // Check the path
- if (file_exists($path))
- {
- //search for 1.6.x installation
- $version = get_installed_version($path, 'platformVersion');
-
- //search for 1.8.x installation
- //if (! isset($version) || $version == '')
- //{
- // $version = get_installed_version($path, 'dokeos_version');
- //}
-
- if (in_array($version, $update_from_version))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- return false;
-}
-
-/**
- * This function returns the installed version of
- * the older installation to upgrade by checking the
- * claroline/inc/installedVersion.inc.php file.
- */
-function get_installed_version($old_installation_path, $parameter)
-{
- if( file_exists($old_installation_path.'claroline/inc/installedVersion.inc.php') )
- {
- $version_info_file = 'claroline/inc/installedVersion.inc.php';
- }
- // with include_once inside a function, variables aren't remembered for later use
- include($old_installation_path.$version_info_file);
- if (isset($$parameter))
- {
- return $$parameter;
- }
-}
-
-/**
- * This function returns a the value of a parameter from the configuration file
- * of a previous installation.
- *
- * IMPORTANT
- * - Before Dokeos 1.8 the main code folder was called 'claroline'. Since Dokeos 1.8
- * this folder is called 'main' -> we have to make a difference based on previous
- * version.
- * - The version may be in the config file or in the installedVersion file...
- *
- * WARNING - this function relies heavily on global variables $updateFromConfigFile
- * and $configFile, and also changes these globals. This can be rewritten.
- *
- * @param string $param the parameter which the value is returned for
- * @return string the value of the parameter
- * @author Olivier Brouckaert
- */
-function get_config_param($param,$path)
-{
- global $configFile, $updateFromConfigFile;
-
- if (empty ($updateFromConfigFile))
- {
- if (file_exists($path.'claroline/include/config.inc.php'))
- {
- $updateFromConfigFile = 'claroline/include/config.inc.php';
- }
- elseif (file_exists($path.'claroline/inc/conf/claro_main.conf.php'))
- {
- $updateFromConfigFile = 'claroline/inc/conf/claro_main.conf.php';
- }
- else
- {
- return;
- }
- }
-
- //echo "reading from file $path$updateFromConfigFile, which exists...";
-
- if (is_array($configFile) && isset ($configFile[$param]))
- {
- return $configFile[$param];
- }
- elseif (file_exists($path.$updateFromConfigFile))
- {
- $configFile = array ();
-
- $temp = file($path.$updateFromConfigFile);
-
- $val = '';
-
- foreach ($temp as $enreg)
- {
- if (strstr($enreg, '='))
- {
- $enreg = explode('=', $enreg);
-
- 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)));
-
- if (strtolower($enreg[1]) == 'true')
- {
- $enreg[1] = 1;
- }
- if (strtolower($enreg[1]) == 'false')
- {
- $enreg[1] = 0;
- }
- else
- {
- $implode_string = ' ';
-
- if (!strstr($enreg[1], '." ".') && strstr($enreg[1], '.$'))
- {
- $enreg[1] = str_replace('.$', '." ".$', $enreg[1]);
- $implode_string = '';
- }
-
- $tmp = explode('." ".', $enreg[1]);
-
- 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), $path);
- }
- }
-
- $enreg[1] = implode($implode_string, $tmp);
- }
-
- $configFile[$enreg[0]] = $enreg[1];
-
- if ($enreg[0] == $param)
- {
- $val = $enreg[1];
- }
- }
- }
- }
-
- return $val;
- }
-}
-
-/*
-==============================================================================
- MAIN CODE
-==============================================================================
-*/
-global $current_active_step;
-$current_active_step = '1';
-$install_type = 'update';
-//display_upgrade_header($text_dir, $dokeos_version, $install_type, $update_from_version);
-//display_installation_overview();
-
-// Create a new wizard
-$wizard = & new HTML_QuickForm_Controller('regWizard', true);
-
-//Add pages to wizard - path to follow for upgrade
-//$wizard->addPage(new Page_Language('page_language'));
-//$wizard->addPage(new Page_Requirements('page_requirements'));
-$wizard->addPage(new Page_LocationOldVersion('page_location_old_version'));
-$values = $wizard->exportValues();
-if( isset($values['old_version_path']) && $values['old_version_path'] != '/var/www/html/old_version/' )
-{
- $path = $values['old_version_path'];
- $defaults['platform_language'] = get_config_param('platformLanguage',$path);
- $defaults['platform_url'] = 'http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
- //to keep debug output readable:
- //$defaults['license'] = 'GNU GPL v2';
- //actual license:
- $defaults['license'] = implode("\n", file('../../documentation/license.txt'));
- $defaults['database_host'] = get_config_param('dbHost',$path);
- $defaults['database_main_db'] = get_config_param('mainDbName',$path);
- $defaults['database_tracking'] = get_config_param('statsDbName',$path);
- $defaults['database_scorm'] = get_config_param('scormDbName',$path);
- $defaults['database_user'] = get_config_param('user_personal_database',$path);
- //$defaults['database_repository'] = 'dokeos_repository';
- //$defaults['database_weblcms'] = 'dokeos_weblcms';
- $defaults['database_username'] = get_config_param('dbLogin',$path);
- $defaults['database_password'] = get_config_param('dbPass',$path);
- $defaults['database_prefix'] = get_config_param('dbNamePrefix',$path);
- $defaults['enable_tracking'] = get_config_param('is_trackingEnabled',$path);
- $defaults['database_single'] = get_config_param('singleDbEnabled',$path);
- $defaults['admin_lastname'] = 'Doe';
- $defaults['admin_firstname'] = mt_rand(0,1)?'John':'Jane';
- $defaults['admin_email'] = get_config_param('emailAdministrator',$path);
- $defaults['admin_username'] = 'admin';
- $defaults['admin_password'] = api_generate_password();
- $defaults['admin_phone'] = get_config_param('administrator["phone"]',$path);
- $defaults['platform_name'] = get_config_param('siteName',$path);
- $defaults['encrypt_password'] = 1;
- $defaults['organization_name'] = get_config_param('institution["name"]',$path);
- $defaults['organization_url'] = get_config_param('institution["url"]',$path);
- if (get_config_param('userPasswordCrypted',$path)==1) {
- $defaults['encrypt_password'] = 'md5';
- } elseif (get_config_param('userPasswordCrypted',$path)==0){
- $defaults['encrypt_password'] = 'none';
- }
- //$defaults['encrypt_password'] = get_config_param('userPasswordCrypted',$path);
- $defaults['self_reg'] = get_config_param('allowSelfReg',$path);
-}
-else
-{
- //old version path not correct yet
-}
-
-$wizard->addPage(new Page_License('page_license'));
-$wizard->addPage(new Page_DatabaseSettings('page_databasesettings'));
-$wizard->addPage(new Page_ConfigSettings('page_configsettings'));
-$wizard->addPage(new Page_ConfirmSettings('page_confirmsettings'));
-
-$defaults['install_language'] = 'english';
-//$defaults['old_version_path'] = '/var/www/html/old_version/';
-$defaults['old_version_path'] = '';
-
-// Set the default values
-$wizard->setDefaults($defaults);
-
-// Add the process action to the wizard
-$wizard->addAction('process', new ActionProcess());
-
-// Add the display action to the wizard
-$wizard->addAction('display', new ActionDisplay());
-
-// Set the installation language
-$install_language = $wizard->exportValue('page_language', 'install_language');
-require_once ('../lang/english/trad4all.inc.php');
-require_once ('../lang/english/install.inc.php');
-include_once ("../lang/$install_language/trad4all.inc.php");
-include_once ("../lang/$install_language/install.inc.php");
-
-// Set default platform language to the selected install language
-$defaults['platform_language'] = $install_language;
-$wizard->setDefaults($defaults);
-
-// Start the wizard
-$wizard->run();
-
-// Set the installation language
-$install_language = $wizard->exportValue('page_language', 'install_language');
-require_once ('../lang/english/trad4all.inc.php');
-require_once ('../lang/english/install.inc.php');
-include_once ("../lang/$install_language/trad4all.inc.php");
-include_once ("../lang/$install_language/install.inc.php");
-
-//$values = $wizard->exportValues();
-
-?>
+_formBuilt = true;
+ $this->addElement('select', 'install_language', get_lang('InstallationLanguage'), get_language_folder_list());
+ $buttons[0] = & HTML_QuickForm :: createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($buttons, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+/**
+ * Class for requirements page
+ * This checks and informs about some requirements for installing Dokeos:
+ * - necessary and optional extensions
+ * - folders which have to be writable
+ */
+class Page_Requirements extends HTML_QuickForm_Page
+{
+ /**
+ * this function checks if a php extension exists or not
+ *
+ * @param string $extentionName name of the php extension to be checked
+ * @param boolean $echoWhenOk true => show ok when the extension exists
+ * @author Christophe Gesche
+ */
+ function check_extension($extentionName)
+ {
+ if (extension_loaded($extentionName))
+ {
+ return ''.$extentionName.' - ok ';
+ }
+ else
+ {
+ return ''.$extentionName.' is missing (Dokeos can work without) ('.$extentionName.' ) ';
+ }
+ }
+ function get_not_writable_folders()
+ {
+ $writable_folders = array ('../inc/conf', '../upload', '../../archive', '../../courses', '../../home');
+ $not_writable = array ();
+ $perm = api_get_setting('permissions_for_new_directories');
+ $perm = octdec(!empty($perm)?$perm:'0770');
+ foreach ($writable_folders as $index => $folder)
+ {
+ if (!is_writable($folder) && !@ chmod($folder, $perm))
+ {
+ $not_writable[] = $folder;
+ }
+ }
+ return $not_writable;
+ }
+ function get_title()
+ {
+ return get_lang("Requirements");
+ }
+ function get_info()
+ {
+ $not_writable = $this->get_not_writable_folders();
+
+ if (count($not_writable) > 0)
+ {
+ $info[] = '';
+ $info[] = 'Some files or folders don\'t have writing permission. To be able to install Dokeos you should first change their permissions (using CHMOD). Please read the
installation guide .';
+ $info[] = '
';
+ foreach ($not_writable as $index => $folder)
+ {
+ $info[] = ''.$folder.' ';
+ }
+ $info[] = ' ';
+ $info[] = '
';
+ $this->disableNext = true;
+ }
+ elseif (file_exists('../inc/conf/claro_main.conf.php'))
+ {
+ $info[] = '';
+ $info[] = get_lang("WarningExistingDokeosInstallationDetected");
+ $info[] = '
';
+ }
+ $info[] = ''.get_lang("ReadThoroughly").' ';
+ $info[] = ' ';
+ $info[] = get_lang("DokeosNeedFollowingOnServer");
+ $info[] = "";
+ $info[] = "Webserver with PHP 5.x";
+ $info[] = '';
+ $info[] = $this->check_extension('standard');
+ $info[] = $this->check_extension('session');
+ $info[] = $this->check_extension('mysql');
+ $info[] = $this->check_extension('zlib');
+ $info[] = $this->check_extension('pcre');
+ $info[] = ' ';
+ $info[] = "MySQL + login/password allowing to access and create at least one database ";
+ $info[] = "Write access to web directory where Dokeos files have been put ";
+ $info[] = " ";
+ $info[] = get_lang('MoreDetails').", read the installation guide .";
+ return implode("\n",$info);
+ }
+ function buildForm()
+ {
+ global $updateFromVersion;
+ $this->_formBuilt = true;
+ $this->addElement('radio', 'installation_type', get_lang('InstallType'), get_lang('NewInstall'), 'new');
+ $update_group[0] = & HTML_QuickForm :: createElement('radio', 'installation_type', null, 'Update from Dokeos '.implode('|', $updateFromVersion).'', 'update');
+ //$this->addGroup($update_group, 'update_group', '', ' ', false);
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $not_writable = $this->get_not_writable_folders();
+ if (count($not_writable) > 0)
+ {
+ $el = $prevnext[1];
+ $el->updateAttributes('disabled="disabled"');
+ }
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+/**
+ * Page in the install wizard to select the location of the old Dokeos installation.
+ */
+class Page_LocationOldVersion extends HTML_QuickForm_Page
+{
+ function get_title()
+ {
+ return 'Old version root path';
+ }
+ function get_info()
+ {
+ return 'Give location of your old Dokeos installation ';
+ }
+ function buildForm()
+ {
+ $this->_formBuilt = true;
+ $this->addElement('text', 'old_version_path', 'Old version root path');
+ $this->applyFilter('old_version_path', 'trim');
+ $this->addRule('old_version_path', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addRule('old_version_path', get_lang('BadUpdatePath'), 'callback', 'check_update_path');
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+/**
+ * Class for license page
+ * Displays the GNU GPL license that has to be accepted to install Dokeos.
+ */
+class Page_License extends HTML_QuickForm_Page
+{
+ function get_title()
+ {
+ return get_lang('Licence');
+ }
+ function get_info()
+ {
+ return get_lang('DokeosLicenseInfo');
+ }
+ function buildForm()
+ {
+ $this->_formBuilt = true;
+ $this->addElement('textarea', 'license', get_lang('Licence'), array ('cols' => 80, 'rows' => 20, 'disabled' => 'disabled', 'style'=>'background-color: white;'));
+ $this->addElement('checkbox','license_accept','',get_lang('IAccept'));
+ $this->addRule('license_accept',get_lang('ThisFieldIsRequired'),'required');
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+/**
+ * Class for database settings page
+ * Displays a form where the user can enter the installation settings
+ * regarding the databases - login and password, names, prefixes, single
+ * or multiple databases, tracking or not...
+ */
+class Page_DatabaseSettings extends HTML_QuickForm_Page
+{
+ function get_title()
+ {
+ return get_lang('DBSetting');
+ }
+ function get_info()
+ {
+ return get_lang('DBSettingIntro');
+ }
+ function buildForm()
+ {
+ $this->_formBuilt = true;
+ $this->addElement('text', 'database_host', get_lang("DBHost"), array ('size' => '40'));
+ $this->addRule('database_host', 'ThisFieldIsRequired', 'required');
+ $this->addElement('text', 'database_username', get_lang("DBLogin"), array ('size' => '40'));
+ $this->addElement('password', 'database_password', get_lang("DBPassword"), array ('size' => '40'));
+ $this->addRule(array('database_host','database_username','database_password'),get_lang('CouldNotConnectToDatabase'),new ValidateDatabaseConnection());
+ $this->addElement('text', 'database_prefix', get_lang("DbPrefixForm"), array ('size' => '40'));
+ $this->addElement('text', 'database_main_db', get_lang("MainDB"), array ('size' => '40'));
+ $this->addRule('database_main_db', 'ThisFieldIsRequired', 'required');
+ $this->addElement('text', 'database_tracking', get_lang("StatDB"), array ('size' => '40'));
+ $this->addRule('database_tracking', 'ThisFieldIsRequired', 'required');
+ $this->addElement('text', 'database_scorm', get_lang("ScormDB"), array ('size' => '40'));
+ $this->addRule('database_scorm', 'ThisFieldIsRequired', 'required');
+ $this->addElement('text', 'database_user', get_lang("UserDB"), array ('size' => '40'));
+ $this->addRule('database_user', 'ThisFieldIsRequired', 'required');
+ //$this->addElement('text', 'database_repository', get_lang("RepositoryDatabase"), array ('size' => '40'));
+ //$this->addRule('database_repository', 'ThisFieldIsRequired', 'required');
+ //$this->addElement('text', 'database_weblcms', get_lang("WeblcmsDatabase"), array ('size' => '40'));
+ //$this->addRule('database_weblcms', 'ThisFieldIsRequired', 'required');
+ //$this->addElement('text', 'database_personal_calendar', get_lang("PersonalCalendarDatabase"), array ('size' => '40'));
+ //$this->addRule('database_personal_calendar', 'ThisFieldIsRequired', 'required');
+ //$this->addElement('text', 'database_personal_messenger', get_lang("PersonalMessageDatabase"), array ('size' => '40'));
+ //$this->addRule('database_personal_messenger', 'ThisFieldIsRequired', 'required');
+ //$this->addElement('text', 'database_profiler', get_lang("ProfilerDatabase"), array ('size' => '40'));
+ //$this->addRule('database_profiler', 'ThisFieldIsRequired', 'required');
+
+ $enable_tracking[] = & $this->createElement('radio', 'enable_tracking', null, get_lang("Yes"), 1);
+ $enable_tracking[] = & $this->createElement('radio', 'enable_tracking', null, get_lang("No"), 0);
+ $this->addGroup($enable_tracking, 'tracking', get_lang("EnableTracking"), ' ', false);
+ $several_db[] = & $this->createElement('radio', 'database_single', null, get_lang("One"),1);
+ $several_db[] = & $this->createElement('radio', 'database_single', null, get_lang("Several"),0);
+ $this->addGroup($several_db, 'db', get_lang("SingleDb"), ' ', false);
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+class ValidateDatabaseConnection extends HTML_QuickForm_Rule
+{
+ public function validate($parameters)
+ {
+ $db_host = $parameters[0];
+ $db_user = $parameters[1];
+ $db_password = $parameters[2];
+ if(mysql_connect($db_host,$db_user,$db_password))
+ {
+ return true;
+ }
+ return false;
+ }
+}
+
+/**
+ * Page in the install wizard in which some config settings are asked to the
+ * user.
+ */
+class Page_ConfigSettings extends HTML_QuickForm_Page
+{
+ function get_title()
+ {
+ return get_lang('CfgSetting');
+ }
+ function get_info()
+ {
+ return get_lang('ConfigSettingsInfo');
+ }
+ function buildForm()
+ {
+ $this->_formBuilt = true;
+ $languages = array ();
+ $languages['dutch'] = 'dutch';
+ $this->addElement('select', 'platform_language', get_lang("MainLang"), get_language_folder_list());
+ $this->addElement('text', 'platform_url', get_lang("DokeosURL"), array ('size' => '40'));
+ $this->addRule('platform_url', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'admin_email', get_lang("AdminEmail"), array ('size' => '40'));
+ $this->addRule('admin_email', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addRule('admin_email', get_lang('WrongEmail'), 'email');
+ $this->addElement('text', 'admin_lastname', get_lang("AdminLastName"), array ('size' => '40'));
+ $this->addRule('admin_lastname', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'admin_firstname', get_lang("AdminFirstName"), array ('size' => '40'));
+ $this->addRule('admin_firstname', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'admin_phone', get_lang("AdminPhone"), array ('size' => '40'));
+ $this->addElement('text', 'admin_username', get_lang("AdminLogin"), array ('size' => '40'));
+ $this->addRule('admin_username', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'admin_password', get_lang("AdminPass"), array ('size' => '40'));
+ $this->addRule('admin_password', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'platform_name', get_lang("CampusName"), array ('size' => '40'));
+ $this->addRule('platform_name', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'organization_name', get_lang("InstituteShortName"), array ('size' => '40'));
+ $this->addRule('organization_name', get_lang('ThisFieldIsRequired'), 'required');
+ $this->addElement('text', 'organization_url', get_lang("InstituteURL"), array ('size' => '40'));
+ $this->addRule('organization_url', get_lang('ThisFieldIsRequired'), 'required');
+ $encrypt[] = & $this->createElement('radio', 'encrypt_password', null, get_lang('Yes'), 1);
+ $encrypt[] = & $this->createElement('radio', 'encrypt_password', null, get_lang('No'), 0);
+ $this->addGroup($encrypt, 'tracking', get_lang("EncryptUserPass"), ' ', false);
+ $self_reg[] = & $this->createElement('radio', 'self_reg', null, get_lang('Yes'), 1);
+ $self_reg[] = & $this->createElement('radio', 'self_reg', null, get_lang('No'), 0);
+ $this->addGroup($self_reg, 'tracking', get_lang("AllowSelfReg"), ' ', false);
+ $self_reg_teacher[] = & $this->createElement('radio', 'self_reg_teacher', null, get_lang('Yes'), 1);
+ $self_reg_teacher[] = & $this->createElement('radio', 'self_reg_teacher', null, get_lang('No'), 0);
+ $this->addGroup($self_reg_teacher, 'tracking', get_lang("AllowSelfRegProf"), ' ', false);
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+/**
+ * Page in the install wizard in which a final overview of all settings is
+ * displayed.
+ */
+class Page_ConfirmSettings extends HTML_QuickForm_Page
+{
+ function get_title()
+ {
+ return get_lang('LastCheck');
+ }
+ function get_info()
+ {
+ return 'Here are the values you entered
+
+ Print this page to remember your password and other settings ';
+
+ }
+ function buildForm()
+ {
+ $wizard = $this->controller;
+ $values = $wizard->exportValues();
+ $this->addElement('static', 'confirm_platform_language', get_lang("MainLang"), $values['platform_language']);
+ $this->addElement('static', 'confirm_platform_url', get_lang("DokeosURL"), $values['platform_url']);
+ $this->addElement('static', 'confirm_admin_email', get_lang("AdminEmail"), $values['admin_email']);
+ $this->addElement('static', 'confirm_admin_lastname', get_lang("AdminLastName"), $values['admin_lastname']);
+ $this->addElement('static', 'confirm_admin_firstname', get_lang("AdminFirstName"), $values['admin_firstname']);
+ $this->addElement('static', 'confirm_admin_phone', get_lang("AdminPhone"), $values['admin_phone']);
+ $this->addElement('static', 'confirm_admin_username', get_lang("AdminLogin"), $values['admin_username']);
+ $this->addElement('static', 'confirm_admin_password', get_lang("AdminPass"), $values['admin_password']);
+ $this->addElement('static', 'confirm_platform_name', get_lang("CampusName"), $values['platform_name']);
+ $this->addElement('static', 'confirm_organization_name', get_lang("InstituteShortName"), $values['organization_name']);
+ $this->addElement('static', 'confirm_organization_url', get_lang("InstituteURL"), $values['organization_url']);
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), '<< '.get_lang('Previous'));
+ $prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), get_lang('Next').' >>');
+ $this->addGroup($prevnext, 'buttons', '', ' ', false);
+ $this->setDefaultAction('next');
+ }
+}
+
+
+/**
+ * Class to render a page in the install wizard.
+ */
+class ActionDisplay extends HTML_QuickForm_Action_Display
+{
+ /**
+ * Displays the HTML-code of a page in the wizard
+ * @param HTML_Quickform_Page $page The page to display.
+ */
+ function _renderForm(& $current_page)
+ {
+ global $charset;
+
+ global $dokeos_version, $installType, $updateFromVersion;
+ $renderer = & $current_page->defaultRenderer();
+ $current_page->setRequiredNote('* '.get_lang('ThisFieldIsRequired'));
+ $element_template = "\n\t\n\t\t* {label} \n\t\t{error} \t{element} \n\t ";
+ $renderer->setElementTemplate($element_template);
+ $header_template = "\n\t\n\t\t{header} \n\t ";
+ $renderer->setHeaderTemplate($header_template);
+ HTML_QuickForm :: setRequiredNote('* '.get_lang('ThisFieldIsRequired').' ');
+ $current_page->accept($renderer);
+?>
+
+
+
+ -- Dokeos - upgrade to version
+
+
+
+
+
+
+
+ controller->_pages;
+ $total_number_of_pages = count($all_pages);
+ $current_page_number = 0;
+ $page_number = 0;
+ echo '
';
+ foreach($all_pages as $index => $page)
+ {
+ $page_number++;
+ if($page->get_title() == $current_page->get_title())
+ {
+ $current_page_number = $page_number;
+ echo ''.$page->get_title().' ';
+ }
+ else
+ {
+ echo ''.$page->get_title().' ';
+ }
+ }
+ echo ' ';
+ echo '
';
+ echo '';
+ echo '
'.get_lang('Step').' '.$current_page_number.' '.get_lang('of').' '.$total_number_of_pages.' – '.$current_page->get_title().' ';
+ echo '
';
+ echo $current_page->get_info();
+ echo '
';
+ echo $renderer->toHtml();
+ ?>
+
+
+
+
+
+ controller->exportValues();
+ ?>
+
+
+
+ -- Dokeos installation -- version
+
+
+
+
+
+ Dokeos installation - version
+
+
+
+ ';
+
+ global $repository_database;
+ global $weblcms_database;
+ global $personal_calendar_database;
+ global $user_database;
+ global $personal_messenger_database;
+ global $profiler_database;
+
+ $repository_database = $values['database_repository'];
+ $weblcms_database = $values['database_weblcms'];
+ $personal_calendar_database = $values['database_personal_calendar'];
+ $user_database = $values['database_user'];
+ $personal_messenger_database = $values['database_personal_messenger'];
+ $profiler_database = $values['database_profiler'];
+
+ /*full_database_install($values);
+ full_file_install($values);
+ create_admin_in_user_table($values);
+ create_default_categories_in_weblcms();*/
+ echo "
Performing upgrade to latest version....
";
+
+ //upgrade_16x_to_180($values);
+
+ echo '';
+ $page->controller->container(true);
+ ?>
+
+
+
+
+
+
+
+
+ —
+
+
+
+
+
+
+
+
+ ';
+ echo ' ';
+ echo '';
+ echo ' ' . get_lang('InstallationLanguage') . ' ';
+ echo ' ' . get_lang('Requirements') . ' ';
+ echo ' ' . get_lang('Licence') . ' ';
+ echo ' ' . get_lang('DBSetting') . ' ';
+ echo ' ' . get_lang('CfgSetting') . ' ';
+ echo ' ' . get_lang('PrintOverview') . ' ';
+ echo ' ' . get_lang('Installing') . ' ';
+ echo ' ';
+ echo '';
+}
+
+/**
+ * This function prints class=active_step $current_step=$param
+ * @author Patrick Cool , Ghent University
+ */
+function step_active($this_step)
+{
+ global $current_active_step;
+ if ($current_active_step == $this_step)
+ {
+ return ' class="current_step" ';
+ }
+}
+
+// Rule to check update path
+function check_update_path($path)
+{
+ global $update_from_version;
+ // Make sure path has a trailing /
+ $path = substr($path,-1) != '/' ? $path.'/' : $path;
+ // Check the path
+ if (file_exists($path))
+ {
+ //search for 1.6.x installation
+ $version = get_installed_version($path, 'platformVersion');
+
+ //search for 1.8.x installation
+ //if (! isset($version) || $version == '')
+ //{
+ // $version = get_installed_version($path, 'dokeos_version');
+ //}
+
+ if (in_array($version, $update_from_version))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return false;
+}
+
+/**
+ * This function returns the installed version of
+ * the older installation to upgrade by checking the
+ * claroline/inc/installedVersion.inc.php file.
+ */
+function get_installed_version($old_installation_path, $parameter)
+{
+ if( file_exists($old_installation_path.'claroline/inc/installedVersion.inc.php') )
+ {
+ $version_info_file = 'claroline/inc/installedVersion.inc.php';
+ }
+ // with include_once inside a function, variables aren't remembered for later use
+ include($old_installation_path.$version_info_file);
+ if (isset($$parameter))
+ {
+ return $$parameter;
+ }
+}
+
+/**
+ * This function returns a the value of a parameter from the configuration file
+ * of a previous installation.
+ *
+ * IMPORTANT
+ * - Before Dokeos 1.8 the main code folder was called 'claroline'. Since Dokeos 1.8
+ * this folder is called 'main' -> we have to make a difference based on previous
+ * version.
+ * - The version may be in the config file or in the installedVersion file...
+ *
+ * WARNING - this function relies heavily on global variables $updateFromConfigFile
+ * and $configFile, and also changes these globals. This can be rewritten.
+ *
+ * @param string $param the parameter which the value is returned for
+ * @return string the value of the parameter
+ * @author Olivier Brouckaert
+ */
+function get_config_param($param,$path)
+{
+ global $configFile, $updateFromConfigFile;
+
+ if (empty ($updateFromConfigFile))
+ {
+ if (file_exists($path.'claroline/include/config.inc.php'))
+ {
+ $updateFromConfigFile = 'claroline/include/config.inc.php';
+ }
+ elseif (file_exists($path.'claroline/inc/conf/claro_main.conf.php'))
+ {
+ $updateFromConfigFile = 'claroline/inc/conf/claro_main.conf.php';
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ //echo "reading from file $path$updateFromConfigFile, which exists...";
+
+ if (is_array($configFile) && isset ($configFile[$param]))
+ {
+ return $configFile[$param];
+ }
+ elseif (file_exists($path.$updateFromConfigFile))
+ {
+ $configFile = array ();
+
+ $temp = file($path.$updateFromConfigFile);
+
+ $val = '';
+
+ foreach ($temp as $enreg)
+ {
+ if (strstr($enreg, '='))
+ {
+ $enreg = explode('=', $enreg);
+
+ 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)));
+
+ if (strtolower($enreg[1]) == 'true')
+ {
+ $enreg[1] = 1;
+ }
+ if (strtolower($enreg[1]) == 'false')
+ {
+ $enreg[1] = 0;
+ }
+ else
+ {
+ $implode_string = ' ';
+
+ if (!strstr($enreg[1], '." ".') && strstr($enreg[1], '.$'))
+ {
+ $enreg[1] = str_replace('.$', '." ".$', $enreg[1]);
+ $implode_string = '';
+ }
+
+ $tmp = explode('." ".', $enreg[1]);
+
+ 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), $path);
+ }
+ }
+
+ $enreg[1] = implode($implode_string, $tmp);
+ }
+
+ $configFile[$enreg[0]] = $enreg[1];
+
+ if ($enreg[0] == $param)
+ {
+ $val = $enreg[1];
+ }
+ }
+ }
+ }
+
+ return $val;
+ }
+}
+
+/*
+==============================================================================
+ MAIN CODE
+==============================================================================
+*/
+global $current_active_step;
+$current_active_step = '1';
+$install_type = 'update';
+//display_upgrade_header($text_dir, $dokeos_version, $install_type, $update_from_version);
+//display_installation_overview();
+
+// Create a new wizard
+$wizard = & new HTML_QuickForm_Controller('regWizard', true);
+
+//Add pages to wizard - path to follow for upgrade
+//$wizard->addPage(new Page_Language('page_language'));
+//$wizard->addPage(new Page_Requirements('page_requirements'));
+$wizard->addPage(new Page_LocationOldVersion('page_location_old_version'));
+$values = $wizard->exportValues();
+if( isset($values['old_version_path']) && $values['old_version_path'] != '/var/www/html/old_version/' )
+{
+ $path = $values['old_version_path'];
+ $defaults['platform_language'] = get_config_param('platformLanguage',$path);
+ $defaults['platform_url'] = 'http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
+ //to keep debug output readable:
+ //$defaults['license'] = 'GNU GPL v2';
+ //actual license:
+ $defaults['license'] = implode("\n", file('../../documentation/license.txt'));
+ $defaults['database_host'] = get_config_param('dbHost',$path);
+ $defaults['database_main_db'] = get_config_param('mainDbName',$path);
+ $defaults['database_tracking'] = get_config_param('statsDbName',$path);
+ $defaults['database_scorm'] = get_config_param('scormDbName',$path);
+ $defaults['database_user'] = get_config_param('user_personal_database',$path);
+ //$defaults['database_repository'] = 'dokeos_repository';
+ //$defaults['database_weblcms'] = 'dokeos_weblcms';
+ $defaults['database_username'] = get_config_param('dbLogin',$path);
+ $defaults['database_password'] = get_config_param('dbPass',$path);
+ $defaults['database_prefix'] = get_config_param('dbNamePrefix',$path);
+ $defaults['enable_tracking'] = get_config_param('is_trackingEnabled',$path);
+ $defaults['database_single'] = get_config_param('singleDbEnabled',$path);
+ $defaults['admin_lastname'] = 'Doe';
+ $defaults['admin_firstname'] = mt_rand(0,1)?'John':'Jane';
+ $defaults['admin_email'] = get_config_param('emailAdministrator',$path);
+ $defaults['admin_username'] = 'admin';
+ $defaults['admin_password'] = api_generate_password();
+ $defaults['admin_phone'] = get_config_param('administrator["phone"]',$path);
+ $defaults['platform_name'] = get_config_param('siteName',$path);
+ $defaults['encrypt_password'] = 1;
+ $defaults['organization_name'] = get_config_param('institution["name"]',$path);
+ $defaults['organization_url'] = get_config_param('institution["url"]',$path);
+ if (get_config_param('userPasswordCrypted',$path)==1) {
+ $defaults['encrypt_password'] = 'md5';
+ } elseif (get_config_param('userPasswordCrypted',$path)==0){
+ $defaults['encrypt_password'] = 'none';
+ }
+ //$defaults['encrypt_password'] = get_config_param('userPasswordCrypted',$path);
+ $defaults['self_reg'] = get_config_param('allowSelfReg',$path);
+}
+else
+{
+ //old version path not correct yet
+}
+
+$wizard->addPage(new Page_License('page_license'));
+$wizard->addPage(new Page_DatabaseSettings('page_databasesettings'));
+$wizard->addPage(new Page_ConfigSettings('page_configsettings'));
+$wizard->addPage(new Page_ConfirmSettings('page_confirmsettings'));
+
+$defaults['install_language'] = 'english';
+//$defaults['old_version_path'] = '/var/www/html/old_version/';
+$defaults['old_version_path'] = '';
+
+// Set the default values
+$wizard->setDefaults($defaults);
+
+// Add the process action to the wizard
+$wizard->addAction('process', new ActionProcess());
+
+// Add the display action to the wizard
+$wizard->addAction('display', new ActionDisplay());
+
+// Set the installation language
+$install_language = $wizard->exportValue('page_language', 'install_language');
+require_once ('../lang/english/trad4all.inc.php');
+require_once ('../lang/english/install.inc.php');
+include_once ("../lang/$install_language/trad4all.inc.php");
+include_once ("../lang/$install_language/install.inc.php");
+
+// Set default platform language to the selected install language
+$defaults['platform_language'] = $install_language;
+$wizard->setDefaults($defaults);
+
+// Start the wizard
+$wizard->run();
+
+// Set the installation language
+$install_language = $wizard->exportValue('page_language', 'install_language');
+require_once ('../lang/english/trad4all.inc.php');
+require_once ('../lang/english/install.inc.php');
+include_once ("../lang/$install_language/trad4all.inc.php");
+include_once ("../lang/$install_language/install.inc.php");
+
+//$values = $wizard->exportValues();
+
+?>