made a copy
[atutor.git] / install / index.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 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 $not_as_good = FALSE;
38 ?>
39 <h3>Welcome to the ATutor Installation</h3>
40 <p>This process will step you through your ATutor installation or upgrade.</p>
41 <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>
42
43 <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>
44
45 <h4>Requirements</h4>
46 <p>Please review the requirements below before proceeding.</p>
47                 <table class="data" style="width: 75%; max-width: 600px;">
48                 <tbody>
49                 <tr>
50                         <th scope="col">File Integrity</th>
51                         <th scope="col">Detected</th>
52                         <th scope="col">Status</th>
53                 </tr>
54                 <tr>
55                         <td>Case Sensitivity</td>
56                         <td><?php if (file_exists('../include/classes/CSVExport.class.php') && file_exists('../include/classes/csvexport.class.php')) {
57                                                 echo 'Ignored</td><td align="center">';
58                                                 echo $good;
59                                         } else if (file_exists('../include/classes/CSVExport.class.php')) {
60                                                 echo 'Enforced</td><td align="center">';
61                                                 echo $good;
62                                         } else {
63                                                 echo 'Enforced</td><td align="center">';
64                                                 echo $bad;
65                                                 $no_good = TRUE;
66                                         } ?></td>
67                 </tr>
68                 </tbody>
69                 <tbody>
70                 <tr>
71                         <th scope="col">PHP Options</th>
72                         <th scope="col">Detected</th>
73                         <th scope="col">Status</th>
74                 </tr>
75                 <tr>
76                         <td>PHP 4.3.0+</td>
77                         <td><?php echo phpversion(); ?></td>
78                         <td align="center"><?php        if (version_compare(phpversion(), '4.3.0', '>=')) {
79                                                         echo $good;
80                                                 } else {
81                                                         echo $bad;
82                                                         $no_good = TRUE;
83                                                 } ?></td>
84                 </tr>
85                 <tr>
86                         <td><kbd>zlib</kbd></td>
87                         <td><?php if (extension_loaded('zlib')) {
88                                                 echo 'Enabled</td><td align="center">';
89                                                 echo $good;
90                                         } else {
91                                                 echo 'Disabled</td><td align="center">';
92                                                 echo $bad;
93                                                 $no_good = TRUE;
94                                         } ?></td>
95                 </tr>
96                 <tr>
97                         <td><kbd>mbstring</kbd></td>
98                         <td><?php if (extension_loaded('mbstring')) {
99                                                 echo 'Enabled</td><td align="center">';
100                                                 echo $good;
101                                         } else {
102                                                 echo 'Disabled</td><td align="center">';
103                                                 echo $bad;
104                                                 $not_as_good = TRUE;
105                                         } ?></td>
106                 </tr>
107                 <tr>
108                         <td><kbd>mysql</kbd></td>
109                         <td><?php if (extension_loaded('mysql')) {
110                                                 echo 'Enabled</td><td align="center">';
111                                                 echo $good;
112                                         } else {
113                                                 echo 'Disabled</td><td align="center">';
114                                                 echo $bad;
115                                                 $no_good = TRUE;
116                                         } ?></td>
117                 </tr>
118                 <tr>
119                         <td><kbd>safe_mode = Off</kbd></td>
120                         <td><?php if (ini_get('safe_mode')) {
121                                                         echo 'On</td><td align="center">'; 
122                                                         echo $bad;
123                                                         $no_good = TRUE;
124                                                 } else {
125                                                         echo 'Off</td><td align="center">';
126                                                         echo $good;
127                                                 } ?></td>
128                 </tr>
129                 <tr>
130                         <td><kbd>file_uploads = On</kbd></td>
131                         <td><?php if (ini_get('file_uploads')) {
132                                                         echo 'On</td><td align="center">';
133                                                         echo $good;
134                                                 } else {
135                                                         echo 'Off</td><td align="center">';
136                                                         echo $bad;
137                                                         $no_good = TRUE;
138                                                 } ?></td>
139                 </tr>
140                 <tr>
141                         <td><kbd>upload_max_filesize</kbd> &gt;= 2 MB</td>
142                         <td><?php echo $filesize = ini_get('upload_max_filesize'); ?></td>
143                         <td align="center"><?php 
144                                 $filesize_int = intval($filesize);
145                                 if ("$filesize_int" == $filesize) {
146                                         // value is in Bytes
147                                         if ($filesize_int < 2 * 1024 * 1024) {
148                                                 echo $bad;
149                                         } else {
150                                                 echo $good;
151                                         }
152                                 } else if (stristr($filesize, 'M') !== FALSE) {
153                                         // value is in MegaBytes
154                                         if ($filesize_int < 2) {
155                                                 echo $bad;
156                                         } else {
157                                                 echo $good;
158                                         }
159                                 } else if (stristr($filesize, 'K') !== FALSE) {
160                                         // value is in KiloBytes
161                                         if ($filesize_int < 2 * 1024) {
162                                                 echo $bad;
163                                         } else {
164                                                 echo $good;
165                                         }
166                                 } else if (stristr($filesize, 'G') !== FALSE) {
167                                         // value is in GigaBytes
168                                         echo $good;
169                                 } else {
170                                         // not set?
171                                 }
172                                 ?></td>
173                 </tr>
174                 <tr>
175                         <td><kbd>post_max_size</kbd> &gt;= 8 MB</td>
176                         <td><?php echo $filesize = ini_get('post_max_size'); ?></td>
177                         <td align="center"><?php 
178                                 $filesize_int = intval($filesize);
179                                 if ("$filesize_int" == $filesize) {
180                                         // value is in Bytes
181                                         if ($filesize_int < 8 * 1024 * 1024) {
182                                                 echo $bad;
183                                         } else {
184                                                 echo $good;
185                                         }
186                                 } else if (stristr($filesize, 'M') !== FALSE) {
187                                         // value is in MegaBytes
188                                         if ($filesize_int < 8) {
189                                                 echo $bad;
190                                         } else {
191                                                 echo $good;
192                                         }
193                                 } else if (stristr($filesize, 'K') !== FALSE) {
194                                         // value is in KiloBytes
195                                         if ($filesize_int < 8 * 1024) {
196                                                 echo $bad;
197                                         } else {
198                                                 echo $good;
199                                         }
200                                 } else if (stristr($filesize, 'G') !== FALSE) {
201                                         // value is in GigaBytes
202                                         echo $good;
203                                 } else {
204                                         // not set?
205                                 }
206                                 ?></td>
207                 </tr>
208                 <tr>
209                         <td><kbd>sessions</kbd></td>
210                         <td><?php if (extension_loaded('session')) {
211                                                 echo 'Enabled</td><td align="center">';
212                                                 echo $good;
213                                         } else {
214                                                 echo 'Disabled</td><td align="center">';
215                                                 echo $bad;
216                                                 $no_good = TRUE;
217                                         } ?></td>
218                 </tr>
219                 <tr>
220                         <td><kbd>session.auto_start = 0</kbd></td>
221                         <td><?php if (ini_get('session.auto_start')) {
222                                                         echo '1</td><td align="center">';
223                                                         echo $bad;
224                                                         $no_good = TRUE;
225                                                 } else {
226                                                         echo '0</td><td align="center">';
227                                                         echo $good;
228                                                 } ?></td>
229                 </tr>
230                 <tr>
231                         <td><kbd>session.save_path</kbd></td>
232                         <td><?php
233                                 if ($session_error == '') {
234                                         echo 'Directory Writeable</td><td align="center">';
235                                         echo $good;
236                                 } else {
237                                         echo 'Directory Not Writeable</td><td align="center">';
238                                         echo $bad;
239                                         $no_good = TRUE;                                        
240                                 }
241                         ?></td>
242                 </tr>
243                 <tr>
244                         <td><kbd>.</kbd> in <kbd>include_path</kbd></td>
245                         <td><?php
246                                 $include_path = explode(PATH_SEPARATOR, ini_get('include_path'));
247                                 if (in_array('.', $include_path)) {
248                                         echo 'Enabled</td><td align="center">';
249                                         echo $good;
250                                 } else {
251                                         echo 'Disabled</td><td align="center">';
252                                         echo $bad;
253                                         $no_good = TRUE;                                        
254                                 }
255                         ?></td>
256                 </tr>
257                 </tbody>
258                 <tbody>
259                 <tr>
260                         <th scope="col">MySQL Options</th>
261                         <th scope="col">Detected</th>
262                         <th scope="col">Status</th>
263                 </tr>
264                 <tr>
265                         <td>MySQL 4.1.10+</td>
266                         <td><?php if (defined('MYSQL_NUM')) {
267                                                 $mysql_version = mysql_get_client_info();
268                                                 echo 'Found  Version '.$mysql_version.'</td><td align="center">';
269                                                 echo $good;
270                                         } else {
271                                                 echo 'Not Found</td><td align="center">';
272                                                 echo $bad;
273                                                 $no_good = TRUE;
274                                         } ?></td>
275                 </tr>
276                 </tbody>
277                 </table>
278 <br />
279
280 <?php if ($no_good): ?>
281         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
282         <tr>
283                 <td class="row1"><strong>Your server does not meet the minimum requirements!<br />
284                                                 Please correct the above errors to continue.</strong></td>
285         </tr>
286         </table>
287 <?php elseif ($not_as_good): ?>
288         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
289         <tr>
290                 <td class="row1"><strong>ATutor has indicated that the 'mbstring' library is missing from the PHP.  <br />
291                                                 We strongly encourage you to install the 'mbstring' library before continuing, however, if you choose not to install the library from PHP, a third party library within ATutor will be used.  <br/><br/>
292                                                 For production systems, we strongly encourage you to install the PHP with <a href="http://ca.php.net/manual/en/ref.mbstring.php" target="php_site">mbstring</a> support.  <br/><br/>
293                                                 You may choose to by pass the mbstring check for the installation at your own risk by clicking <a href="javascript:void(0);" onclick="javascript:document.form.next.disabled=false;">continue</a>.</strong></td>
294                 <td class="row1"></td>
295         </tr>
296         <tr>
297                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
298                 <td class="row1" width="150" align="center">
299                 <div id=''>
300                         <form action="install.php" method="post" name="form">
301                         <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
302                         <input type="submit" class="button" value="  Install  " name="next" disabled="true" />
303                         </form>
304                 </div>
305                 </td>
306         </tr>
307         </table>
308         <table cellspacing="0" cellpadding="10" align="center" width="45%">
309         <tr>
310                 <td align="center"><b>Or</b></td>
311         </tr>
312         </table>
313         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
314         <tr>
315                 <td class="row1"><strong>Upgrading from previous ATutor must have mbstring library installed.</strong></td>
316                 <td class="row1"></td>
317         </tr>
318         <tr>
319                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
320                 <td class="row1" width="150" align="center">
321                 <input type="button" class="button" value="Upgrade" name="next" disabled="true"/>
322                 </form></td>
323         </tr>
324         </table>
325 <?php else: ?>
326         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
327         <tr>
328                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
329                 <td class="row1" width="150" align="center"><form action="install.php" method="post" name="form">
330                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
331                 <input type="submit" class="button" value="  Install  " name="next" />
332                 </form></td>
333         </tr>
334         </table>
335         <table cellspacing="0" cellpadding="10" align="center" width="45%">
336         <tr>
337                 <td align="center"><b>Or</b></td>
338         </tr>
339         </table>
340         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
341         <tr>
342                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
343                 <td class="row1" width="150" align="center"><form action="upgrade.php" method="post" name="form">
344                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
345                 <input type="submit" class="button" value="Upgrade" name="next" />
346                 </form></td>
347         </tr>
348         </table>
349 <?php endif; ?>
350
351 <?php require(AT_INCLUDE_PATH.'footer.php'); ?>