add_firewall.html 7.3 KB

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