list_log.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <?php if ($_SESSION["userContext"] === "admin" && $_SESSION["look"] === "admin") { ?>
  6. <a href="/list/user/" class="button button-secondary button-back js-button-back">
  7. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  8. </a>
  9. <?php } elseif ($_SESSION["userContext"] === "admin" && htmlentities($_GET["user"]) === "system") { ?>
  10. <a href="/list/server/" class="button button-secondary button-back js-button-back">
  11. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  12. </a>
  13. <?php } else { ?>
  14. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"]) && $_GET["user"] !== "admin") { ?>
  15. <a href="/edit/user/?user=<?= htmlentities($_GET["user"]) ?>&token=<?= $_SESSION["token"] ?>" class="button button-secondary button-back js-button-back">
  16. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  17. </a>
  18. <?php } else { ?>
  19. <a href="/edit/user/?token=<?= $_SESSION["token"] ?>" class="button button-secondary button-back js-button-back">
  20. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  21. </a>
  22. <?php } ?>
  23. <?php } ?>
  24. <?php if ($_SESSION['DEMO_MODE'] != "yes"){
  25. if (($_SESSION['userContext'] === 'admin') && (htmlentities($_GET['user']) !== 'admin')) { ?>
  26. <?php if (($_SESSION['userContext'] === 'admin') && ($_GET['user'] != '') && (htmlentities($_GET['user']) !== 'admin')) { ?>
  27. <?php if (htmlentities($_GET['user']) !== 'system') { ?>
  28. <a href="/list/log/auth/?user=<?= htmlentities($_GET['user']); ?>&token=<?= $_SESSION['token'] ?>" class="button button-secondary button-back js-button-back" title="<?= _("Login History") ?>">
  29. <i class="fas fa-binoculars icon-green"></i><?= _("Login History") ?>
  30. </a>
  31. <?php } ?>
  32. <?php } else { ?>
  33. <a href="/list/log/auth/" class="button button-secondary button-back js-button-back" title="<?= _("Login History") ?>">
  34. <i class="fas fa-binoculars icon-green"></i><?= _("Login History") ?>
  35. </a>
  36. <?php } ?>
  37. <?php } ?>
  38. <?php if ($_SESSION["userContext"] === "user") { ?>
  39. <a href="/list/log/auth/" class="button button-secondary button-back js-button-back" title="<?= _("Login History") ?>">
  40. <i class="fas fa-binoculars icon-green"></i><?= _("Login History") ?>
  41. </a>
  42. <?php }
  43. } ?>
  44. </div>
  45. <div class="toolbar-buttons">
  46. <a href="javascript:location.reload();" class="button button-secondary"><i class="fas fa-arrow-rotate-right icon-green"></i><?= _("Refresh") ?></a>
  47. <?php if ($_SESSION["userContext"] === "admin" && $_SESSION["look"] === "admin" && $_SESSION["POLICY_SYSTEM_PROTECTED_ADMIN"] === "yes") { ?>
  48. <!-- Hide delete buttons-->
  49. <?php } else { ?>
  50. <?php if ($_SESSION["userContext"] === "admin" || ($_SESSION["userContext"] === "user" && $_SESSION["POLICY_USER_DELETE_LOGS"] !== "no")) { ?>
  51. <a
  52. class="button button-secondary button-danger data-controls js-confirm-action"
  53. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"])) { ?>
  54. href="/delete/log/?user=<?= htmlentities($_GET["user"]) ?>&token=<?= $_SESSION["token"] ?>"
  55. <?php } else { ?>
  56. href="/delete/log/?token=<?= $_SESSION["token"] ?>"
  57. <?php } ?>
  58. data-confirm-title="<?= _("Delete") ?>"
  59. data-confirm-message="<?= _("Are you sure you want to delete the logs?") ?>"
  60. >
  61. <i class="fas fa-circle-xmark icon-red"></i><?= _("Delete") ?>
  62. </a>
  63. <?php } ?>
  64. <?php } ?>
  65. </div>
  66. </div>
  67. </div>
  68. <!-- End toolbar -->
  69. <div class="container">
  70. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Logs") ?></h1>
  71. <div class="units-table js-units-container">
  72. <div class="units-table-header">
  73. <div class="units-table-cell"></div>
  74. <div class="units-table-cell"><?= _("Date") ?></div>
  75. <div class="units-table-cell"><?= _("Time") ?></div>
  76. <div class="units-table-cell"><?= _("Category") ?></div>
  77. <div class="units-table-cell"><?= _("Message") ?></div>
  78. </div>
  79. <!-- Begin log history entry loop -->
  80. <?php
  81. foreach ($data as $key => $value) {
  82. ++$i;
  83. if ($data[$key]['LEVEL'] === 'Info') {
  84. $level_icon = 'fa-info-circle icon-blue';
  85. $level_title = _('Information');
  86. }
  87. if ($data[$key]['LEVEL'] === 'Warning') {
  88. $level_icon = 'fa-triangle-exclamation icon-orange';
  89. $level_title = _('Warning');
  90. }
  91. if ($data[$key]['LEVEL'] === 'Error') {
  92. $level_icon = 'fa-circle-xmark icon-red';
  93. $level_title = _('Error');
  94. }
  95. ?>
  96. <div class="units-table-row animate__animated animate__fadeIn js-unit">
  97. <div class="units-table-cell u-text-center-desktop">
  98. <i class="fas <?= $level_icon ?>" title="<?= $level_title ?>"></i>
  99. </div>
  100. <div class="units-table-cell units-table-heading-cell u-text-bold">
  101. <span class="u-hide-desktop"><?= _("Date") ?>:</span>
  102. <time datetime="<?= htmlspecialchars($data[$key]["DATE"]) ?>">
  103. <?= translate_date($data[$key]["DATE"]) ?>
  104. </time>
  105. </div>
  106. <div class="units-table-cell u-text-bold">
  107. <span class="u-hide-desktop"><?= _("Time") ?>:</span>
  108. <time datetime="<?= htmlspecialchars($data[$key]["TIME"]) ?>">
  109. <?= htmlspecialchars($data[$key]["TIME"]) ?>
  110. </time>
  111. </div>
  112. <div class="units-table-cell u-text-bold">
  113. <span class="u-hide-desktop"><?= _("Category") ?>:</span>
  114. <?= htmlspecialchars($data[$key]["CATEGORY"]) ?>
  115. </div>
  116. <div class="units-table-cell">
  117. <span class="u-hide-desktop u-text-bold"><?= _("Message") ?>:</span>
  118. <?= htmlspecialchars($data[$key]["MESSAGE"], ENT_QUOTES) ?>
  119. </div>
  120. </div>
  121. <?php } ?>
  122. </div>
  123. </div>
  124. <footer class="app-footer">
  125. <div class="container app-footer-inner">
  126. <p>
  127. <?php printf(ngettext("%d log record", "%d log records", $i), $i); ?>
  128. </p>
  129. </div>
  130. </footer>