add_firewall.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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_add_ip" method="post">
  16. <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
  17. <input type="hidden" name="ok" value="Add" />
  18. <table class="data mode-add">
  19. <tr class="data-add">
  20. <td class="data-dotted">
  21. <table class="data-col1">
  22. <tr>
  23. <td></td>
  24. </tr>
  25. </table>
  26. </td>
  27. <td class="data-dotted">
  28. <table class="data-col2" width="600px">
  29. <tr>
  30. <td class="step-top">
  31. <span class="page-title"><?=_('Adding Firewall Rule');?></span>
  32. </td>
  33. </tr>
  34. <tr>
  35. <td>
  36. <?php
  37. if (!empty($_SESSION['error_msg'])) {
  38. $msg_icon = 'fa-exclamation-circle status-icon red';
  39. $msg_text = htmlentities($_SESSION['error_msg']);
  40. $msg_id = 'vst-error';
  41. } else {
  42. if (!empty($_SESSION['ok_msg'])) {
  43. $msg_icon = 'fa-check-circle status-icon green';
  44. $msg_text = $_SESSION['ok_msg'];
  45. $msg_id = 'vst-ok';
  46. }
  47. }
  48. ?>
  49. <span class="<?=$msg_id;?>"> <i class="fas <?=$msg_icon;?>"></i> <?=$msg_text;?></span>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="vst-text step-top">
  54. <?=_('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. <?=_('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. <?=_('Port');?> <span class="optional">(<?=_('Ranges and Lists 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, "'"))?>" placeholder="<?=_('All ports: 0, Range: 80-82, List: 80,443,8080,8443');?>">
  87. </td>
  88. </tr>
  89. <tr>
  90. <td class="vst-text input-label">
  91. <?=_('IP address / IPset');?> <span class="optional">(<?=_('CIDR format is supported');?>)</span>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td>
  96. <select class="vst-list" tabindex="-1" id="quickips_list" onchange="this.nextElementSibling.value=this.value">
  97. <option value="">&nbsp;</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. <?=_('Comment');?> <span class="optional">(<?=_('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"></table>
  114. </td>
  115. </tr>
  116. </table>
  117. </form>
  118. </div>
  119. <script>
  120. var iplists = JSON.parse('<?=$ipset_lists_json?>');
  121. iplists.sort(function (a, b) {
  122. return a.name > b.name;
  123. });
  124. $(function () {
  125. var targetelement = document.getElementById('quickips_list');
  126. var newEl = document.createElement("option");
  127. newEl.text = "IP address lists:";
  128. newEl.disabled = true;
  129. targetelement.appendChild(newEl);
  130. iplists.forEach(iplist => {
  131. var newEl = document.createElement("option");
  132. newEl.text = iplist.name;
  133. newEl.value = "ipset:" + iplist.name;
  134. targetelement.appendChild(newEl);
  135. });
  136. });
  137. </script>