check.php 5.5 KB

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