edit_firewall.html 7.4 KB

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