remove old readme
[atutor.git] / docs / install / include / ustep5.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* http://atutor.ca                                                     */
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 /************************************************************************/
11 // $Id$
12
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
14
15 if(isset($_POST['submit'])) {
16         unset($_POST['submit']);
17         unset($action);
18         store_steps($step);
19         $step++;
20         return;
21 }
22
23 $file = '../include/config.inc.php';
24
25 unset($errors);
26 unset($progress);
27
28 if ( file_exists($file) ) {
29         @chmod($file, 0666);
30         if (!is_writeable($file)) {
31                 $errors[] = '<strong>' . $file . '</strong> is not writeable. Use <kbd>chmod a+rw '.$file.'</kbd> to change permissions.';
32         }else{
33                 $progress[] = '<strong>' . $file . '</strong> is writeable.';
34         }
35 } else {
36         $errors[] = '<strong>' . $file . '</strong> does not exist.';
37 }
38
39 print_progress($step);
40
41 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form">';
42
43 if (isset($errors)) {
44         if (isset($progress)) {
45                 print_feedback($progress);
46         }
47         print_errors($errors);
48
49         echo'<input type="hidden" name="step" value="'.$step.'" />';
50
51         unset($_POST['step']);
52         unset($_POST['action']);
53         unset($errors);
54         print_hidden($step);
55
56         echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
57
58         echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
59
60 } else {
61
62         if (!copy('../../'.$_POST['step1']['old_path'] . '/include/config.inc.php', '../include/config.inc.php')) {
63                 echo '<input type="hidden" name="step" value="'.$step.'" />';
64
65                 print_feedback($progress);
66
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);
69
70                 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
71
72                 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
73
74         } else {
75                 echo '<input type="hidden" name="step" value="'.$step.'" />';
76                 print_hidden($step);
77
78                 $progress[] =  'Data has been saved successfully.';
79
80                 if (version_compare($_POST['step1']['old_version'], '1.5.2', '<')) {
81                         require('include/config_template.php');
82                         
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, ' ').'*/';
85
86                         $_POST['db_login'] = urldecode($_POST['db_login']);
87                         $_POST['db_password'] = urldecode($_POST['db_password']);
88
89                         write_config_file('../include/config.inc.php', $comments);
90                 }
91                 @chmod('../include/config.inc.php', 0444);
92
93                 print_feedback($progress);
94
95                 echo '<p align="center"><input type="submit" class="button" value=" Next &raquo; " name="submit" /></p>';
96                 
97         }
98 }
99
100 ?>
101
102 </form>