8ea551fb247eaeee9b926b34bcf7b60a157f782a
[acontent.git] / docs / install / include / ustep5.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 /************************************************************************/
12
13 if (!defined('TR_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                 @chmod('../include/config.inc.php', 0444);
81
82                 print_feedback($progress);
83
84                 echo '<p align="center"><input type="submit" class="button" value=" Next &raquo; " name="submit" /></p>';
85                 
86         }
87 }
88
89 ?>
90
91 </form>