list_key.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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"] !== $_SESSION['ROOT_USER']) { ?>
  6. <a href="/edit/user/?<?= tohtml(http_build_query(["user" => $_SESSION["look"], "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="/edit/user/?<?= tohtml(http_build_query(["user" => $_SESSION["user"], "token" => $_SESSION["token"]])) ?>" 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. <?php if ($_SESSION["userContext"] === "admin" && isset($_GET["user"]) && $_GET["user"] !== "admin") { ?>
  15. <a href="/add/key/?<?= tohtml(http_build_query(["user" => $_GET["user"]])) ?>" class="button button-secondary js-button-create">
  16. <i class="fas fa-circle-plus icon-green"></i><?= tohtml( _("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><?= tohtml( _("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"><?= tohtml( _("SSH Keys")) ?></h1>
  29. <div class="units-table js-units-container">
  30. <div class="units-table-header">
  31. <div class="units-table-cell"><?= tohtml( _("SSH ID")) ?></div>
  32. <div class="units-table-cell"></div>
  33. <div class="units-table-cell"><?= tohtml( _("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"><?= tohtml( _("SSH ID")) ?>:</span>
  44. <span class="u-text-break">
  45. <?= tohtml($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/?<?= tohtml(http_build_query(["user" => $_GET["user"], "key" => $key, "token" => $_SESSION["token"]])) ?>"
  55. <?php } else { ?>
  56. href="/delete/key/?<?= tohtml(http_build_query(["key" => $key, "token" => $_SESSION["token"]])) ?>"
  57. <?php } ?>
  58. title="<?= tohtml( _("Delete")) ?>"
  59. data-confirm-title="<?= tohtml( _("Delete")) ?>"
  60. data-confirm-message="<?= tohtml(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"><?= tohtml( _("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"><?= tohtml( _("SSH Key")) ?>:</span>
  70. <span class="u-text-break">
  71. <?= tohtml($data[$key]["KEY"]) ?>
  72. </span>
  73. </div>
  74. </div>
  75. <?php } ?>
  76. </div>
  77. <div class="units-table-footer">
  78. <p>
  79. <?php printf(ngettext("%d SSH key", "%d SSH keys", $i), $i); ?>
  80. </p>
  81. </div>
  82. </div>