index.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. $TAB = "SERVER";
  3. // Main include
  4. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  5. // Check user
  6. if ($_SESSION["userContext"] !== "admin") {
  7. header("Location: /list/user");
  8. exit();
  9. }
  10. function end_html() {
  11. echo "</pre>\n</div>\n</main>\n";
  12. include $_SERVER["DOCUMENT_ROOT"] . "/templates/includes/app-footer.php";
  13. echo "</div>\n";
  14. include $_SERVER["DOCUMENT_ROOT"] . "/templates/includes/jump-to-top-link.php";
  15. echo "</body>\n</html>\n";
  16. }
  17. // CPU info
  18. if (isset($_GET["cpu"])) {
  19. $TAB = "CPU";
  20. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  21. exec(HESTIA_CMD . "v-list-sys-cpu-status", $output, $return_var);
  22. foreach ($output as $file) {
  23. echo $file . "\n";
  24. }
  25. end_html();
  26. exit();
  27. }
  28. // Memory info
  29. if (isset($_GET["mem"])) {
  30. $TAB = "MEMORY";
  31. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  32. exec(HESTIA_CMD . "v-list-sys-memory-status", $output, $return_var);
  33. foreach ($output as $file) {
  34. echo $file . "\n";
  35. }
  36. end_html();
  37. exit();
  38. }
  39. // Disk info
  40. if (isset($_GET["disk"])) {
  41. $TAB = "DISK";
  42. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  43. exec(HESTIA_CMD . "v-list-sys-disk-status", $output, $return_var);
  44. foreach ($output as $file) {
  45. echo $file . "\n";
  46. }
  47. end_html();
  48. exit();
  49. }
  50. // Network info
  51. if (isset($_GET["net"])) {
  52. $TAB = "NETWORK";
  53. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  54. exec(HESTIA_CMD . "v-list-sys-network-status", $output, $return_var);
  55. foreach ($output as $file) {
  56. echo $file . "\n";
  57. }
  58. end_html();
  59. exit();
  60. }
  61. // Web info
  62. if (isset($_GET["web"])) {
  63. $TAB = "WEB";
  64. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  65. exec(HESTIA_CMD . "v-list-sys-web-status", $output, $return_var);
  66. foreach ($output as $file) {
  67. $file = str_replace('border="0"', 'border="1"', $file);
  68. $file = str_replace('bgcolor="#ffffff"', "", $file);
  69. $file = str_replace('bgcolor="#000000"', 'bgcolor="#282828"', $file);
  70. echo $file . "\n";
  71. }
  72. end_html();
  73. exit();
  74. }
  75. // DNS info
  76. if (isset($_GET["dns"])) {
  77. $TAB = "DNS";
  78. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  79. exec(HESTIA_CMD . "v-list-sys-dns-status", $output, $return_var);
  80. foreach ($output as $file) {
  81. echo $file . "\n";
  82. }
  83. end_html();
  84. exit();
  85. }
  86. // Mail info
  87. if (isset($_GET["mail"])) {
  88. $TAB = "MAIL";
  89. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  90. exec(HESTIA_CMD . "v-list-sys-mail-status", $output, $return_var);
  91. if ($return_var == 0) {
  92. foreach ($output as $file) {
  93. echo $file . "\n";
  94. }
  95. }
  96. end_html();
  97. exit();
  98. }
  99. // DB info
  100. if (isset($_GET["db"])) {
  101. $TAB = "DB";
  102. include $_SERVER["DOCUMENT_ROOT"] . "/templates/pages/list_server_info.php";
  103. exec(HESTIA_CMD . "v-list-sys-db-status", $output, $return_var);
  104. if ($return_var == 0) {
  105. foreach ($output as $file) {
  106. echo $file . "\n";
  107. }
  108. }
  109. end_html();
  110. exit();
  111. }
  112. // Data
  113. exec(HESTIA_CMD . "v-list-sys-info json", $output, $return_var);
  114. $sys = json_decode(implode("", $output), true);
  115. unset($output);
  116. exec(HESTIA_CMD . "v-list-sys-php json", $output, $return_var);
  117. $php = json_decode(implode("", $output), true);
  118. unset($output);
  119. $phpfpm = [];
  120. foreach ($php as $version) {
  121. $phpfpm[] = "php" . $version . "-fpm";
  122. }
  123. exec(HESTIA_CMD . "v-list-sys-services json", $output, $return_var);
  124. $data = json_decode(implode("", $output), true);
  125. ksort($data);
  126. unset($output);
  127. // Render page
  128. render_page($user, $TAB, "list_services");
  129. // Back uri
  130. $_SESSION["back"] = $_SERVER["REQUEST_URI"];