check.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. $USER = new User("registration_callback");
  7. qualifyUser("admin", true);
  8. }
  9. function check($extension) {
  10. if (extension_loaded($extension)) :
  11. echo '<div class="col-lg-3">';
  12. echo '<div class="panel panel-success">';
  13. echo '<div class="panel-heading">';
  14. echo '<h3 class="panel-title">'. $extension . '</h3>';
  15. echo '</div>';
  16. echo '<div style="color: gray" class="panel-body">';
  17. echo $extension . ' is installed!';
  18. echo '</div></div></div>';
  19. else :
  20. echo '<div class="col-lg-3">';
  21. echo '<div class="panel panel-danger">';
  22. echo '<div class="panel-heading">';
  23. echo '<h3 class="panel-title">'. $extension . '</h3>';
  24. echo '</div>';
  25. echo '<div style="color: gray" class="panel-body">';
  26. echo $extension . ' is NOT loaded! Please install it before proceeding';
  27. if($extension == "PDO_SQLITE") :
  28. 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';
  29. endif;
  30. echo '</div></div></div>';
  31. endif;
  32. }
  33. function checkFunction($function) {
  34. if (function_exists($function)) :
  35. echo '<div class="col-lg-3">';
  36. echo '<div class="panel panel-success">';
  37. echo '<div class="panel-heading">';
  38. echo '<h3 class="panel-title">'. $function . '</h3>';
  39. echo '</div>';
  40. echo '<div style="color: gray" class="panel-body">';
  41. echo $function . ' is installed!';
  42. if($function == "MAIL") :
  43. echo '<br/> **Please make sure you can send email prior to installing as this is needed for password resets**';
  44. endif;
  45. echo '</div></div></div>';
  46. else :
  47. echo '<div class="col-lg-3">';
  48. echo '<div class="panel panel-danger">';
  49. echo '<div class="panel-heading">';
  50. echo '<h3 class="panel-title">'. $function . '</h3>';
  51. echo '</div>';
  52. echo '<div style="color: gray" class="panel-body">';
  53. echo $function . ' is NOT loaded! Please install it before proceeding';
  54. if($function == "MAIL") :
  55. 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]';
  56. endif;
  57. echo '</div></div></div>';
  58. endif;
  59. }
  60. function getFilePermission($file) {
  61. if (file_exists($file)) :
  62. $length = strlen(decoct(fileperms($file)))-3;
  63. if($file{strlen($file)-1}=='/') :
  64. $name = "Folder";
  65. else :
  66. $name = "File";
  67. endif;
  68. if (is_writable($file)) :
  69. echo '<div class="col-lg-6">';
  70. echo '<div class="panel panel-success">';
  71. echo '<div class="panel-heading">';
  72. echo '<h3 class="panel-title">'. $file . '<permissions style="float: right;">Permissions: ' . substr(decoct(fileperms($file)),$length) . '</permissions></h3>';
  73. echo '</div>';
  74. echo '<div style="color: gray" class="panel-body">';
  75. echo $file . ' is writable!';
  76. echo '</div></div></div>';
  77. else :
  78. echo '<div class="col-lg-6">';
  79. echo '<div class="panel panel-danger">';
  80. echo '<div class="panel-heading">';
  81. echo '<h3 class="panel-title">'. $file . '</h3>';
  82. echo '</div>';
  83. echo '<div style="color: gray" class="panel-body">';
  84. echo $file . ' is NOT writable! Please change the permissions to make it writtable by the PHP User.';
  85. echo '</div></div></div>';
  86. endif;
  87. endif;
  88. }
  89. ?>
  90. <!DOCTYPE html>
  91. <html lang="en" class="no-js">
  92. <head>
  93. <meta charset="UTF-8">
  94. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  95. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  96. <meta name="msapplication-tap-highlight" content="no" />
  97. <title>Requirement Checker</title>
  98. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  99. <link rel="stylesheet" href="css/style.css">
  100. <script src="bower_components/jquery/dist/jquery.min.js"></script>
  101. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  102. <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  103. </head>
  104. <body id="body-check" class="gray-bg" style="padding: 0;">
  105. <div id="main-wrapper" class="main-wrapper">
  106. <!--Content-->
  107. <div id="content" style="margin:0 20px; overflow:hidden">
  108. <h1><center>Check Requirements & Permissions</center></h1>
  109. <div class="row">
  110. <?php
  111. check("PDO_SQLITE");
  112. check("PDO");
  113. check("SQLITE3");
  114. check("Zip");
  115. check("cURL");
  116. check("openssl");
  117. check("session");
  118. check("simplexml");
  119. check("json");
  120. checkFunction("hash");
  121. checkFunction("fopen");
  122. checkFunction("fsockopen");
  123. checkFunction("ob_start");
  124. checkFunction("ob_get_contents");
  125. checkFunction("ob_end_flush");
  126. checkFunction("fwrite");
  127. checkFunction("fclose");
  128. checkFunction("readfile");
  129. ?>
  130. </div>
  131. <div class="row">
  132. <?php
  133. @getFilePermission($db);
  134. @getFilePermission($folder);
  135. getFilePermission((__DIR__));
  136. getFilePermission(dirname(__DIR__));
  137. echo '</div>';
  138. //PHPINFO
  139. echo '<div class="panel panel-success">';
  140. echo '<div class="panel-heading">';
  141. echo '<h3 class="panel-title">PHP Info</h3>';
  142. echo '</div>';
  143. echo '<div style="color: black" class="panel-body">';
  144. echo phpinfo();
  145. echo '</div></div>';
  146. ?>
  147. </div>
  148. </div>
  149. <script>
  150. $("body").niceScroll({
  151. railpadding: {top:0,right:10,left:0,bottom:0},
  152. scrollspeed: 30,
  153. mousescrollstep: 60
  154. });
  155. </script>
  156. </body>
  157. </html>