remove old readme
[atutor.git] / docs / install / index.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 define('AT_INCLUDE_PATH', 'include/');
14 error_reporting(E_ALL ^ E_NOTICE);
15
16 require('../include/lib/constants.inc.php');
17
18 $new_version = VERSION;
19
20 header('Cache-Control: no-store, no-cache, must-revalidate');
21 header('Pragma: no-cache');
22
23 $session_error = '';
24 error_reporting(E_ALL);
25 ob_start();
26 session_start();
27 $session_error = ob_get_contents();
28 ob_end_clean();
29 error_reporting(E_ALL ^ E_NOTICE);
30
31 require(AT_INCLUDE_PATH.'header.php');
32 $bad  = '<img src="images/bad.gif" width="14" height="13" border="0" alt="Bad" title="Bad" />';
33 $good = '<img src="images/feedback.gif" width="16" height="13" border="0" alt="Good" title="Good" />';
34 $warning = '<img src="images/warning.png" width="16" height="16" border="0" alt="Warning" title="Warning" />';
35
36 $no_good = FALSE;
37 $not_as_good = FALSE;
38 ?>
39 <table style="float: right;
40         background-color: #FEFDEF;
41         border: 1pt solid #B8AE9C;
42         margin: 20pt 5pt 5pt 5pt;
43         padding-right: 10pt;
44         padding-bottom: 5pt;
45         padding-left: 10pt;
46 ">
47         <tr style="align:center;"><th colspan="2" style="background-color:transparent;">Icon Legend</th></tr>
48         <tr><td><?php echo $good;?></td><td>Pass, can proceed</td></tr>
49         <tr><td><?php echo $warning;?></td><td>Warning but can proceed</td></tr>
50         <tr><td><?php echo $bad;?></td><td>Failed, can not proceed</td></tr>
51 </table>
52
53 <h3>Welcome to the ATutor Installation</h3>
54 <p>This process will step you through your ATutor installation or upgrade.</p>
55 <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>
56
57 <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>
58
59 <h4>Requirements</h4>
60 <p>Please review the requirements below before proceeding.</p>
61                 <table class="data" style="width: 75%; max-width: 600px;">
62                 <tbody>
63                 <tr>
64                         <th scope="col">File Integrity</th>
65                         <th scope="col">Detected</th>
66                         <th scope="col">Status</th>
67                 </tr>
68                 <tr>
69                         <td>Case Sensitivity</td>
70                         <td><?php if (file_exists('../include/classes/CSVExport.class.php') && file_exists('../include/classes/csvexport.class.php')) {
71                                                 echo 'Ignored</td><td align="center">';
72                                                 echo $good;
73                                         } else if (file_exists('../include/classes/CSVExport.class.php')) {
74                                                 echo 'Enforced</td><td align="center">';
75                                                 echo $good;
76                                         } else {
77                                                 echo 'Enforced</td><td align="center">';
78                                                 echo $bad;
79                                                 $no_good = TRUE;
80                                         } ?></td>
81                 </tr>
82                 </tbody>
83                 <tbody>
84                 <tr>
85                         <th scope="col">PHP Options</th>
86                         <th scope="col">Detected</th>
87                         <th scope="col">Status</th>
88                 </tr>
89                 <tr>
90                         <td>PHP 4.3.0+</td>
91                         <td><?php echo phpversion(); ?></td>
92                         <td align="center"><?php        if (version_compare(phpversion(), '4.3.0', '>=')) {
93                                                         echo $good;
94                                                 } else {
95                                                         echo $bad;
96                                                         $no_good = TRUE;
97                                                 } ?></td>
98                 </tr>
99                 <tr>
100                         <td><kbd>zlib</kbd></td>
101                         <td><?php if (extension_loaded('zlib')) {
102                                                 echo 'Enabled</td><td align="center">';
103                                                 echo $good;
104                                         } else {
105                                                 echo 'Disabled</td><td align="center">';
106                                                 echo $bad;
107                                                 $no_good = TRUE;
108                                         } ?></td>
109                 </tr>
110                 <tr>
111                         <td><kbd>mbstring</kbd></td>
112                         <td><?php if (extension_loaded('mbstring')) {
113                                                 echo 'Enabled</td><td align="center">';
114                                                 echo $good;
115                                         } else {
116                                                 echo 'Disabled</td><td align="center">';
117                                                 echo $bad;
118                                                 $not_as_good = TRUE;
119                                         } ?></td>
120                 </tr>
121                 <tr>
122                         <td><kbd>mysql</kbd></td>
123                         <td><?php if (extension_loaded('mysql')) {
124                                                 echo 'Enabled</td><td align="center">';
125                                                 echo $good;
126                                         } else {
127                                                 echo 'Disabled</td><td align="center">';
128                                                 echo $bad;
129                                                 $no_good = TRUE;
130                                         } ?></td>
131                 </tr>
132                 <tr>
133                         <td><kbd>safe_mode = Off</kbd></td>
134                         <td><?php if (ini_get('safe_mode')) {
135                                                         echo 'On</td><td align="center">'; 
136                                                         echo $bad;
137                                                         $no_good = TRUE;
138                                                 } else {
139                                                         echo 'Off</td><td align="center">';
140                                                         echo $good;
141                                                 } ?></td>
142                 </tr>
143                 <tr>
144                         <td><kbd>file_uploads = On</kbd></td>
145                         <td><?php if (ini_get('file_uploads')) {
146                                                         echo 'On</td><td align="center">';
147                                                         echo $good;
148                                                 } else {
149                                                         echo 'Off</td><td align="center">';
150                                                         echo $bad;
151                                                         $no_good = TRUE;
152                                                 } ?></td>
153                 </tr>
154                 <tr>
155                         <td><kbd>GD</kbd></td>
156                         <td><?php if (extension_loaded('gd')) {
157                                         echo 'On</td><td align="center">';
158                                         echo $good;
159                                 } else {
160                                         echo 'Disabled</td><td align="center">';
161                                         echo $warning;
162                                 } ?></td>
163                 </tr>
164                 <?php if (extension_loaded('gd')): $gd_info = gd_info();?>
165                 <tr>
166                         <td><kbd>JPEG Support</kbd></td>
167                         <td><?php if ($gd_info['JPG Support'] || $gd_info['JPEG Support']) {
168                                         echo 'On</td><td align="center">';
169                                         echo $good;
170                                 } else {
171                                         echo 'Disabled</td><td align="center">';
172                                         echo $warning;
173                                 } ?></td>
174                 </tr>
175                 <?php endif; ?>
176                 <tr>
177                         <td><kbd>upload_max_filesize</kbd> &gt;= 2 MB</td>
178                         <td><?php echo $filesize = ini_get('upload_max_filesize'); ?></td>
179                         <td align="center"><?php 
180                                 $filesize_int = intval($filesize);
181                                 if ("$filesize_int" == $filesize) {
182                                         // value is in Bytes
183                                         if ($filesize_int < 2 * 1024 * 1024) {
184                                                 echo $bad;
185                                         } else {
186                                                 echo $good;
187                                         }
188                                 } else if (stristr($filesize, 'M') !== FALSE) {
189                                         // value is in MegaBytes
190                                         if ($filesize_int < 2) {
191                                                 echo $bad;
192                                         } else {
193                                                 echo $good;
194                                         }
195                                 } else if (stristr($filesize, 'K') !== FALSE) {
196                                         // value is in KiloBytes
197                                         if ($filesize_int < 2 * 1024) {
198                                                 echo $bad;
199                                         } else {
200                                                 echo $good;
201                                         }
202                                 } else if (stristr($filesize, 'G') !== FALSE) {
203                                         // value is in GigaBytes
204                                         echo $good;
205                                 } else {
206                                         // not set?
207                                 }
208                                 ?></td>
209                 </tr>
210                 <tr>
211                         <td><kbd>post_max_size</kbd> &gt;= 8 MB</td>
212                         <td><?php echo $filesize = ini_get('post_max_size'); ?></td>
213                         <td align="center"><?php 
214                                 $filesize_int = intval($filesize);
215                                 if ("$filesize_int" == $filesize) {
216                                         // value is in Bytes
217                                         if ($filesize_int < 8 * 1024 * 1024) {
218                                                 echo $bad;
219                                         } else {
220                                                 echo $good;
221                                         }
222                                 } else if (stristr($filesize, 'M') !== FALSE) {
223                                         // value is in MegaBytes
224                                         if ($filesize_int < 8) {
225                                                 echo $bad;
226                                         } else {
227                                                 echo $good;
228                                         }
229                                 } else if (stristr($filesize, 'K') !== FALSE) {
230                                         // value is in KiloBytes
231                                         if ($filesize_int < 8 * 1024) {
232                                                 echo $bad;
233                                         } else {
234                                                 echo $good;
235                                         }
236                                 } else if (stristr($filesize, 'G') !== FALSE) {
237                                         // value is in GigaBytes
238                                         echo $good;
239                                 } else {
240                                         // not set?
241                                 }
242                                 ?></td>
243                 </tr>
244                 <tr>
245                         <td><kbd>sessions</kbd></td>
246                         <td><?php if (extension_loaded('session')) {
247                                                 echo 'Enabled</td><td align="center">';
248                                                 echo $good;
249                                         } else {
250                                                 echo 'Disabled</td><td align="center">';
251                                                 echo $bad;
252                                                 $no_good = TRUE;
253                                         } ?></td>
254                 </tr>
255                 <tr>
256                         <td><kbd>session.auto_start = 0</kbd></td>
257                         <td><?php if (ini_get('session.auto_start')) {
258                                                         echo '1</td><td align="center">';
259                                                         echo $bad;
260                                                         $no_good = TRUE;
261                                                 } else {
262                                                         echo '0</td><td align="center">';
263                                                         echo $good;
264                                                 } ?></td>
265                 </tr>
266                 <tr>
267                         <td><kbd>session.save_path</kbd></td>
268                         <td><?php
269                                 if ($session_error == '') {
270                                         echo 'Directory Writeable</td><td align="center">';
271                                         echo $good;
272                                 } else {
273                                         echo 'Directory Not Writeable</td><td align="center">';
274                                         echo $bad;
275                                         $no_good = TRUE;                                        
276                                 }
277                         ?></td>
278                 </tr>
279                 <tr>
280                         <td><kbd>curl</kbd></td>
281                         <td><?php
282                                 if (extension_loaded('curl')){
283                                         echo 'Enabled</td><td align="center">';
284                                         echo $good;
285                                 } else {
286                                         echo 'Disabled</td><td align="center">';
287                                         echo $warning;
288                                 }
289                         ?></td>
290                 </tr>
291                 <tr>
292                         <td><kbd>.</kbd> in <kbd>include_path</kbd></td>
293                         <td><?php
294                                 $include_path = explode(PATH_SEPARATOR, ini_get('include_path'));
295                                 if (in_array('.', $include_path)) {
296                                         echo 'Enabled</td><td align="center">';
297                                         echo $good;
298                                 } else {
299                                         echo 'Disabled</td><td align="center">';
300                                         echo $bad;
301                                         $no_good = TRUE;                                        
302                                 }
303                         ?></td>
304                 </tr>
305                 <tr>
306                         <td>Mail configuration</td>
307                         <td><?php
308                         $smtp_server = ini_get('SMTP');
309                         if (($smtp_server == '' || $smtp_server == 'localhost') && ini_get('sendmail_path') == '') {
310                                         echo 'Disabled</td><td align="center">';
311                                         echo $warning;
312                                 } else {
313                                         echo 'Enabled</td><td align="center">';
314                                         echo $good;
315                                 }
316                         ?></td>
317                 </tr>
318                 </tbody>
319                 <tbody>
320                 <tr>
321                         <th scope="col">MySQL Options</th>
322                         <th scope="col">Detected</th>
323                         <th scope="col">Status</th>
324                 </tr>
325                 <tr>
326                         <td>MySQL 4.1.10+</td>
327                         <td><?php if (defined('MYSQL_NUM')) {
328                                                 $mysql_version = mysql_get_client_info();
329                                                 echo 'Found  Version '.$mysql_version.'</td><td align="center">';
330                                                 echo $good;
331                                         } else {
332                                                 echo 'Not Found</td><td align="center">';
333                                                 echo $bad;
334                                                 $no_good = TRUE;
335                                         } ?></td>
336                 </tr>
337                 </tbody>
338                 </table>
339 <br />
340
341 <?php if ($no_good): ?>
342         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
343         <tr>
344                 <td class="row1"><strong>Your server does not meet the minimum requirements!<br />
345                                                 Please correct the above errors to continue.</strong></td>
346         </tr>
347         </table>
348 <?php elseif ($not_as_good): ?>
349         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
350         <tr>
351                 <td class="row1"><strong>ATutor has indicated that the 'mbstring' library is missing from the PHP.  <br />
352                                                 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/>
353                                                 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/>
354                                                 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>
355                 <td class="row1"></td>
356         </tr>
357         <tr>
358                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
359                 <td class="row1" width="150" align="center">
360                 <div id=''>
361                         <form action="install.php" method="post" name="form">
362                         <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
363                         <input type="submit" class="button" value="  Install  " name="next" disabled="true" />
364                         </form>
365                 </div>
366                 </td>
367         </tr>
368         </table>
369         <table cellspacing="0" cellpadding="10" align="center" width="45%">
370         <tr>
371                 <td align="center"><b>Or</b></td>
372         </tr>
373         </table>
374         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
375         <tr>
376                 <td class="row1"><strong>Upgrading from previous ATutor must have mbstring library installed.</strong></td>
377                 <td class="row1"></td>
378         </tr>
379         <tr>
380                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
381                 <td class="row1" width="150" align="center">
382                 <input type="button" class="button" value="Upgrade" name="next" disabled="true"/>
383                 </form></td>
384         </tr>
385         </table>
386 <?php else: ?>
387         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
388         <tr>
389                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
390                 <td class="row1" width="150" align="center"><form action="install.php" method="post" name="form">
391                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
392                 <input type="submit" class="button" value="  Install  " name="next" />
393                 </form></td>
394         </tr>
395         </table>
396         <table cellspacing="0" cellpadding="10" align="center" width="45%">
397         <tr>
398                 <td align="center"><b>Or</b></td>
399         </tr>
400         </table>
401         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
402         <tr>
403                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
404                 <td class="row1" width="150" align="center"><form action="upgrade.php" method="post" name="form">
405                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
406                 <input type="submit" class="button" value="Upgrade" name="next" />
407                 </form></td>
408         </tr>
409         </table>
410 <?php endif; ?>
411
412 <?php require(AT_INCLUDE_PATH.'footer.php'); ?>