antibot.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. /* @var $this NewsletterSubscription */
  3. defined('ABSPATH') || exit;
  4. @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
  5. $controls = new NewsletterControls();
  6. if ($controls->is_action()) {
  7. if ($controls->is_action('save')) {
  8. $controls->data['ip_blacklist'] = $this->to_array($controls->data['ip_blacklist']);
  9. $controls->data['address_blacklist'] = $this->to_array($controls->data['address_blacklist']);
  10. $this->save_options($controls->data, 'antibot');
  11. $controls->add_message_saved();
  12. }
  13. } else {
  14. $controls->data = $this->get_options('antibot');
  15. }
  16. ?>
  17. <div class="wrap" id="tnp-wrap">
  18. <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
  19. <div id="tnp-heading">
  20. <h2><?php _e('Security', 'newsletter') ?></h2>
  21. <?php $controls->page_help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
  22. </div>
  23. <div id="tnp-body">
  24. <form method="post" action="">
  25. <?php $controls->init(); ?>
  26. <div class="tnp-buttons">
  27. <?php $controls->button_save() ?>
  28. </div>
  29. <div id="tabs">
  30. <ul>
  31. <li><a href="#tabs-general"><?php _e('Security', 'newsletter') ?></a></li>
  32. <li><a href="#tabs-blacklists"><?php _e('Blacklists', 'newsletter') ?></a></li>
  33. </ul>
  34. <div id="tabs-general">
  35. <table class="form-table">
  36. <tr>
  37. <th><?php _e('Disable antibot/antispam?', 'newsletter') ?></th>
  38. <td>
  39. <?php $controls->yesno('disabled'); ?>
  40. <p class="description">
  41. <?php _e('Disable for ajax form submission', 'newsletter'); ?>
  42. </p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <th>Akismet</th>
  47. <td>
  48. <?php
  49. $controls->select('akismet', array(
  50. 0 => __('Disabled', 'newsletter'),
  51. 1 => __('Enabled', 'newsletter')
  52. ));
  53. ?>
  54. <?php $controls->help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th><?php _e('Antiflood', 'newsletter') ?></th>
  59. <td>
  60. <?php
  61. $controls->select('antiflood', array(
  62. 0 => __('Disabled', 'newsletter'),
  63. 5 => '5 ' . __('seconds', 'newsletter'),
  64. 10 => '10 ' . __('seconds', 'newsletter'),
  65. 15 => '15 ' . __('seconds', 'newsletter'),
  66. 30 => '30 ' . __('seconds', 'newsletter'),
  67. 60 => '1 ' . __('minute', 'newsletter'),
  68. 120 => '2 ' . __('minutes', 'newsletter'),
  69. 300 => '5 ' . __('minutes', 'newsletter'),
  70. 600 => '10 ' . __('minutes', 'newsletter'),
  71. 900 => '15 ' . __('minutes', 'newsletter'),
  72. 1800 => '30 ' . __('minutes', 'newsletter'),
  73. 360 => '60 ' . __('minutes', 'newsletter')
  74. ));
  75. ?>
  76. <?php $controls->help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
  77. </td>
  78. </tr>
  79. <tr>
  80. <th><?php _e('Captcha', 'newsletter') ?> </th>
  81. <td>
  82. <?php $controls->enabled('captcha'); ?> <?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#captcha') ?>
  83. </td>
  84. </tr>
  85. <?php /*
  86. <tr>
  87. <th><?php _e('Domain check', 'newsletter') ?></th>
  88. <td>
  89. <?php
  90. $controls->yesno('domain_check');
  91. ?>
  92. </td>
  93. </tr>
  94. */ ?>
  95. </table>
  96. </div>
  97. <div id="tabs-blacklists">
  98. <table class="form-table">
  99. <tr>
  100. <th>
  101. <?php _e('IP black list', 'newsletter') ?>
  102. <?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#ip') ?>
  103. </th>
  104. <td>
  105. <?php $controls->textarea('ip_blacklist'); ?>
  106. <p class="description"><?php _e('One per line', 'newsletter') ?></p>
  107. </td>
  108. </tr>
  109. <tr>
  110. <th>
  111. <?php _e('Address black list', 'newsletter') ?>
  112. <?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#domains') ?>
  113. </th>
  114. <td>
  115. <?php $controls->textarea('address_blacklist'); ?>
  116. <p class="description"><?php _e('One per line', 'newsletter') ?></p>
  117. </td>
  118. </tr>
  119. </table>
  120. </div>
  121. </div>
  122. <p>
  123. <?php $controls->button_save() ?>
  124. </p>
  125. </form>
  126. </div>
  127. <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
  128. </div>