check.php 4.3 KB

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