check.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. function check($extension) {
  3. if (extension_loaded($extension)) :
  4. echo '<div class="panel panel-success">';
  5. echo '<div class="panel-heading">';
  6. echo '<h3 class="panel-title">'. $extension . '</h3>';
  7. echo '</div>';
  8. echo '<div style="color: gray" class="panel-body">';
  9. echo $extension . ' is loaded and ready to rock-n-roll! Good 2 Go!';
  10. echo '</div></div>';
  11. else :
  12. echo '<div class="panel panel-danger">';
  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 NOT loaded! Please install it before proceeding';
  18. if($extension == "PDO_SQLITE") :
  19. echo '<br/> If you are on Windows, please uncomment this line in php.ini: ;extension=php_pdo_sqlite.dll';
  20. endif;
  21. echo '</div></div>';
  22. endif;
  23. }
  24. function getFilePermission($file) {
  25. if (file_exists($file)) :
  26. $length = strlen(decoct(fileperms($file)))-3;
  27. if($file{strlen($file)-1}=='/') :
  28. $name = "Folder";
  29. else :
  30. $name = "File";
  31. endif;
  32. if (is_writable($file)) :
  33. echo '<div class="panel panel-success">';
  34. echo '<div class="panel-heading">';
  35. echo '<h3 class="panel-title">'. $file . '<permissions style="float: right;">Permissions: ' . substr(decoct(fileperms($file)),$length) . '</permissions></h3>';
  36. echo '</div>';
  37. echo '<div style="color: gray" class="panel-body">';
  38. echo $file . ' is writable and ready to rock-n-roll! Good 2 Go!';
  39. echo '</div></div>';
  40. else :
  41. echo '<div class="panel panel-danger">';
  42. echo '<div class="panel-heading">';
  43. echo '<h3 class="panel-title">'. $file . '</h3>';
  44. echo '</div>';
  45. echo '<div style="color: gray" class="panel-body">';
  46. echo $file . ' is NOT writable! Please change the permissions to make it writtable by the PHP User.';
  47. echo '</div></div>';
  48. endif;
  49. endif;
  50. }
  51. $db = dirname(__DIR__, 1) . "/users.db";
  52. $folder = dirname(__DIR__, 1) . "/users/";
  53. ?>
  54. <!DOCTYPE html>
  55. <html lang="en" class="no-js">
  56. <head>
  57. <meta charset="UTF-8">
  58. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  59. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  60. <meta name="msapplication-tap-highlight" content="no" />
  61. <title>Requirement Checker</title>
  62. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  63. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  64. <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css">
  65. <link rel="stylesheet" href="bower_components/metisMenu/dist/metisMenu.min.css">
  66. <link rel="stylesheet" href="bower_components/Waves/dist/waves.min.css">
  67. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  68. <link rel="stylesheet" href="js/selects/cs-select.css">
  69. <link rel="stylesheet" href="js/selects/cs-skin-elastic.css">
  70. <link rel="stylesheet" href="css/style.css">
  71. <link rel="icon" href="img/favicon.ico" type="image/x-icon" />
  72. <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
  73. </head>
  74. <body class="gray-bg" style="padding: 20px;">
  75. <div id="main-wrapper" class="main-wrapper">
  76. <!--Content-->
  77. <div id="content" style="margin:0 20px; overflow:hidden">
  78. <h1><center>Check Persmissions</center></h1>
  79. <?php
  80. check("PDO_SQLITE");
  81. check("PDO");
  82. getFilePermission($db);
  83. getFilePermission($folder);
  84. getFilePermission((__DIR__));
  85. getFilePermission(dirname(__DIR__, 1));
  86. ?>
  87. </div>
  88. </div>
  89. </body>
  90. </html>