check.php 6.5 KB

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