moved code up one level to eliminate the docs subdirectory
[acontent.git] / install / index.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 define('TR_INCLUDE_PATH', 'include/');
14 error_reporting(E_ALL ^ E_NOTICE);
15
16 require('../include/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(TR_INCLUDE_PATH.'header.inc.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
35 $no_good = FALSE;
36 $not_as_good = FALSE;
37 ?>
38 <h3>Welcome to the AContent Installation</h3>
39 <p>This process will step you through your AContent 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 <h4>Requirements</h4>
43 <p>Please review the requirements below before proceeding.</p>
44                 <table class="data" style="width: 75%; max-width: 600px;">
45                 <tbody>
46                 <tr>
47                         <th scope="col">File Integrity</th>
48                         <th scope="col">Detected</th>
49                         <th scope="col">Status</th>
50                 </tr>
51                 <tr>
52                         <td>Case Sensitivity</td>
53                         <td><?php if (file_exists('../include/vitals.inc.php') && file_exists('../include/VITALS.inc.php')) {
54                                                 echo 'Ignored</td><td align="center">';
55                                                 echo $good;
56                                         } else if (file_exists('../include/vitals.inc.php')) {
57                                                 echo 'Enforced</td><td align="center">';
58                                                 echo $good;
59                                         } else {
60                                                 echo 'Enforced</td><td align="center">';
61                                                 echo $bad;
62                                                 $no_good = TRUE;
63                                         } ?></td>
64                 </tr>
65                 </tbody>
66                 <tbody>
67                 <tr>
68                         <th scope="col">PHP Options</th>
69                         <th scope="col">Detected</th>
70                         <th scope="col">Status</th>
71                 </tr>
72                 <tr>
73                         <td>PHP 5.0.0+</td>
74                         <td><?php echo phpversion(); ?></td>
75                         <td align="center"><?php        if (version_compare(phpversion(), '5.0.0', '>=')) {
76                                                         echo $good;
77                                                 } else {
78                                                         echo $bad;
79                                                         $no_good = TRUE;
80                                                 } ?></td>
81                 </tr>
82                 <tr>
83                         <td><kbd>mysql</kbd></td>
84                         <td><?php if (extension_loaded('mysql')) {
85                                                 echo 'Enabled</td><td align="center">';
86                                                 echo $good;
87                                         } else {
88                                                 echo 'Disabled</td><td align="center">';
89                                                 echo $bad;
90                                                 $no_good = TRUE;
91                                         } ?></td>
92                 </tr>
93                 <tr>
94                         <td><kbd>safe_mode = Off</kbd></td>
95                         <td><?php if (ini_get('safe_mode')) {
96                                                         echo 'On</td><td align="center">'; 
97                                                         echo $bad;
98                                                         $no_good = TRUE;
99                                                 } else {
100                                                         echo 'Off</td><td align="center">';
101                                                         echo $good;
102                                                 } ?></td>
103                 </tr>
104                 <tr>
105                         <td><kbd>file_uploads = On</kbd></td>
106                         <td><?php if (ini_get('file_uploads')) {
107                                                         echo 'On</td><td align="center">';
108                                                         echo $good;
109                                                 } else {
110                                                         echo 'Off</td><td align="center">';
111                                                         echo $bad;
112                                                         $no_good = TRUE;
113                                                 } ?></td>
114                 </tr>
115                 <tr>
116                         <td><kbd>upload_max_filesize</kbd> &gt;= 2 MB</td>
117                         <td><?php echo $filesize = ini_get('upload_max_filesize'); ?></td>
118                         <td align="center"><?php 
119                                 $filesize_int = intval($filesize);
120                                 if ("$filesize_int" == $filesize) {
121                                         // value is in Bytes
122                                         if ($filesize_int < 2 * 1024 * 1024) {
123                                                 echo $bad;
124                                         } else {
125                                                 echo $good;
126                                         }
127                                 } else if (stristr($filesize, 'M') !== FALSE) {
128                                         // value is in MegaBytes
129                                         if ($filesize_int < 2) {
130                                                 echo $bad;
131                                         } else {
132                                                 echo $good;
133                                         }
134                                 } else if (stristr($filesize, 'K') !== FALSE) {
135                                         // value is in KiloBytes
136                                         if ($filesize_int < 2 * 1024) {
137                                                 echo $bad;
138                                         } else {
139                                                 echo $good;
140                                         }
141                                 } else if (stristr($filesize, 'G') !== FALSE) {
142                                         // value is in GigaBytes
143                                         echo $good;
144                                 } else {
145                                         // not set?
146                                 }
147                                 ?></td>
148                 </tr>
149                 <tr>
150                         <td><kbd>post_max_size</kbd> &gt;= 8 MB</td>
151                         <td><?php echo $filesize = ini_get('post_max_size'); ?></td>
152                         <td align="center"><?php 
153                                 $filesize_int = intval($filesize);
154                                 if ("$filesize_int" == $filesize) {
155                                         // value is in Bytes
156                                         if ($filesize_int < 8 * 1024 * 1024) {
157                                                 echo $bad;
158                                         } else {
159                                                 echo $good;
160                                         }
161                                 } else if (stristr($filesize, 'M') !== FALSE) {
162                                         // value is in MegaBytes
163                                         if ($filesize_int < 8) {
164                                                 echo $bad;
165                                         } else {
166                                                 echo $good;
167                                         }
168                                 } else if (stristr($filesize, 'K') !== FALSE) {
169                                         // value is in KiloBytes
170                                         if ($filesize_int < 8 * 1024) {
171                                                 echo $bad;
172                                         } else {
173                                                 echo $good;
174                                         }
175                                 } else if (stristr($filesize, 'G') !== FALSE) {
176                                         // value is in GigaBytes
177                                         echo $good;
178                                 } else {
179                                         // not set?
180                                 }
181                                 ?></td>
182                 </tr>
183                 <tr>
184                         <td><kbd>.</kbd> in <kbd>include_path</kbd></td>
185                         <td><?php
186                                 $include_path = explode(PATH_SEPARATOR, ini_get('include_path'));
187                                 if (in_array('.', $include_path)) {
188                                         echo 'Enabled</td><td align="center">';
189                                         echo $good;
190                                 } else {
191                                         echo 'Disabled</td><td align="center">';
192                                         echo $bad;
193                                         $no_good = TRUE;                                        
194                                 }
195                         ?></td>
196                 </tr>
197                 </tbody>
198                 <tbody>
199                 <tr>
200                         <th scope="col">MySQL Options</th>
201                         <th scope="col">Detected</th>
202                         <th scope="col">Status</th>
203                 </tr>
204                 <tr>
205                         <td>MySQL 4.1.10+</td>
206                         <td><?php if (defined('MYSQL_NUM')) {
207                                                 $mysql_version = mysql_get_client_info();
208                                                 echo 'Found  Version '.$mysql_version.'</td><td align="center">';
209                                                 echo $good;
210                                         } else {
211                                                 echo 'Not Found</td><td align="center">';
212                                                 echo $bad;
213                                                 $no_good = TRUE;
214                                         } ?></td>
215                 </tr>
216                 </tbody>
217                 </table>
218 <br />
219
220 <?php if ($no_good): ?>
221         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
222         <tr>
223                 <td class="row1"><strong>Your server does not meet the minimum requirements!<br />
224                                                 Please correct the above errors to continue.</strong></td>
225         </tr>
226         </table>
227 <?php elseif ($not_as_good): ?>
228         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
229         <tr>
230                 <td class="row1"><strong>AContent has indicated that the 'mbstring' library is missing from the PHP.  <br />
231                                                 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 AContent will be used.  <br/><br/>
232                                                 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/>
233                                                 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>
234                 <td class="row1"></td>
235         </tr>
236         <tr>
237                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
238                 <td class="row1" width="150" align="center">
239                 <div id=''>
240                         <form action="install.php" method="post" name="form">
241                         <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
242                         <input type="submit" class="button" value="  Install  " name="next" disabled="disabled" />
243                         </form>
244                 </div>
245                 </td>
246         </tr>
247         </table>
248 <!-- 
249         <table cellspacing="0" cellpadding="10" align="center" width="45%">
250         <tr>
251                 <td align="center"><b>Or</b></td>
252         </tr>
253         </table>
254         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
255         <tr>
256                 <td class="row1"><strong>Upgrading from previous AContent must have mbstring library installed.</strong></td>
257                 <td class="row1"></td>
258         </tr>
259         <tr>
260                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
261                 <td class="row1" width="150" align="center">
262                         <input type="button" class="button" value="Upgrade" name="next" disabled="disabled"/>
263                 </td>
264         </tr>
265         </table>
266 -->
267 <?php else: ?>
268         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
269         <tr>
270                 <td align="right" class="row1" nowrap="nowrap"><strong>New Installation &raquo;</strong></td>
271                 <td class="row1" width="150" align="center"><form action="install.php" method="post" name="form">
272                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
273                 <input type="submit" class="button" value="  Install  " name="next" />
274                 </form></td>
275         </tr>
276         </table>
277         
278         <table cellspacing="0" cellpadding="10" align="center" width="45%">
279         <tr>
280                 <td align="center"><b>Or</b></td>
281         </tr>
282         </table>
283         <table cellspacing="0" class="tableborder" cellpadding="1" align="center" width="70%">
284         <tr>
285                 <td align="right" class="row1" nowrap="nowrap"><strong>Upgrade an Existing Installation &raquo;</strong></td>
286                 <td class="row1" width="150" align="center"><form action="upgrade.php" method="post" name="form">
287                 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
288                 <input type="submit" class="button" value="Upgrade" name="next" />
289                 </form></td>
290         </tr>
291         </table>
292 <?php endif; ?>
293
294 <?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>