PageRenderTime 1368ms CodeModel.GetById 26ms RepoModel.GetById 9ms app.codeStats 0ms

/www/install/step1.php

https://github.com/vikjon0/newznab
PHP | 97 lines | 71 code | 23 blank | 3 comment | 23 complexity | 4c3d8664fca0da63cf70f2affc53f032 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. require_once('../lib/installpage.php');
  3. require_once('../lib/install.php');
  4. $page = new Installpage();
  5. $page->title = "Preflight Checklist";
  6. $cfg = new Install();
  7. if (!$cfg->isInitialized()) {
  8. header("Location: index.php");
  9. die();
  10. }
  11. $cfg = $cfg->getSession();
  12. // Start checks
  13. $cfg->sha1Check = function_exists('sha1');
  14. if ($cfg->sha1Check === false) { $cfg->error = true; }
  15. $cfg->mysqlCheck = function_exists('mysql_connect');
  16. if ($cfg->mysqlCheck === false) { $cfg->error = true; }
  17. $cfg->gdCheck = function_exists('imagecreatetruecolor');
  18. $cfg->curlCheck = function_exists('curl_init');
  19. $cfg->cacheCheck = is_writable($cfg->SMARTY_DIR.'/templates_c');
  20. if ($cfg->cacheCheck === false) { $cfg->error = true; }
  21. $cfg->movieCoversCheck = is_writable($cfg->WWW_DIR.'/covers/movies');
  22. if ($cfg->movieCoversCheck === false) { $cfg->error = true; }
  23. $cfg->musicCoversCheck = is_writable($cfg->WWW_DIR.'/covers/music');
  24. if ($cfg->musicCoversCheck === false) { $cfg->error = true; }
  25. $cfg->configCheck = is_writable($cfg->WWW_DIR.'/config.php');
  26. if($cfg->configCheck === false) {
  27. $cfg->configCheck = is_file($cfg->WWW_DIR.'/config.php');
  28. if($cfg->configCheck === true) {
  29. $cfg->configCheck = false;
  30. $cfg->error = true;
  31. } else {
  32. $cfg->configCheck = is_writable($cfg->WWW_DIR);
  33. if($cfg->configCheck === false) {
  34. $cfg->error = true;
  35. }
  36. }
  37. }
  38. $cfg->lockCheck = is_writable($cfg->INSTALL_DIR.'/install.lock');
  39. if ($cfg->lockCheck === false) {
  40. $cfg->lockCheck = is_file($cfg->INSTALL_DIR.'/install.lock');
  41. if($cfg->lockCheck === true) {
  42. $cfg->lockCheck = false;
  43. $cfg->error = true;
  44. } else {
  45. $cfg->lockCheck = is_writable($cfg->INSTALL_DIR);
  46. if($cfg->lockCheck === false) {
  47. $cfg->error = true;
  48. }
  49. }
  50. }
  51. $cfg->pearCheck = @include('System.php');
  52. $cfg->pearCheck = class_exists('System');
  53. if (!$cfg->pearCheck) { $cfg->error = true; }
  54. $cfg->schemaCheck = is_readable($cfg->DB_DIR.'/schema.sql');
  55. if ($cfg->schemaCheck === false) { $cfg->error = true; }
  56. // Dont set error = true for these as we only want to display a warning
  57. $cfg->phpCheck = (version_compare(PHP_VERSION, '5.2.0', '>=')) ? true : false;
  58. $cfg->timelimitCheck = (ini_get('max_execution_time') >= 60) ? true : false;
  59. $cfg->memlimitCheck = (ini_get('memory_limit') == -1 || ini_get('memory_limit') >= 256) ? true : false;
  60. $cfg->opensslCheck = !extension_loaded("opensssl");
  61. $cfg->timezoneCheck = (ini_get('date.timezone') != "");
  62. $cfg->rewriteCheck = (function_exists("apache_get_modules") && in_array("mod_rewrite", apache_get_modules())) ? true : false;
  63. //Load previous config.php
  64. if (file_exists($cfg->WWW_DIR.'/config.php') && is_readable($cfg->WWW_DIR.'/config.php')) {
  65. $tmpCfg = file_get_contents($cfg->WWW_DIR.'/config.php');
  66. $cfg->setConfig($tmpCfg);
  67. }
  68. if (!$cfg->error)
  69. $cfg->setSession();
  70. $page->smarty->assign('cfg', $cfg);
  71. $page->smarty->assign('page', $page);
  72. $page->content = $page->smarty->fetch('step1.tpl');
  73. $page->render();
  74. ?>