list_key.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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'] !== '' && $_GET["user"] !== "admin") { ?>
  6. <a href="/edit/user/?user=<?= htmlentities($_SESSION["look"]) ?>&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="/edit/user/?user=<?= htmlentities($_SESSION["user"]) ?>&token=<?= $_SESSION["token"] ?>" 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. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"]) && $_GET["user"] !== "admin") { ?>
  15. <a href="/add/key/?user=<?= htmlentities($_GET["user"]) ?>" class="button button-secondary js-button-create">
  16. <i class="fas fa-circle-plus icon-green"></i><?= _("Add SSH Key") ?>
  17. </a>
  18. <?php } else { ?>
  19. <a href="/add/key/" class="button button-secondary js-button-create">
  20. <i class="fas fa-circle-plus icon-green"></i><?= _("Add SSH Key") ?>
  21. </a>
  22. <?php } ?>
  23. </div>
  24. </div>
  25. </div>
  26. <!-- End toolbar -->
  27. <div class="container">
  28. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("SSH Keys") ?></h1>
  29. <div class="units-table js-units-container">
  30. <div class="units-table-header">
  31. <div class="units-table-cell"><?= _("SSH ID") ?></div>
  32. <div class="units-table-cell"></div>
  33. <div class="units-table-cell"><?= _("SSH Key") ?></div>
  34. </div>
  35. <!-- Begin SSH key list item loop -->
  36. <?php
  37. $i = 0;
  38. foreach ($data as $key => $value) {
  39. ++$i;
  40. ?>
  41. <div class="units-table-row js-unit" style="<?php if ($data[$key]['ID'] === 'filemanager.ssh.key') { echo 'display: none;'; } ?>">
  42. <div class="units-table-cell units-table-heading-cell u-text-bold">
  43. <span class="u-hide-desktop"><?= _("SSH ID") ?>:</span>
  44. <span class="u-text-break">
  45. <?= htmlspecialchars($data[$key]["ID"]) ?>
  46. </span>
  47. </div>
  48. <div class="units-table-cell">
  49. <ul class="units-table-row-actions">
  50. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  51. <a
  52. class="units-table-row-action-link data-controls js-confirm-action"
  53. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"]) && $_GET["user"] !== "admin") { ?>
  54. href="/delete/key/?user=<?= htmlentities($_GET["user"]) ?>&key=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  55. <?php } else { ?>
  56. href="/delete/key/?key=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  57. <?php } ?>
  58. title="<?= _("Delete") ?>"
  59. data-confirm-title="<?= _("Delete") ?>"
  60. data-confirm-message="<?= sprintf(_("Are you sure you want to delete SSH key %s?"), $key) ?>"
  61. >
  62. <i class="fas fa-trash icon-red"></i>
  63. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  64. </a>
  65. </li>
  66. </ul>
  67. </div>
  68. <div class="units-table-cell u-text-bold">
  69. <span class="u-hide-desktop"><?= _("SSH Key") ?>:</span>
  70. <span class="u-text-break">
  71. <?= htmlspecialchars($data[$key]["KEY"], ENT_QUOTES) ?>
  72. </span>
  73. </div>
  74. </div>
  75. <?php } ?>
  76. </div>
  77. </div>
  78. <footer class="app-footer">
  79. <div class="container app-footer-inner">
  80. <p>
  81. <?php printf(ngettext("%d SSH key", "%d SSH keys", $i), $i); ?>
  82. </p>
  83. </div>
  84. </footer>