edit_firewall.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!-- Begin toolbar -->
  2. <div class="l-center edit">
  3. <div class="l-sort clearfix">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="ui-button cancel" dir="ltr" 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 float-right">
  8. <a href="#" class="ui-button" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i><?=_('Save');?></a>
  9. </div>
  10. </div>
  11. </div>
  12. <!-- End toolbar -->
  13. <div class="l-separator"></div>
  14. <div class="l-center animated fadeIn">
  15. <form id="vstobjects" name="v_edit_firewall" method="post" class="<?=$v_status?>">
  16. <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
  17. <input type="hidden" name="save" value="save" />
  18. <table class='data'>
  19. <tr class="data-add">
  20. <td class="data-dotted">
  21. <table class="data-col1">
  22. <tr>
  23. <td>
  24. </td>
  25. </tr>
  26. </table>
  27. </td>
  28. <td class="data-dotted">
  29. <table class="data-col2" width="600px">
  30. <tr>
  31. <td class="step-top">
  32. <span class="page-title"><?=_('Editing Firewall Rule');?></span>
  33. </td>
  34. </tr>
  35. <tr>
  36. <td>
  37. <?php
  38. if (!empty($_SESSION['error_msg'])) {
  39. $msg_icon = 'fa-exclamation-circle status-icon red';
  40. $msg_text = htmlentities($_SESSION['error_msg']);
  41. $msg_id = 'vst-error';
  42. } else {
  43. if (!empty($_SESSION['ok_msg'])) {
  44. $msg_icon = 'fa-check-circle status-icon green';
  45. $msg_text = $_SESSION['ok_msg'];
  46. $msg_id = 'vst-ok';
  47. }
  48. }
  49. ?>
  50. <span class="<?=$msg_id;?>"> <i class="fas <?=$msg_icon;?>"></i> <?=$msg_text;?></span>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="vst-text step-top">
  55. <?=_('Action'); ?>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td>
  60. <select class="vst-list" name="v_action">
  61. <option value="DROP" <?php if ((!empty($v_action)) && ( $v_action == "DROP" )) echo 'selected'?>><?=_('DROP');?></option>
  62. <option value="ACCEPT" <?php if ((!empty($v_action)) && ( $v_action == "ACCEPT" )) echo 'selected'?>><?=_('ACCEPT');?></option>
  63. </select>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="vst-text input-label">
  68. <?=_('Protocol') ?>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td>
  73. <select class="vst-list" name="v_protocol">
  74. <option value="TCP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "TCP" )) echo 'selected'?>><?=_('TCP');?></option>
  75. <option value="UDP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "UDP" )) echo 'selected'?>><?=_('UDP');?></option>
  76. <option value="ICMP" <?php if ((!empty($v_protocol)) && ( $v_protocol == "ICMP" )) echo 'selected'?>><?=_('ICMP');?></option>
  77. </select>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="vst-text input-label">
  82. <?=_('Port');?> <span class="optional">(<?=_('Ranges and Lists are acceptable');?>)</span>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. <input type="text" size="20" class="vst-input" name="v_port" value="<?=htmlentities(trim($v_port, "'"))?>" placeholder="<?=_('All ports: 0, Range: 80-82, List: 80,443,8080,8443');?>">
  88. </td>
  89. </tr>
  90. <tr>
  91. <td class="vst-text input-label">
  92. <?=_('IP address / IPset');?> <span class="optional">(<?=_('CIDR format is supported');?>)</span>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td>
  97. <select class="vst-list" tabindex="-1" id="quickips_list" onchange="this.nextElementSibling.value=this.value">
  98. <option value="">&nbsp;</option>
  99. </select>
  100. <input type="text" size="20" class="vst-input vst-list-editor" name="v_ip" value="<?=htmlentities(trim($v_ip, "'"))?>">
  101. </td>
  102. </tr>
  103. <tr>
  104. <td class="vst-text input-label">
  105. <?=_('Comment');?> <span class="optional">(<?=_('optional');?>)</span>
  106. </td>
  107. </tr>
  108. <tr>
  109. <td>
  110. <input type="text" size="20" class="vst-input" name="v_comment" maxlength="255" value="<?=htmlentities(trim($v_comment, "'"))?>">
  111. </td>
  112. </tr>
  113. </table>
  114. <table class="data-col2">
  115. </table>
  116. </td>
  117. </tr>
  118. </table>
  119. </form>
  120. </div>
  121. <script>
  122. var iplists = JSON.parse('<?=$ipset_lists_json?>');
  123. iplists.sort(function (a, b) {
  124. return a.name > b.name;
  125. });
  126. $(function () {
  127. var targetelement = document.getElementById('quickips_list');
  128. var newEl = document.createElement("option");
  129. newEl.text = "IP address lists:";
  130. newEl.disabled = true;
  131. targetelement.appendChild(newEl);
  132. iplists.forEach(iplist => {
  133. var newEl = document.createElement("option");
  134. newEl.text = iplist.name;
  135. newEl.value = "ipset:" + iplist.name;
  136. targetelement.appendChild(newEl);
  137. });
  138. });
  139. </script>