2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
7 /* This program is free software. You can redistribute it and/or */
8 /* modify it under the terms of the GNU General Public License */
9 /* as published by the Free Software Foundation. */
10 /************************************************************************/
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 if(isset($_POST['submit'])) {
16 unset($_POST['submit']);
23 $file = '../include/config.inc.php';
28 if ( file_exists($file) ) {
30 if (!is_writeable($file)) {
31 $errors[] = '<strong>' . $file . '</strong> is not writeable. Use <kbd>chmod a+rw '.$file.'</kbd> to change permissions.';
33 $progress[] = '<strong>' . $file . '</strong> is writeable.';
36 $errors[] = '<strong>' . $file . '</strong> does not exist.';
39 print_progress($step);
41 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form">';
44 if (isset($progress)) {
45 print_feedback($progress);
47 print_errors($errors);
49 echo'<input type="hidden" name="step" value="'.$step.'" />';
51 unset($_POST['step']);
52 unset($_POST['action']);
56 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
58 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
62 if (!copy('../../'.$_POST['step1']['old_path'] . '/include/config.inc.php', '../include/config.inc.php')) {
63 echo '<input type="hidden" name="step" value="'.$step.'" />';
65 print_feedback($progress);
67 $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.';
68 print_errors($errors);
70 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
72 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
75 echo '<input type="hidden" name="step" value="'.$step.'" />';
78 $progress[] = 'Data has been saved successfully.';
80 if (version_compare($_POST['step1']['old_version'], '1.5.2', '<')) {
81 require('include/config_template.php');
83 $comments = '/*'.str_pad(' This file was generated by the ATutor 1.5.2 installation script.', 70, ' ').'*/
84 /*'.str_pad(' File generated '.date('Y-m-d H:m:s'), 70, ' ').'*/';
86 $_POST['db_login'] = urldecode($_POST['db_login']);
87 $_POST['db_password'] = urldecode($_POST['db_password']);
89 write_config_file('../include/config.inc.php', $comments);
91 @chmod('../include/config.inc.php', 0444);
93 print_feedback($progress);
95 echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>';