index.php 868 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. $TAB = "RRD";
  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. // Data
  11. exec(HESTIA_CMD . "v-list-sys-rrd json", $output, $return_var);
  12. $data = json_decode(implode("", $output), true);
  13. unset($output);
  14. /*
  15. if (empty($_GET["period"])) {
  16. $period = "day";
  17. } elseif (!in_array($_GET["period"], ["day", "week", "month", "year"])) {
  18. $period = "day";
  19. } else {
  20. $period = $_GET["period"];
  21. }
  22. */
  23. if (empty($_GET["period"])) {
  24. $period = "daily";
  25. } elseif (
  26. !in_array($_GET["period"], [
  27. "daily",
  28. "weekly",
  29. "monthly",
  30. "yearly",
  31. "biennially",
  32. "triennially",
  33. ])
  34. ) {
  35. $period = "daily";
  36. } else {
  37. $period = $_GET["period"];
  38. }
  39. // Render page
  40. render_page($user, $TAB, "list_rrd");
  41. // Back uri
  42. $_SESSION["back"] = $_SERVER["REQUEST_URI"];