Exemple #1
0
/**
 * This function displays the requirements for installing Chamilo.
 *
 * @param string $installType
 * @param boolean $badUpdatePath
 * @param boolean $badUpdatePath
 * @param string $updatePath The updatePath given (if given)
 * @param array $update_from_version_8 The different subversions from version 1.9
 *
 * @author unknow
 * @author Patrick Cool <*****@*****.**>, Ghent University
 */
function display_requirements($installType, $badUpdatePath, $updatePath = '', $update_from_version_8 = array())
{
    global $_setting;
    echo '<div class="RequirementHeading"><h2>' . display_step_sequence() . get_lang('Requirements') . "</h2></div>";
    echo '<div class="RequirementText">';
    echo '<strong>' . get_lang('ReadThoroughly') . '</strong><br />';
    echo get_lang('MoreDetails') . ' <a href="../../documentation/installation_guide.html" target="_blank">' . get_lang('ReadTheInstallationGuide') . '</a>.<br />' . "\n";
    if ($installType == 'update') {
        echo get_lang('IfYouPlanToUpgradeFromOlderVersionYouMightWantToHaveAlookAtTheChangelog') . '<br />';
    }
    echo '</div>';
    //  SERVER REQUIREMENTS
    echo '<div class="RequirementHeading"><h4>' . get_lang('ServerRequirements') . '</h4>';
    $timezone = checkPhpSettingExists("date.timezone");
    if (!$timezone) {
        echo "<div class='warning-message'>" . Display::return_icon('warning.png', get_lang('Warning'), '', ICON_SIZE_MEDIUM) . get_lang("DateTimezoneSettingNotSet") . "</div>";
    }
    echo '<div class="RequirementText">' . get_lang('ServerRequirementsInfo') . '</div>';
    echo '<div class="RequirementContent">';
    echo '<table class="table">
            <tr>
                <td class="requirements-item">' . get_lang('PHPVersion') . ' >= ' . REQUIRED_PHP_VERSION . '</td>
                <td class="requirements-value">';
    if (phpversion() < REQUIRED_PHP_VERSION) {
        echo '<strong><font color="red">' . get_lang('PHPVersionError') . '</font></strong>';
    } else {
        echo '<strong><font color="green">' . get_lang('PHPVersionOK') . ' ' . phpversion() . '</font></strong>';
    }
    echo '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.session.php" target="_blank">Session</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('session', get_lang('Yes'), get_lang('ExtensionSessionsNotAvailable')) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.mysql.php" target="_blank">MySQL</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('mysql', get_lang('Yes'), get_lang('ExtensionMySQLNotAvailable')) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.zlib.php" target="_blank">Zlib</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('zlib', get_lang('Yes'), get_lang('ExtensionZlibNotAvailable')) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.pcre.php" target="_blank">Perl-compatible regular expressions</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('pcre', get_lang('Yes'), get_lang('ExtensionPCRENotAvailable')) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.xml.php" target="_blank">XML</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('xml', get_lang('Yes'), get_lang('No')) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.intl.php" target="_blank">Internationalization</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('intl', get_lang('Yes'), get_lang('No')) . '</td>
            </tr>
               <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.json.php" target="_blank">JSON</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('json', get_lang('Yes'), get_lang('No')) . '</td>
            </tr>

             <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.image.php" target="_blank">GD</a> ' . get_lang('support') . '</td>
                <td class="requirements-value">' . checkExtension('gd', get_lang('Yes'), get_lang('ExtensionGDNotAvailable')) . '</td>
            </tr>

            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.mbstring.php" target="_blank">Multibyte string</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td>
                <td class="requirements-value">' . checkExtension('mbstring', get_lang('Yes'), get_lang('ExtensionMBStringNotAvailable'), true) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.iconv.php" target="_blank">Iconv</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td>
                <td class="requirements-value">' . checkExtension('iconv', get_lang('Yes'), get_lang('No'), true) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.ldap.php" target="_blank">LDAP</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td>
                <td class="requirements-value">' . checkExtension('ldap', get_lang('Yes'), get_lang('ExtensionLDAPNotAvailable'), true) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://xapian.org/" target="_blank">Xapian</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td>
                <td class="requirements-value">' . checkExtension('xapian', get_lang('Yes'), get_lang('No'), true) . '</td>
            </tr>

            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/en/book.curl.php" target="_blank">cURL</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td>
                <td class="requirements-value">' . checkExtension('curl', get_lang('Yes'), get_lang('No'), true) . '</td>
            </tr>

          </table>';
    echo '  </div>';
    echo '</div>';
    // RECOMMENDED SETTINGS
    // Note: these are the settings for Joomla, does this also apply for Chamilo?
    // Note: also add upload_max_filesize here so that large uploads are possible
    echo '<div class="RequirementHeading"><h4>' . get_lang('RecommendedSettings') . '</h4>';
    echo '<div class="RequirementText">' . get_lang('RecommendedSettingsInfo') . '</div>';
    echo '<div class="RequirementContent">';
    echo '<table class="table">
            <tr>
                <th>' . get_lang('Setting') . '</th>
                <th>' . get_lang('Recommended') . '</th>
                <th>' . get_lang('Actual') . '</th>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/features.safe-mode.php">Safe Mode</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('safe_mode', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ref.errorfunc.php#ini.display-errors">Display Errors</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('display_errors', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.file-uploads">File Uploads</a></td>
                <td class="requirements-recommended">' . Display::label('ON', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('file_uploads', 'ON') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ref.info.php#ini.magic-quotes-gpc">Magic Quotes GPC</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('magic_quotes_gpc', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ref.info.php#ini.magic-quotes-runtime">Magic Quotes Runtime</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('magic_quotes_runtime', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/security.globals.php">Register Globals</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('register_globals', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ref.session.php#ini.session.auto-start">Session auto start</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('session.auto_start', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.short-open-tag">Short Open Tag</a></td>
                <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('short_open_tag', 'OFF') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly">Cookie HTTP Only</a></td>
                <td class="requirements-recommended">' . Display::label('ON', 'success') . '</td>
                <td class="requirements-value">' . checkPhpSetting('session.cookie_httponly', 'ON') . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.upload-max-filesize">Maximum upload file size</a></td>
                <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_UPLOAD_MAX_FILESIZE . 'M', 'success') . '</td>
                <td class="requirements-value">' . compare_setting_values(ini_get('upload_max_filesize'), REQUIRED_MIN_UPLOAD_MAX_FILESIZE) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.post-max-size">Maximum post size</a></td>
                <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_POST_MAX_SIZE . 'M', 'success') . '</td>
                <td class="requirements-value">' . compare_setting_values(ini_get('post_max_size'), REQUIRED_MIN_POST_MAX_SIZE) . '</td>
            </tr>
            <tr>
                <td class="requirements-item"><a href="http://www.php.net/manual/en/ini.core.php#ini.memory-limit">Memory Limit</a></td>
                <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_MEMORY_LIMIT . 'M', 'success') . '</td>
                <td class="requirements-value">' . compare_setting_values(ini_get('memory_limit'), REQUIRED_MIN_MEMORY_LIMIT) . '</td>
            </tr>
          </table>';
    echo '  </div>';
    echo '</div>';
    // DIRECTORY AND FILE PERMISSIONS
    echo '<div class="RequirementHeading"><h4>' . get_lang('DirectoryAndFilePermissions') . '</h4>';
    echo '<div class="RequirementText">' . get_lang('DirectoryAndFilePermissionsInfo') . '</div>';
    echo '<div class="RequirementContent">';
    $course_attempt_name = '__XxTestxX__';
    $course_dir = api_get_path(SYS_COURSE_PATH) . $course_attempt_name;
    //Just in case
    @unlink($course_dir . '/test.php');
    @rmdir($course_dir);
    $perms_dir = array(0777, 0755, 0775, 0770, 0750, 0700);
    $perms_fil = array(0666, 0644, 0664, 0660, 0640, 0600);
    $course_test_was_created = false;
    $dir_perm_verified = 0777;
    foreach ($perms_dir as $perm) {
        $r = @mkdir($course_dir, $perm);
        if ($r === true) {
            $dir_perm_verified = $perm;
            $course_test_was_created = true;
            break;
        }
    }
    $fil_perm_verified = 0666;
    $file_course_test_was_created = false;
    if (is_dir($course_dir)) {
        foreach ($perms_fil as $perm) {
            if ($file_course_test_was_created == true) {
                break;
            }
            $r = @touch($course_dir . '/test.php', $perm);
            if ($r === true) {
                $fil_perm_verified = $perm;
                if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) {
                    $file_course_test_was_created = true;
                }
            }
        }
    }
    @unlink($course_dir . '/test.php');
    @rmdir($course_dir);
    $_SESSION['permissions_for_new_directories'] = $_setting['permissions_for_new_directories'] = $dir_perm_verified;
    $_SESSION['permissions_for_new_files'] = $_setting['permissions_for_new_files'] = $fil_perm_verified;
    $dir_perm = Display::label('0' . decoct($dir_perm_verified), 'info');
    $file_perm = Display::label('0' . decoct($fil_perm_verified), 'info');
    $courseTestLabel = Display::label(get_lang('No'), 'important');
    if ($course_test_was_created && $file_course_test_was_created) {
        $courseTestLabel = Display::label(get_lang('Yes'), 'success');
    }
    if ($course_test_was_created && !$file_course_test_was_created) {
        $courseTestLabel = Display::label(sprintf(get_lang('InstallWarningCouldNotInterpretPHP'), api_get_path(WEB_COURSE_PATH) . $course_attempt_name . '/test.php'), 'warning');
    }
    if (!$course_test_was_created && !$file_course_test_was_created) {
        $courseTestLabel = Display::label(get_lang('No'), 'important');
    }
    $oldConf = '';
    if (file_exists(api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php')) {
        $oldConf = '<tr>
            <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'inc/conf</td>
            <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'inc/conf') . '</td>
        </tr>';
    }
    echo '<table class="table">
            ' . $oldConf . '
            <tr>
                <td class="requirements-item">' . api_get_path(SYS_APP_PATH) . '</td>
                <td class="requirements-value">' . check_writable(api_get_path(SYS_APP_PATH)) . '</td>
            </tr>
            <tr>
                <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'default_course_document/images/</td>
                <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'default_course_document/images/') . '</td>
            </tr>
            <tr>
                <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'lang/</td>
                <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'lang/', true) . ' <br />(' . get_lang('SuggestionOnlyToEnableSubLanguageFeature') . ')</td>
            </tr>
            <tr>
                <td class="requirements-item">' . api_get_path(SYS_PATH) . 'vendor/</td>
                <td class="requirements-value">' . checkReadable(api_get_path(SYS_PATH) . 'vendor') . '</td>
            </tr>
            <tr>
                <td class="requirements-item">' . api_get_path(SYS_PUBLIC_PATH) . '</td>
                <td class="requirements-value">' . check_writable(api_get_path(SYS_PUBLIC_PATH)) . '</td>
            </tr>
            <tr>
                <td class="requirements-item">' . get_lang('CourseTestWasCreated') . '</td>
                <td class="requirements-value">' . $courseTestLabel . ' </td>
            </tr>
            <tr>
                <td class="requirements-item">' . get_lang('PermissionsForNewDirs') . '</td>
                <td class="requirements-value">' . $dir_perm . ' </td>
            </tr>
            <tr>
                <td class="requirements-item">' . get_lang('PermissionsForNewFiles') . '</td>
                <td class="requirements-value">' . $file_perm . ' </td>
            </tr>
            ';
    echo '    </table>';
    echo '  </div>';
    echo '</div>';
    if ($installType == 'update' && (empty($updatePath) || $badUpdatePath)) {
        if ($badUpdatePath) {
            ?>
            <div class="alert alert-warning">
                <?php 
            echo get_lang('Error');
            ?>
!<br />
                Chamilo <?php 
            echo implode('|', $update_from_version_8) . ' ' . get_lang('HasNotBeenFoundInThatDir');
            ?>
.
            </div>
        <?php 
        } else {
            echo '<br />';
        }
        ?>
            <div class="row">
                <div class="col-md-12">
                    <p><?php 
        echo get_lang('OldVersionRootPath');
        ?>
:
                        <input type="text" name="updatePath" size="50" value="<?php 
        echo $badUpdatePath && !empty($updatePath) ? htmlentities($updatePath) : api_get_path(SYS_SERVER_ROOT_PATH) . 'old_version/';
        ?>
" />
                    </p>
                    <p>
                        <button type="submit" class="btn btn-default" name="step1" value="<?php 
        echo get_lang('Back');
        ?>
" >
                            <i class="fa fa-backward"> <?php 
        echo get_lang('Back');
        ?>
</i>
                        </button>
                        <input type="hidden" name="is_executable" id="is_executable" value="-" />
                        <button type="submit" class="btn btn-success" name="<?php 
        echo isset($_POST['step2_update_6']) ? 'step2_update_6' : 'step2_update_8';
        ?>
" value="<?php 
        echo get_lang('Next');
        ?>
 &gt;" >
                            <i class="fa fa-forward"> </i> <?php 
        echo get_lang('Next');
        ?>
                        </button>
                    </p>
                </div>
            </div>

        <?php 
    } else {
        $error = false;
        // First, attempt to set writing permissions if we don't have them yet
        $perm = api_get_permissions_for_new_directories();
        $perm_file = api_get_permissions_for_new_files();
        $notWritable = array();
        $checked_writable = api_get_path(SYS_APP_PATH);
        if (!is_writable($checked_writable)) {
            $notWritable[] = $checked_writable;
            @chmod($checked_writable, $perm);
        }
        $checked_writable = api_get_path(SYS_PUBLIC_PATH);
        if (!is_writable($checked_writable)) {
            $notWritable[] = $checked_writable;
            @chmod($checked_writable, $perm);
        }
        $checked_writable = api_get_path(SYS_CODE_PATH) . 'default_course_document/images/';
        if (!is_writable($checked_writable)) {
            $notWritable[] = $checked_writable;
            @chmod($checked_writable, $perm);
        }
        if ($course_test_was_created == false) {
            $error = true;
        }
        $checked_writable = api_get_path(CONFIGURATION_PATH) . 'configuration.php';
        if (file_exists($checked_writable) && !is_writable($checked_writable)) {
            $notWritable[] = $checked_writable;
            @chmod($checked_writable, $perm_file);
        }
        // Second, if this fails, report an error
        //--> The user would have to adjust the permissions manually
        if (count($notWritable) > 0) {
            $error = true;
            echo '<div class="error-message">';
            echo '<center><h3>' . get_lang('Warning') . '</h3></center>';
            printf(get_lang('NoWritePermissionPleaseReadInstallGuide'), '</font>
                <a href="../../documentation/installation_guide.html" target="blank">', '</a> <font color="red">');
            echo '</div>';
            echo '<ul>';
            foreach ($notWritable as $value) {
                echo '<li>' . $value . '</li>';
            }
            echo '</ul>';
        } elseif (file_exists(api_get_path(CONFIGURATION_PATH) . 'configuration.php')) {
            // Check wether a Chamilo configuration file already exists.
            echo '<div class="alert alert-warning"><h4><center>';
            echo get_lang('WarningExistingLMSInstallationDetected');
            echo '</center></h4></div>';
        }
        // And now display the choice buttons (go back or install)
        ?>
        <p align="center" style="padding-top:15px">
        <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php 
        echo get_lang('Previous');
        ?>
" >
            <i class="fa fa-backward"> </i> <?php 
        echo get_lang('Previous');
        ?>
        </button>
        <button type="submit" name="step2_install" class="btn btn-success" value="<?php 
        echo get_lang("NewInstallation");
        ?>
" <?php 
        if ($error) {
            echo 'disabled="disabled"';
        }
        ?>
 >
            <i class="fa fa-forward"> </i> <?php 
        echo get_lang('NewInstallation');
        ?>
        </button>
        <input type="hidden" name="is_executable" id="is_executable" value="-" />
        <?php 
        // Real code
        echo '<button type="submit" class="btn btn-default" name="step2_update_8" value="Upgrade from Chamilo 1.9.x"';
        if ($error) {
            echo ' disabled="disabled"';
        }
        echo ' ><i class="fa fa-forward"> </i> ' . get_lang('UpgradeFromLMS19x') . '</button>';
        echo '</p>';
    }
}
function drawPermissionsSettings($app)
{
    $html = null;
    // DIRECTORY AND FILE PERMISSIONS
    $html .= '<div class="RequirementContent">';
    $course_attempt_name = '__XxTestxX__';
    $course_dir = api_get_path(SYS_COURSE_PATH) . $course_attempt_name;
    // Just in case.
    if (is_file($course_dir . '/test.txt')) {
        unlink($course_dir . '/test.txt');
    }
    if (is_dir($course_dir)) {
        rmdir($course_dir);
    }
    $perms_dir = array(0777, 0755, 0775, 0770, 0750, 0700);
    $perms_fil = array(0666, 0644, 0664, 0660, 0640, 0600);
    $course_test_was_created = false;
    $dir_perm_verified = 0777;
    foreach ($perms_dir as $perm) {
        $r = @mkdir($course_dir, $perm);
        if ($r === true) {
            $dir_perm_verified = $perm;
            $course_test_was_created = true;
            break;
        }
    }
    $fil_perm_verified = 0666;
    $file_course_test_was_created = false;
    if (is_dir($course_dir)) {
        foreach ($perms_fil as $perm) {
            if ($file_course_test_was_created == true) {
                break;
            }
            $r = touch($course_dir . '/test.php', $perm);
            if ($r === true) {
                $fil_perm_verified = $perm;
                if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) {
                    $file_course_test_was_created = true;
                }
            }
        }
    }
    @unlink($course_dir . '/test.php');
    @rmdir($course_dir);
    $app['session']->set('permissions_for_new_directories', decoct($dir_perm_verified));
    $app['session']->set('permissions_for_new_files', decoct($fil_perm_verified));
    $dir_perm = Display::label('0' . decoct($dir_perm_verified), 'info');
    $file_perm = Display::label('0' . decoct($fil_perm_verified), 'info');
    $course_test_was_created = $course_test_was_created == true && $file_course_test_was_created == true ? Display::label(translate('Yes'), 'success') : Display::label(translate('No'), 'important');
    $html .= '<table class="table">
            <tr>
                <td class="requirements-item">[chamilo]/config</td>
                <td class="requirements-value">' . check_writable_root_path('config/') . '</td>
            </tr>
            <tr>
                <td class="requirements-item">[chamilo]/data</td>
                <td class="requirements-value">' . check_writable_root_path('data') . '</td>
            </tr>
            <tr>
                <td class="requirements-item">[chamilo]/logs</td>
                <td class="requirements-value">' . check_writable_root_path('logs') . '</td>
            </tr>
            <tr>
                <td class="requirements-item">' . translate('CourseTestWasCreated') . '</td>
                <td class="requirements-value">' . $course_test_was_created . ' </td>
            </tr>
            <tr>
                <td class="requirements-item">' . translate('PermissionsForNewDirs') . '</td>
                <td class="requirements-value">' . $dir_perm . ' </td>
            </tr>
            <tr>
                <td class="requirements-item">' . translate('PermissionsForNewFiles') . '</td>
                <td class="requirements-value">' . $file_perm . ' </td>
            </tr>';
    $html .= '    </table>';
    $html .= '  </div>';
    $html .= '</div>';
    $error = false;
    // First, attempt to set writing permissions if we don't have them yet
    $perm = $app['session']->get('permissions_for_new_directories');
    $perm_file = $app['session']->get('permissions_for_new_files');
    $notwritable = array();
    $checked_writable = api_get_path(SYS_CONFIG_PATH);
    if (!is_writable($checked_writable)) {
        $notwritable[] = $checked_writable;
        @chmod($checked_writable, $perm);
    }
    $checked_writable = api_get_path(SYS_DATA_PATH);
    if (!is_writable($checked_writable)) {
        $notwritable[] = $checked_writable;
        @chmod($checked_writable, $perm);
    }
    $checked_writable = api_get_path(SYS_DEFAULT_COURSE_DOCUMENT_PATH) . 'images/';
    if (!is_writable($checked_writable)) {
        $notwritable[] = $checked_writable;
        @chmod($checked_writable, $perm);
    }
    $checked_writable = api_get_path(SYS_ARCHIVE_PATH);
    if (!is_writable($checked_writable)) {
        $notwritable[] = $checked_writable;
        @chmod($checked_writable, $perm);
    }
    $checked_writable = api_get_path(SYS_LOG_PATH);
    if (!is_writable($checked_writable)) {
        $notwritable[] = $checked_writable;
        @chmod($checked_writable, $perm);
    }
    /*$checked_writable = api_get_path(SYS_COURSE_PATH);
      if (!is_writable($checked_writable)) {
          $notwritable[] = $checked_writable;
          @chmod($checked_writable, $perm);
      }*/
    if ($course_test_was_created == false || $file_course_test_was_created == false) {
        $error = true;
    }
    /*$checked_writable = api_get_path(SYS_PATH).'home/';
      if (!is_writable($checked_writable)) {
          $notwritable[] = realpath($checked_writable);
          @chmod($checked_writable, $perm);
      }*/
    /*$checked_writable = api_get_path(CONFIGURATION_PATH).'configuration.php';
      if (file_exists($checked_writable) && !is_writable($checked_writable)) {
          $notwritable[] = $checked_writable;
          @chmod($checked_writable, $perm_file);
      }*/
    // Second, if this fails, report an error
    // The user would have to adjust the permissions manually
    if (count($notwritable) > 0) {
        $html .= '<div class="error-message">';
        $html .= '<center><h3>' . translate('Warning') . '</h3></center>';
        $html .= sprintf(translate('NoWritePermissionPleaseReadInstallGuide'), '</font>
            <a href="../../documentation/installation_guide.html" target="blank">', '</a> <font color="red">');
        $html .= '</div>';
        $html .= '<ul>';
        foreach ($notwritable as $value) {
            $html .= '<li>' . $value . '</li>';
        }
        $html .= '</ul>';
    } elseif (file_exists(api_get_path(CONFIGURATION_PATH) . 'configuration.php')) {
        // Check wether a Chamilo configuration file already exists.
        $html .= '<div class="warning-message"><h4><center>';
        $html .= translate('WarningExistingDokeosInstallationDetected');
        $html .= '</center></h4></div>';
    }
    return $html;
}