list_log_auth.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/?<?= tohtml(http_build_query(["user" => $_GET["user"], "token" => $_SESSION["token"]])) ?>" class="button button-secondary button-back js-button-back">
  7. <i class="fas fa-arrow-left icon-blue"></i><?= tohtml( _("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><?= tohtml( _("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><?= tohtml( _("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/?<?= tohtml(http_build_query(["user" => $_GET["user"], "token" => $_SESSION["token"]])) ?>"
  25. <?php } else { ?>
  26. href="/delete/log/auth/?<?= tohtml(http_build_query(["token" => $_SESSION["token"]])) ?>"
  27. <?php } ?>
  28. data-confirm-title="<?= tohtml( _("Delete")) ?>"
  29. data-confirm-message="<?= tohtml( _("Are you sure you want to delete the logs?")) ?>"
  30. >
  31. <i class="fas fa-circle-xmark icon-red"></i><?= tohtml( _("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"><?= tohtml( _("Auth Log")) ?></h1>
  41. <div class="units-table js-units-container">
  42. <div class="units-table-header">
  43. <div class="units-table-cell"><?= tohtml( _("Status")) ?></div>
  44. <div class="units-table-cell"><?= tohtml( _("Date")) ?></div>
  45. <div class="units-table-cell"><?= tohtml( _("Time")) ?></div>
  46. <div class="units-table-cell"><?= tohtml( _("IP Address")) ?></div>
  47. <div class="units-table-cell"><?= tohtml( _("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 js-unit">
  69. <div class="units-table-cell u-text-center-desktop">
  70. <i class="fas <?= tohtml($status_icon) ?> u-mr5" title="<?= tohtml($status_title) ?>"></i>
  71. </div>
  72. <div class="units-table-cell units-table-heading-cell u-text-bold">
  73. <span class="u-hide-desktop"><?= tohtml( _("Date")) ?>:</span>
  74. <time class="u-text-no-wrap" datetime="<?= tohtml($data[$key]["DATE"]) ?>">
  75. <?= tohtml(translate_date($data[$key]["DATE"])) ?>
  76. </time>
  77. </div>
  78. <div class="units-table-cell u-text-bold">
  79. <span class="u-hide-desktop"><?= tohtml( _("Time")) ?>:</span>
  80. <time datetime="<?= tohtml($data[$key]["TIME"]) ?>">
  81. <?= tohtml($data[$key]["TIME"]) ?>
  82. </time>
  83. </div>
  84. <div class="units-table-cell">
  85. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("IP Address")) ?>:</span>
  86. <?= tohtml($data[$key]["IP"]) ?>
  87. </div>
  88. <div class="units-table-cell">
  89. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("Browser")) ?>:</span>
  90. <?= tohtml($data[$key]["USER_AGENT"]) ?>
  91. </div>
  92. </div>
  93. <?php } ?>
  94. </div>
  95. <div class="units-table-footer">
  96. <p>
  97. <?php printf(ngettext("%d log record", "%d log records", $i), $i); ?>
  98. </p>
  99. </div>
  100. </div>