edit_firewall.html 7.4 KB

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