PageRenderTime 42ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/install/index.php

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