edit_firewall.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!-- Begin toolbar -->
  2. <div class="l-sort">
  3. <div class="l-sort__inner">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="button button-secondary" id="btn-back" href="/list/firewall/"><i class="fas fa-arrow-left status-icon blue"></i><?=_('Back');?></a>
  6. </div>
  7. <div class="l-unit-toolbar__buttonstrip">
  8. <a href="#" class="button" data-action="submit" data-id="vstobjects"><i class="fas fa-floppy-disk status-icon purple"></i><?=_('Save');?></a>
  9. </div>
  10. </div>
  11. </div>
  12. <!-- End toolbar -->
  13. <div class="l-center animate__animated animate__fadeIn">
  14. <form id="vstobjects" name="v_edit_firewall" method="post" class="<?=$v_status?>">
  15. <input type="hidden" name="token" value="<?=$_SESSION['token']?>">
  16. <input type="hidden" name="save" value="save">
  17. <div class="form-container">
  18. <h1 class="form-title"><?=_('Editing Firewall Rule');?></h1>
  19. <?php show_alert_message($_SESSION);?>
  20. <div class="u-mb10">
  21. <label for="v_action" class="form-label"><?=_('Action') ?></label>
  22. <select class="form-select" name="v_action" id="v_action">
  23. <option value="DROP" <?php if ((!empty($v_action)) && ( $v_action == "DROP" )) echo 'selected'?>><?=_('DROP');?></option>
  24. <option value="ACCEPT" <?php if ((!empty($v_action)) && ( $v_action == "ACCEPT" )) echo 'selected'?>><?=_('ACCEPT');?></option>
  25. </select>
  26. </div>
  27. <div class="u-mb10">
  28. <label for="v_protocol" class="form-label"><?=_('Protocol') ?></label>
  29. <select class="form-select" name="v_protocol" id="v_protocol">
  30. <option value="TCP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "TCP" )) echo 'selected'?>><?=_('TCP');?></option>
  31. <option value="UDP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "UDP" )) echo 'selected'?>><?=_('UDP');?></option>
  32. <option value="ICMP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "ICMP" )) echo 'selected'?>><?=_('ICMP');?></option>
  33. </select>
  34. </div>
  35. <div class="u-mb10">
  36. <label for="v_port" class="form-label">
  37. <?=_('Port');?> <span class="optional">(<?=_('Ranges and Lists are acceptable');?>)</span>
  38. </label>
  39. <input type="text" class="form-control" name="v_port" id="v_port" value="<?=htmlentities(trim($v_port, "'"))?>" placeholder="<?=_('All ports: 0, Range: 80-82, List: 80,443,8080,8443');?>">
  40. </div>
  41. <div class="u-mb10">
  42. <label for="v_ip" class="form-label">
  43. <?=_('IP address / IPset');?> <span class="optional">(<?=_('CIDR format is supported');?>)</span>
  44. </label>
  45. <div class="u-pos-relative">
  46. <select class="form-select" tabindex="-1" id="quickips_list" onchange="this.nextElementSibling.value=this.value">
  47. <option value="">&nbsp;</option>
  48. </select>
  49. <input type="text" class="form-control list-editor" name="v_ip" id="v_ip" value="<?=htmlentities(trim($v_ip, "'"))?>">
  50. </div>
  51. </div>
  52. <div class="u-mb10">
  53. <label for="v_comment" class="form-label">
  54. <?=_('Comment');?> <span class="optional">(<?=_('optional');?>)</span>
  55. </label>
  56. <input type="text" class="form-control" name="v_comment" id="v_comment" maxlength="255" value="<?=htmlentities(trim($v_comment, "'"))?>">
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. <script>
  62. var ipLists = JSON.parse('<?=$ipset_lists_json?>');
  63. ipLists.sort(function (a, b) {
  64. return a.name > b.name;
  65. });
  66. $(function () {
  67. var targetElement = document.getElementById('quickips_list');
  68. var newEl = document.createElement("option");
  69. newEl.text = "IP address lists:";
  70. newEl.disabled = true;
  71. targetElement.appendChild(newEl);
  72. ipLists.forEach(iplist => {
  73. var newEl = document.createElement("option");
  74. newEl.text = iplist.name;
  75. newEl.value = "ipset:" + iplist.name;
  76. targetElement.appendChild(newEl);
  77. });
  78. });
  79. </script>