list_log_auth.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"]) && htmlentities($_GET["user"]) !== "admin") { ?>
  6. <a href="/list/log/?user=<?= htmlentities($_GET["user"]) ?>&token=<?= $_SESSION["token"] ?>" class="button button-secondary button-back js-button-back">
  7. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  8. </a>
  9. <?php } else { ?>
  10. <a href="/list/log/" class="button button-secondary button-back js-button-back">
  11. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  12. </a>
  13. <?php } ?>
  14. </div>
  15. <div class="toolbar-buttons">
  16. <a href="javascript:location.reload();" class="button button-secondary"><i class="fas fa-arrow-rotate-right icon-green"></i><?= _("Refresh") ?></a>
  17. <?php if ($_SESSION["userContext"] === "admin" && $_SESSION["look"] === "admin" && $_SESSION["POLICY_SYSTEM_PROTECTED_ADMIN"] === "yes") { ?>
  18. <!-- Hide delete buttons-->
  19. <?php } else { ?>
  20. <?php if ($_SESSION["userContext"] === "admin" || ($_SESSION["userContext"] === "user" && $_SESSION["POLICY_USER_DELETE_LOGS"] !== "no")) { ?>
  21. <a
  22. class="button button-secondary button-danger data-controls js-confirm-action"
  23. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"])) { ?>
  24. href="/delete/log/auth/?user=<?= htmlentities($_GET["user"]) ?>&token=<?= $_SESSION["token"] ?>"
  25. <?php } else { ?>
  26. href="/delete/log/auth/?token=<?= $_SESSION["token"] ?>"
  27. <?php } ?>
  28. data-confirm-title="<?= _("Delete") ?>"
  29. data-confirm-message="<?= _("Are you sure you want to delete the logs?") ?>"
  30. >
  31. <i class="fas fa-circle-xmark icon-red"></i><?= _("Delete") ?>
  32. </a>
  33. <?php } ?>
  34. <?php } ?>
  35. </div>
  36. </div>
  37. </div>
  38. <!-- End toolbar -->
  39. <div class="container">
  40. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Auth Log") ?></h1>
  41. <div class="units-table js-units-container">
  42. <div class="units-table-header">
  43. <div class="units-table-cell"><?= _("Status") ?></div>
  44. <div class="units-table-cell"><?= _("Date") ?></div>
  45. <div class="units-table-cell"><?= _("Time") ?></div>
  46. <div class="units-table-cell"><?= _("IP Address") ?></div>
  47. <div class="units-table-cell"><?= _("Browser") ?></div>
  48. </div>
  49. <!-- Begin log history entry loop -->
  50. <?php
  51. foreach ($data as $key => $value) {
  52. ++$i;
  53. if ($data[$key]['ACTION'] == 'login') {
  54. if ($data[$key]['ACTIVE'] === 'yes') {
  55. $action_icon = 'fa-right-to-bracket icon-maroon';
  56. } else {
  57. $action_icon = ' fa-right-to-bracket icon-dim';
  58. }
  59. }
  60. if ($data[$key]['STATUS'] == 'success') {
  61. $status_icon = 'fa-circle-check icon-green';
  62. $status_title = _('Success');
  63. } else {
  64. $status_icon = 'fa-circle-minus icon-red';
  65. $status_title = _('Failed');
  66. }
  67. ?>
  68. <div class="units-table-row animate__animated animate__fadeIn js-unit">
  69. <div class="units-table-cell u-text-center-desktop">
  70. <i class="fas <?= $status_icon ?> u-mr5" title="<?= $status_title ?>"></i>
  71. </div>
  72. <div class="units-table-cell units-table-heading-cell u-text-bold">
  73. <span class="u-hide-desktop"><?= _("Date") ?>:</span>
  74. <time class="u-text-no-wrap" datetime="<?= htmlspecialchars($data[$key]["DATE"]) ?>">
  75. <?= translate_date($data[$key]["DATE"]) ?>
  76. </time>
  77. </div>
  78. <div class="units-table-cell u-text-bold">
  79. <span class="u-hide-desktop"><?= _("Time") ?>:</span>
  80. <time datetime="<?= htmlspecialchars($data[$key]["TIME"]) ?>">
  81. <?= htmlspecialchars($data[$key]["TIME"]) ?>
  82. </time>
  83. </div>
  84. <div class="units-table-cell">
  85. <span class="u-hide-desktop u-text-bold"><?= _("IP Address") ?>:</span>
  86. <?= htmlspecialchars($data[$key]["IP"]) ?>
  87. </div>
  88. <div class="units-table-cell">
  89. <span class="u-hide-desktop u-text-bold"><?= _("Browser") ?>:</span>
  90. <?= htmlspecialchars($data[$key]["USER_AGENT"]) ?>
  91. </div>
  92. </div>
  93. <?php } ?>
  94. </div>
  95. </div>
  96. <footer class="app-footer">
  97. <div class="container app-footer-inner">
  98. <p>
  99. <?php printf(ngettext("%d log record", "%d log records", $i), $i); ?>
  100. </p>
  101. </div>
  102. </footer>