check.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. if (file_exists('config/config.php')) {
  3. require_once("user.php");
  4. $db = DATABASE_LOCATION.'users.db';
  5. $folder = USER_HOME;
  6. }
  7. function check($extension) {
  8. if (extension_loaded($extension)) :
  9. echo '<div class="panel panel-success">';
  10. echo '<div class="panel-heading">';
  11. echo '<h3 class="panel-title">'. $extension . '</h3>';
  12. echo '</div>';
  13. echo '<div style="color: gray" class="panel-body">';
  14. echo $extension . ' is loaded and ready to rock-n-roll! Good 2 Go!';
  15. echo '</div></div>';
  16. else :
  17. echo '<div class="panel panel-danger">';
  18. echo '<div class="panel-heading">';
  19. echo '<h3 class="panel-title">'. $extension . '</h3>';
  20. echo '</div>';
  21. echo '<div style="color: gray" class="panel-body">';
  22. echo $extension . ' is NOT loaded! Please install it before proceeding';
  23. if($extension == "PDO_SQLITE") :
  24. echo '<br/> If you are on Windows, please uncomment this line in php.ini: ;extension=php_pdo_sqlite.dll<br/>If you are on Ununtu, please install php5.3-sqlite or php7-sqlite depending on your version of PHP, then restart PHP service';
  25. endif;
  26. echo '</div></div>';
  27. endif;
  28. }
  29. function checkFunction($function) {
  30. if (function_exists($function)) :
  31. echo '<div class="panel panel-success">';
  32. echo '<div class="panel-heading">';
  33. echo '<h3 class="panel-title">'. $function . '</h3>';
  34. echo '</div>';
  35. echo '<div style="color: gray" class="panel-body">';
  36. echo $function . ' is loaded and ready to rock-n-roll! Good 2 Go!';
  37. if($function == "MAIL") :
  38. echo '<br/> **Please make sure you can send email prior to installing as this is needed for password resets**';
  39. endif;
  40. echo '</div></div>';
  41. else :
  42. echo '<div class="panel panel-danger">';
  43. echo '<div class="panel-heading">';
  44. echo '<h3 class="panel-title">'. $function . '</h3>';
  45. echo '</div>';
  46. echo '<div style="color: gray" class="panel-body">';
  47. echo $function . ' is NOT loaded! Please install it before proceeding';
  48. if($function == "MAIL") :
  49. echo '<br/> **If you do not want to use password resets, this is okay not being installed** EDIT LINE 31 on user.php to "false" [const use_mail = false]';
  50. endif;
  51. echo '</div></div>';
  52. endif;
  53. }
  54. function getFilePermission($file) {
  55. if (file_exists($file)) :
  56. $length = strlen(decoct(fileperms($file)))-3;
  57. if($file{strlen($file)-1}=='/') :
  58. $name = "Folder";
  59. else :
  60. $name = "File";
  61. endif;
  62. if (is_writable($file)) :
  63. echo '<div class="panel panel-success">';
  64. echo '<div class="panel-heading">';
  65. echo '<h3 class="panel-title">'. $file . '<permissions style="float: right;">Permissions: ' . substr(decoct(fileperms($file)),$length) . '</permissions></h3>';
  66. echo '</div>';
  67. echo '<div style="color: gray" class="panel-body">';
  68. echo $file . ' is writable and ready to rock-n-roll! Good 2 Go!';
  69. echo '</div></div>';
  70. else :
  71. echo '<div class="panel panel-danger">';
  72. echo '<div class="panel-heading">';
  73. echo '<h3 class="panel-title">'. $file . '</h3>';
  74. echo '</div>';
  75. echo '<div style="color: gray" class="panel-body">';
  76. echo $file . ' is NOT writable! Please change the permissions to make it writtable by the PHP User.';
  77. echo '</div></div>';
  78. endif;
  79. endif;
  80. }
  81. ?>
  82. <!DOCTYPE html>
  83. <html lang="en" class="no-js">
  84. <head>
  85. <meta charset="UTF-8">
  86. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  87. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  88. <meta name="msapplication-tap-highlight" content="no" />
  89. <title>Requirement Checker</title>
  90. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  91. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  92. <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css">
  93. <link rel="stylesheet" href="bower_components/metisMenu/dist/metisMenu.min.css">
  94. <link rel="stylesheet" href="bower_components/Waves/dist/waves.min.css">
  95. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  96. <link rel="stylesheet" href="js/selects/cs-select.css">
  97. <link rel="stylesheet" href="js/selects/cs-skin-elastic.css">
  98. <link rel="stylesheet" href="css/style.css">
  99. </head>
  100. <body class="gray-bg" style="padding: 0;">
  101. <div id="main-wrapper" class="main-wrapper">
  102. <!--Content-->
  103. <div id="content" style="margin:0 20px; overflow:hidden">
  104. <h1><center>Check Requirements & Permissions</center></h1>
  105. <?php
  106. check("PDO_SQLITE");
  107. check("PDO");
  108. check("SQLITE3");
  109. check("Zip");
  110. check("cURL");
  111. check("openssl");
  112. check("session");
  113. check("simplexml");
  114. //checkFunction("MAIL");
  115. checkFunction("fopen");
  116. @getFilePermission($db);
  117. @getFilePermission($folder);
  118. getFilePermission((__DIR__));
  119. getFilePermission(dirname(__DIR__));
  120. //PHPINFO
  121. echo '<div class="panel panel-success">';
  122. echo '<div class="panel-heading">';
  123. echo '<h3 class="panel-title">PHP Info</h3>';
  124. echo '</div>';
  125. echo '<div style="color: gray" class="panel-body">';
  126. echo phpinfo();
  127. echo '</div></div>';
  128. ?>
  129. </div>
  130. </div>
  131. </body>
  132. </html>