tagging as ATutor 1.5.4-release
[atutor.git] / install / index.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay, Joel Kronenberg, Heidi Hazelton */
6 /* http://atutor.ca                                                                                                             */
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 // $Id$
13
14 define('AT_INCLUDE_PATH', 'include/');
15 error_reporting(E_ALL ^ E_NOTICE);
16
17 require('../include/lib/constants.inc.php');
18
19 $new_version = VERSION;
20
21 header('Cache-Control: no-store, no-cache, must-revalidate');
22 header('Pragma: no-cache');
23
24 $session_error = '';
25 error_reporting(E_ALL);
26 ob_start();
27 session_start();
28 $session_error = ob_get_contents();
29 ob_end_clean();
30 error_reporting(E_ALL ^ E_NOTICE);
31
32 require(AT_INCLUDE_PATH.'header.php');
33 $bad  = '<img src="images/bad.gif" width="14" height="13" border="0" alt="Bad" title="Bad" />';
34 $good = '<img src="images/feedback.gif" width="16" height="13" border="0" alt="Good" title="Good" />';
35
36 $no_good = FALSE;
37 ?>
38 <h3>Welcome to the ATutor Installation</h3>
39 <p>This process will step you through your ATutor installation or upgrade.</p>
40 <p>During this process be sure not to use your browser's <em>Refresh</em> or <em>Reload</em> feature as it may complicate the installation process.</p>
41
42 <p>Before you continue you may want to review the <a href="../documentation/admin/" target="_new"><em>ATutor Handbook</em></a> for more detailed instructions.</p>
43
44 <h4>Requirements</h4>
45 <p>Please review the requirements below before proceeding.</p>
46                 <table class="data" style="width: 75%; max-width: 600px;">
47                 <tbody>
48                 <tr>
49                         <th scope="col">File Integrity</th>
50                         <th scope="col">Detected</th>
51                         <th scope="col">Status</th>
52                 </tr>
53                 <tr>
54                         <td>Case Sensitivity</td>
55                         <td><?php if (file_exists('../include/classes/CSVExport.class.php') && file_exists('../include/classes/csvexport.class.php')) {
56                                                 echo 'Ignored</td><td align="center">';
57                                                 echo $good;
58                                         } else if (file_exists('../include/classes/CSVExport.class.php')) {
59                                                 echo 'Enforced</td><td align="center">';
60                                                 echo $good;
61                                         } else {
62                                                 echo 'Enforced</td><td align="center">';
63                                                 echo $bad;
64                                                 $no_good = TRUE;
65                                         } ?></td>
66                 </tr>
67                 </tbody>
68                 <tbody>
69                 <tr>
70                         <th scope="col">PHP Options</th>
71                         <th scope="col">Detected</th>
72                         <th scope="col">Status</th>
73                 </tr>
74                 <tr>
75                         <td>PHP 4.3.0+</td>
76                         <td><?php echo phpversion(); ?></td>
77                         <td align="center"><?php        if (version_compare(phpversion(), '4.3.0', '>=')) {
78                                                         echo $good;
79                                                 } else {
80                                                         echo $bad;
81                                                         $no_good = TRUE;
82                                                 } ?></td>
83                 </tr>
84                 <tr>
85                         <td><kbd>zlib</kbd></td>
86                         <td><?php if (extension_loaded('zlib')) {
87                                                 echo 'Enabled</td><td align="center">';
88                                                 echo $good;
89                                         } else {
90                                                 echo 'Disabled</td><td align="center">';
91                                                 echo $bad;
92                                                 $no_good = TRUE;
93                                         } ?></td>
94                 </tr>
95                 <tr>
96                         <td><kbd>mysql</kbd></td>
97                         <td><?php if (extension_loaded('mysql')) {
98                                                 echo 'Enabled</td><td align="center">';
99                                                 echo $good;
100                                         } else {
101                                                 echo 'Disabled</td><td align="center">';
102                                                 echo $bad;
103                                                 $no_good = TRUE;
104                                         } ?></td>
105                 </tr>
106                 <tr>
107                         <td><kbd>safe_mode = Off</kbd></td>
108                         <td><?php if (ini_get('safe_mode')) {
109                                                         echo 'On</td><td align="center">'; 
110                                                         echo $bad;
111                                                         $no_good = TRUE;
112                                                 } else {
113                                                         echo 'Off</td><td align="center">';
114                                                         echo $good;
115                                                 } ?></td>
116                 </tr>
117                 <tr>
118                         <td><kbd>file_uploads = On</kbd></td>
119                         <td><?php if (ini_get('file_uploads')) {
120                                                         echo 'On</td><td align="center">';
121                                                         echo $good;
122                                                 } else {
123                                                         echo 'Off</td><td align="center">';
124                                                         echo $bad;
125                                                         $no_good = TRUE;
126                                                 } ?></td>
127                 </tr>
128                 <tr>
129                         <td><kbd>upload_max_filesize</kbd> &gt;= 2 MB</td>
130                         <td><?php echo $filesize = ini_get('upload_max_filesize'); ?></td>
131                         <td align="center"><?php 
132                                 $filesize_int = intval($filesize);
133                                 if ("$filesize_int" == $filesize) {
134                                         // value is in Bytes
135                                         if ($filesize_int < 2 * 1024 * 1024) {
136                                                 echo $bad;
137                                         } else {
138                                                 echo $good;
139                                         }
140                                 } else if (stristr($filesize, 'M') !== FALSE) {
141                                         // value is in MegaBytes
142                                         if ($filesize_int < 2) {
143                                                 echo $bad;
144                                         } else {
145                                                 echo $good;
146                                         }
147                                 } else if (stristr($filesize, 'K') !== FALSE) {
148                                         // value is in KiloBytes
149                                         if ($filesize_int < 2 * 1024) {
150                                                 echo $bad;
151                                         } else {
152                                                 echo $good;
153                                         }
154                                 } else if (stristr($filesize, 'G') !== FALSE) {
155                                         // value is in GigaBytes
156                                         echo $good;
157                                 } else {
158                                         // not set?
159                                 }
160                                 ?></td>
161                 </tr>
162                 <tr>
163                         <td><kbd>post_max_size</kbd> &gt;= 8 MB</td>
164                         <td><?php echo $filesize = ini_get('post_max_size'); ?></td>
165                         <td align="center"><?php 
166                                 $filesize_int = intval($filesize);
167                                 if ("$filesize_int" == $filesize) {
168                                         // value is in Bytes
169                                         if ($filesize_int < 8 * 1024 * 1024) {
170                                                 echo $bad;
171                                         } else {
172                                                 echo $good;
173                                         }
174                                 } else if (stristr($filesize, 'M') !== FALSE) {
175                                         // value is in MegaBytes
176                                         if ($filesize_int < 8) {
177                                                 echo $bad;
178                                         } else {
179                                                 echo $good;
180                                         }
181                                 } else if (stristr($filesize, 'K') !== FALSE) {
182                                         // value is in KiloBytes
183                                         if ($filesize_int < 8 * 1024) {
184                                                 echo $bad;
185                                         } else {
186                                                 echo $good;
187                                         }
188                                 } else if (stristr($filesize, 'G') !== FALSE) {
189                                         // value is in GigaBytes
190                                         echo $good;
191                                 } else {
192                                         // not set?
193                                 }
194                                 ?></td>
195                 </tr>
196                 <tr>
197                         <td><kbd>sessions</kbd></td>
198                         <td><?php if (extension_loaded('session')) {
199                                                 echo 'Enabled</td><td align="center">';
200                                                 echo $good;
201                                         } else {
202                                                 echo 'Disabled</td><td align="center">';
203                                                 echo $bad;
204                                                 $no_good = TRUE;
205                                         } ?></td>
206                 </tr>
207                 <tr>
208                         <td><kbd>session.auto_start = 0</kbd></td>
209                         <td><?php if (ini_get('session.auto_start')) {
210                                                         echo '1</td><td align="center">';
211                                                         echo $bad;
212                                                         $no_good = TRUE;
213                                                 } else {
214                                                         echo '0</td><td align="center">';
215                                                         echo $good;
216                                                 } ?></td>
217                 </tr>
218                 <tr>
219                         <td><kbd>session.save_path</kbd></td>
220                         <td><?php
221                                 if ($session_error == '') {
222                                         echo 'Directory Writeable</td><td align="center">';
223                                         echo $good;
224                                 } else {
225                                         echo 'Directory Not Writeable</td><td align="center">';
226                                         echo $bad;
227                                         $no_good = TRUE;                                        
228                                 }
229                         ?></td>
230                 </tr>
231                 <tr>
232                         <td><kbd>.</kbd> in <kbd>include_path</kbd></td>
233                         <td><?php
234                                 $include_path = explode(PATH_SEPARATOR, ini_get('include_path'));
235                                 if (in_array('.', $include_path)) {
236                                         echo 'Enabled</td><td align="center">';
237                                         echo $good;
238                                 } else {
239                                         echo 'Disabled</td><td align="center">';
240                                         echo $bad;
241                                         $no_good = TRUE;                                        
242                                 }
243                         ?></td>
244                 </tr>
245                 </tbody>
246                 <tbody>
247                 <tr>
248                         <th scope="col">MySQL Options</th>
249                         <th scope="col">Detected</th>
250                         <th scope="col">Status</th>
251                 </tr>
252                 <tr>
253                         <td>MySQL 4.0.2+</td>
254                         <td><?php if (defined('MYSQL_NUM')) {
255                                                 echo 'Found Unknown Version</td><td align="center">';
256                                                 echo $good;
257                                         } else {
258                                                 echo 'Not Found</td><td align="center">';
259                                                 echo $bad;
260                                                 $no_good = TRUE;
261                                         } ?></td>
262                 </tr>
263                 </tbody>
264                 </table>
265 <br />
266
267 <?php if ($no_good): ?>
268         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
269         <tr>
270                 <td class="row1"><strong>Your server does not meet the minimum requirements!<br />
271                                                 Please correct the above errors to continue.</strong></td>
272         </tr>
273         </table>
274 <?php else: ?>
275         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
276         <tr>
277                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
278                 <td class="row1" width="150" align="center"><form action="install.php" method="post" name="form">
279                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
280                 <input type="submit" class="button" value="  Install  " name="next" />
281                 </form></td>
282         </tr>
283         </table>
284         <table cellspacing="0" cellpadding="10" align="center" width="45%">
285         <tr>
286                 <td align="center"><b>Or</b></td>
287         </tr>
288         </table>
289         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
290         <tr>
291                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
292                 <td class="row1" width="150" align="center"><form action="upgrade.php" method="post" name="form">
293                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
294                 <input type="submit" class="button" value="Upgrade" name="next" />
295                 </form></td>
296         </tr>
297         </table>
298 <?php endif; ?>
299
300 <?php require(AT_INCLUDE_PATH.'footer.php'); ?>