, Ghent University */ function step_active($param) { global $current_step; if ($param==$current_step) { echo 'class="current_step" '; } } /** * This function displays the Step X of Y - */ function display_step_sequence() { global $current_step; global $total_steps; return get_lang('Step').' '.$current_step.' '.get_lang('Of').' '.$total_steps.' – '; } /** * 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 * @author Patrick Cool , Ghent University * @version Dokeos 1.8, august 2006 */ function check_extension($extention_name,$return_success=false, $return_failure=false) { if(extension_loaded($extention_name)) { return ''.$return_success.''; } else { return ''.$return_failure.''; //echo "\t
  • $extentionName is missing (Dokeos can work without it) ($extentionName)
  • \n"; } } /** * This function checks if a php settings matches the recommended value * * @author Patrick Cool , Ghent University * @version Dokeos 1.8, august 2006 */ function check_php_setting($php_setting, $recommended_value, $return_success=false, $return_failure=false) { $current_php_value = get_php_setting($php_setting); if ( $current_php_value== $recommended_value) { return ''.$current_php_value.' '.$return_success.''; } else { return ''.$current_php_value.' '.$return_failure.''; } } /** * Enter description here... * * @param string $val a php ini value * @return boolean: ON or OFF * @author Joomla */ function get_php_setting($val) { $r = (ini_get($val) == '1' ? 1 : 0); return $r ? 'ON' : 'OFF'; } /** * This function checks if the given folder is writable */ function check_writable($folder) { if (is_writable('../'.$folder)) { return ''.get_lang('Writable').''; } else { return ''.get_lang('NotWritable').''; } } /** * this function returns a string "FALSE" or "TRUE" according to the variable in parameter * * @param integer $var the variable to convert * @return string the string "FALSE" or "TRUE" * @author Christophe Gesche */ function trueFalse($var) { return $var?'true':'false'; } /** * this function returns a the value of a parameter from the configuration 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) { global $configFile, $updateFromConfigFile; if(empty($updateFromConfigFile)) { if(file_exists($_POST['updatePath'].'main/include/config.inc.php')) { $updateFromConfigFile='main/include/config.inc.php'; } elseif(file_exists($_POST['updatePath'].'main/inc/conf/claro_main.conf.php')) { $updateFromConfigFile='main/inc/conf/claro_main.conf.php'; } else { return; } } if(is_array($configFile) && isset($configFile[$param])) { return $configFile[$param]; } elseif(file_exists($_POST['updatePath'].$updateFromConfigFile)) { $configFile=array(); $temp=file($_POST['updatePath'].$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)); } } $enreg[1]=implode($implode_string,$tmp); } $configFile[$enreg[0]]=$enreg[1]; if($enreg[0] == $param) { $val=$enreg[1]; } } } } return $val; } } /** * 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; } } closedir($handle); return $language_list; } /* ============================================================================== DISPLAY FUNCTIONS ============================================================================== */ /** * Displays a form (drop down menu) so the user can select * his/her preferred language. */ function display_language_selection_box() { $langNameOfLang = get_lang('NameOfLang'); //get language list $dirname = '../lang/'; $language_list = get_language_folder_list($dirname); sort($language_list); $language_to_display = $language_list; //display echo "\t\t\n"; } /** * This function displays a language dropdown box so that the installatioin * can be done in the language of the user */ function display_language_selection() { ?>

    Welcome to the Dokeos installer!

    Installation Language

    Please select the language you'd like to use while installing:

    , Ghent University */ function display_requirements($installType, $badUpdatePath, $update_from_version) { echo '

    '.display_step_sequence().get_lang('Requirements')."

    \n"; echo ''.get_lang('ReadThoroughly').'
    '; echo get_lang('MoreDetails').' read the installation guide.
    '."\n"; // SERVER REQUIREMENTS echo '

    '.get_lang('ServerRequirements').'

    '; echo '
    '.get_lang('ServerRequirementsInfo').'
    '; echo '
    '; echo '
    '.get_lang('PHPVersion').'>= 4.1.0 '; if (phpversion() < '4.1') { echo ''.get_lang('PHPVersionError').''; } else { echo ''.get_lang('PHPVersionOK'). ' '.phpversion().''; } echo '
    session '.get_lang('support').' '.check_extension('session',get_lang('OK'), get_lang('ExtensionSessionsNotAvailable')).'
    MySQL '.get_lang('support').' '.check_extension('mysql',get_lang('OK'), get_lang('ExtensionMySQLNotAvailable')).'
    zlib '.get_lang('support').' '.check_extension('zlib',get_lang('OK'), get_lang('ExtensionZlibNotAvailable')).'
    Regular Expressions '.get_lang('support').' '.check_extension('pcre',get_lang('OK'), get_lang('ExtensionPCRENotAvailable')).'
    XML '.get_lang('support').' '.check_extension('xml',get_lang('OK'), get_lang('ExtensionZlibNotAvailable')).'
    LDAP '.get_lang('support').'('.get_lang('Optional').') '.check_extension('ldap',get_lang('OK'), get_lang('ExtensionLDAPNotAvailable')).'
    GD '.get_lang('support').'('.get_lang('Optional').') '.check_extension('gd',get_lang('OK'), get_lang('ExtensionGDNotAvailable')).'
    '; echo '
    '; echo '
    '; // RECOMMENDED SETTINGS // Note: these are the settings for Joomla, does this also apply for Dokeos? // Note: also add upload_max_filesize here so that large uploads are possible echo '

    '.get_lang('RecommendedSettings').'

    '; echo '
    '.get_lang('RecommendedSettingsInfo').'
    '; echo '
    '; echo '
    '.get_lang('Setting').' '.get_lang('Recommended').' '.get_lang('Actual').'
    Safe Mode '.check_php_setting('safe_mode','OFF').'
    Display Errors '.check_php_setting('display_errors','ON').'
    File Uploads '.check_php_setting('file_uploads','ON').'
    Magic Quotes GPC '.check_php_setting('magic_quotes_gpc','ON').'
    Magic Quotes Runtime '.check_php_setting('magic_quotes_runtime','OFF').'
    Register Globals '.check_php_setting('register_globals','OFF').'
    Output Buffering '.check_php_setting('output_buffering','ON').'
    Session auto start '.check_php_setting('session.auto_start','OFF').'
    Short Open Tag '.check_php_setting('short_open_tag','ON').'
    '; echo '
    '; echo '
    '; // DIRECTORY AND FILE PERMISSIONS echo '

    '.get_lang('DirectoryAndFilePermissions').'

    '; echo '
    '.get_lang('DirectoryAndFilePermissionsInfo').'
    '; echo '
    '; echo ' '; echo '
    dokeos/main/inc/conf/ '.check_writable('inc/conf/').'
    dokeos/main/garbage/ '.check_writable('garbage/').'
    dokeos/main/upload/ '.check_writable('upload/').'
    dokeos/archive/ '.check_writable('../archive/').'
    dokeos/courses/ '.check_writable('../courses/').'
    dokeos/home/ '.check_writable('../home/').'
    '; echo '
    '; echo '
    '; if($installType == 'update' && (empty($_POST['updatePath']) || $badUpdatePath)) { if($badUpdatePath) { ?>
    Error!
    Dokeos has not been found in that directory.
    '; } ?>
    Old version root path:
    the user will have to adjust the permissions manually if(!is_writable('../inc/conf') || !is_writable('../garbage') || !is_writable('../upload') || !is_writable('../../archive') || !is_writable('../../courses') || !is_writable('../../home') || (file_exists('../inc/conf/claro_main.conf.php') && !is_writable('../inc/conf/claro_main.conf.php'))) { $error=true; ?>
    Warning:
    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 . 0) { echo '
      '; foreach ($notwritable as $value) { echo '
    • '.$value.'
    • '; } echo '
        '; } ?>
    '; echo get_lang('WarningExistingDokeosInstallationDetected'); echo ''; } ?>

    " /> '; echo '

    '; } } /** * Displays the license (GNU GPL) as step 2, with * - an "I accept" button named step3 to proceed to step 3; * - a "Back" button named step1 to go back to the first step. */ function display_license_agreement() { echo '

    '.display_step_sequence().get_lang('Licence').'

    '; echo '

    '.get_lang('DokeosLicenseInfo').'

    '; echo '

    '.get_lang('PrintVers').'

    '; ?>

    \n"; echo "$parameter_name  \n"; if ($install_type == INSTALL_TYPE_UPDATE && $display_when_update) { echo ''.$parameter_value."\n"; } else { echo ''."\n"; echo "$extra_notice\n"; } echo "\n"; } /** * Displays step 3 - 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... */ function display_database_settings_form($installType, $dbHostForm, $dbUsernameForm, $dbPassForm, $dbPrefixForm, $enableTrackingForm, $singleDbForm, $dbNameForm, $dbStatsForm, $dbScormForm, $dbUserForm) { if($installType == 'update') { $dbHostForm=get_config_param('dbHost'); $dbUsernameForm=get_config_param('dbLogin'); $dbPassForm=get_config_param('dbPass'); $dbPrefixForm=get_config_param('dbNamePrefix'); $enableTrackingForm=get_config_param('is_trackingEnabled'); $singleDbForm=get_config_param('singleDbEnabled'); $dbNameForm=get_config_param('mainDbName'); $dbStatsForm=get_config_param('statsDbName'); $dbScormForm=get_config_param('scormDbName'); $dbScormExists=true; if(empty($dbScormForm)) { if($singleDbForm) { $dbScormForm=$dbNameForm; } else { $dbScormForm=$dbPrefixForm.'scorm'; $dbScormExists=false; } } if($singleDbForm) { $dbUserForm=$dbNameForm; } else { $dbUserForm=$dbPrefixForm.'dokeos_user'; } } echo "

    " . display_step_sequence() .get_lang("DBSetting") . "

    "; echo get_lang("DBSettingIntro"); ?>

     
    /> />  
    /> />  
    Confirmation
    MySQL host info:
    MySQL server version:
    MySQL protocol version:
    Error
    MySQL error:
     
    \n"; echo "$parameter_name  \n"; if ($install_type == INSTALL_TYPE_UPDATE && $display_when_update) { echo ''.$parameter_value."\n"; } else { echo ''."\n"; } echo "\n"; } /** * Displays step 4 of the installation - configuration settings about Dokeos itself. */ function display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $loginForm, $passForm) { if($installType == 'update') { $languageForm=get_config_param('platformLanguage'); $emailForm=get_config_param('emailAdministrator'); list($adminFirstName,$adminLastName)=explode(' ',get_config_param('administrator["name"]')); $adminPhoneForm=get_config_param('administrator["phone"]'); $campusForm=get_config_param('siteName'); $institutionForm=get_config_param('institution["name"]'); $institutionUrlForm=get_config_param('institution["url"]'); $encryptPassForm=get_config_param('userPasswordCrypted'); $allowSelfReg=get_config_param('allowSelfReg'); } else { $languageForm = $_SESSION['install_language']; } echo "

    " . display_step_sequence() . get_lang("CfgSetting") . "

    "; echo '

    '.get_lang('ConfigSettingsInfo').'

    '; echo "\n"; echo ""; //First parameter: language echo "\n"; echo '\n"; if($installType == 'update') { echo '\n"; } else // new installation { echo '\n"; } echo "\n"; //Second parameter: Dokeos URL echo "\n"; echo '\n"; echo '\n"; echo "\n"; //Parameter 3: administrator's email display_configuration_parameter($installType, get_lang("AdminEmail"), "emailForm", $emailForm); //Parameter 4: administrator's last name display_configuration_parameter($installType, get_lang("AdminLastName"), "adminLastName", $adminLastName); //Parameter 5: administrator's first name display_configuration_parameter($installType, get_lang("AdminFirstName"), "adminFirstName", $adminFirstName); //Parameter 6: administrator's telephone display_configuration_parameter($installType, get_lang("AdminPhone"), "adminPhoneForm", $adminPhoneForm); //Parameter 7: administrator's login display_configuration_parameter($installType, get_lang("AdminLogin"), "loginForm", $loginForm, false); //Parameter 8: administrator's password display_configuration_parameter($installType, get_lang("AdminPass"), "passForm", $passForm, false); //Parameter 9: campus name display_configuration_parameter($installType, get_lang("CampusName"), "campusForm", $campusForm); //Parameter 10: institute (short) name display_configuration_parameter($installType, get_lang("InstituteShortName"), "institutionForm", $institutionForm); //Parameter 11: institute (short) name display_configuration_parameter($installType, get_lang("InstituteURL"), "institutionUrlForm", $institutionUrlForm); ?>
    '.get_lang('MainLang')."  '.$languageForm."'; echo "'; echo "
    '.get_lang('DokeosURL').' ('.get_lang('ThisFieldIsRequired').")  '."
    : /> />
    : /> />
    : /> />

    MAX_COURSE_TRANSFER): ?>

    Warning : You have more than courses on your Dokeos platform ! Only courses have been updated. To update the other courses, click here.

    Security advice : To protect your site, make read-only (CHMOD 444) 'main/inc/conf/claro_main.conf.php' and 'main/install/index.php'.