check.php 6.1 KB

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