Ban users that pounder really hard on your site. More...
Functions | |
mo_anti_pounding_status ($emit) | |
Check the current status. | |
mo_anti_pounding_form () | |
Generate form for settings. | |
mo_anti_pounding_form_validate ($form, &$form_state) | |
Verify that the form parameters are valid. | |
mo_anti_pounding_form_submit (&$form, $form_state) | |
Save the new settings in the settings file. | |
mo_anti_pounding_parse_extensions ($str) | |
Parses an array of extensions. | |
mo_anti_pounding_parse_ips ($str, $has_delay) | |
Parse a list of IPs & Masks. | |
mo_anti_pounding_reset_cache_submit () | |
Reset the cache. | |
mo_anti_pounding_clear_cache_submit () | |
Reset the cache. | |
mo_anti_pounding_clear_cache ($all) | |
Clear the MO Anti-pounding cache. |
This file allows a Drupal administrator to change the settings of the Anti-pounding module.
http://www.m2osw.com/mo_anti_pounding contact@m2osw.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mo_anti_pounding_clear_cache | ( | $ | all | ) |
This function clears the files in the cache of the MO Anti-pounding system.
You may clear the entire cache entirely or only clear the old files. The CRON system will only clear the old files. The administrator can clear all the files at once.
When deleting all the files, the system may generate errors because some other hits are received in between and prevent some folders from being deleted. Those errors are ignored.
[in] | $all | Whether all the files should be deleted |
References mo_anti_pounding_get_conf_path().
Referenced by mo_anti_pounding_clear_cache_submit(), mo_anti_pounding_cron(), mo_anti_pounding_reset_cache_submit(), and mo_anti_pounding_uninstall().
mo_anti_pounding_clear_cache_submit | ( | ) |
This function clears the cache after a user click on the Clear Cache button.
References mo_anti_pounding_clear_cache().
mo_anti_pounding_form | ( | ) |
This function generates a form to setup the anti-pounding module.
References mo_anti_pounding_get_conf_path(), and mo_anti_pounding_status().
mo_anti_pounding_form_submit | ( | &$ | form, |
$ | form_state | ||
) |
This function transform the settings in a $prefs object and then saves the object in the preferences file.
This function also takes care of transforming all the entries that we want to have to quickly handle a session.
[in,out] | $form | The form being saved. |
[in] | $form_state | The current state of the form. |
References mo_anti_pounding_load_preferences(), mo_anti_pounding_parse_extensions(), mo_anti_pounding_parse_ips(), and mo_anti_pounding_save_preferences().
mo_anti_pounding_form_validate | ( | $ | form, |
&$ | form_state | ||
) |
Validate the MO Anti-pounding settings. There are many things to validate such as the timings that should be increased from smallest to largest. This function ensures that all the parameters are valid.
[in] | $form | The form being validated |
[in,out] | $form_state | The form data being validated |
References mo_anti_pounding_parse_extensions().
mo_anti_pounding_parse_extensions | ( | $ | str | ) |
This function takes a string of extensions separated by commas and transform it in an array.
The function makes sure that the extensions are not empty and do not include a starting period.
[in] | $str | The string to parse. |
Referenced by mo_anti_pounding_form_submit(), and mo_anti_pounding_form_validate().
mo_anti_pounding_parse_ips | ( | $ | str, |
$ | has_delay | ||
) |
This function parses a list of IPs and Masks for the white or black list of the MO Anti-pounding module.
The IP and Mask may be followed by a delay.
The function always returns an array, although it may be empty.
[in] | $str | The string representing all the IPs and Masks. |
[in] | $has_delay | Whether a delay may follow the IPs and Masks. |
Referenced by mo_anti_pounding_form_submit().
mo_anti_pounding_reset_cache_submit | ( | ) |
This function resets the cache after a user click on the Reset Cache button.
References mo_anti_pounding_clear_cache().
mo_anti_pounding_status | ( | $ | emit | ) |
This function checks the current status and eventually emits errors about it.
[in] | $emit | Whether this function emits errors |
References mo_anti_pounding_get_conf_path(), mo_anti_pounding_load_preferences(), and mo_anti_pounding_settings_setup_ok().
Referenced by mo_anti_pounding_form(), and mo_anti_pounding_requirements().