2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg, Heidi Hazelton */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 if (!defined('AT_INCLUDE_PATH')) { exit; }
16 if(isset($_POST['submit'])) {
17 unset($_POST['submit']);
24 $file = '../include/config.inc.php';
29 if ( file_exists($file) ) {
31 if (!is_writeable($file)) {
32 $errors[] = '<strong>' . $file . '</strong> is not writeable. Use <kbd>chmod a+rw '.$file.'</kbd> to change permissions.';
34 $progress[] = '<strong>' . $file . '</strong> is writeable.';
37 $errors[] = '<strong>' . $file . '</strong> does not exist.';
40 print_progress($step);
42 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form">';
45 if (isset($progress)) {
46 print_feedback($progress);
48 print_errors($errors);
50 echo'<input type="hidden" name="step" value="'.$step.'" />';
52 unset($_POST['step']);
53 unset($_POST['action']);
57 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
59 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
63 if (!copy('../../'.$_POST['step1']['old_path'] . '/include/config.inc.php', '../include/config.inc.php')) {
64 echo '<input type="hidden" name="step" value="'.$step.'" />';
66 print_feedback($progress);
68 $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.';
69 print_errors($errors);
71 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
73 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
76 echo '<input type="hidden" name="step" value="'.$step.'" />';
79 $progress[] = 'Data has been saved successfully.';
81 if (version_compare($_POST['step1']['old_version'], '1.5.2', '<')) {
82 require('include/config_template.php');
84 $comments = '/*'.str_pad(' This file was generated by the ATutor 1.5.2 installation script.', 70, ' ').'*/
85 /*'.str_pad(' File generated '.date('Y-m-d H:m:s'), 70, ' ').'*/';
87 $_POST['db_login'] = urldecode($_POST['db_login']);
88 $_POST['db_password'] = urldecode($_POST['db_password']);
90 write_config_file('../include/config.inc.php', $comments);
92 @chmod('../include/config.inc.php', 0444);
94 print_feedback($progress);
96 echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>';