Made to Order Software Corporation Logo

MO Anti-pounding: mo_anti_pounding.admin.inc File Reference

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.


Detailed Description

This file allows a Drupal administrator to change the settings of the Anti-pounding module.

Copyright (c) 2010-2011 Made to Order Software Corp.

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.


Function Documentation

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.

Parameters:
[in]$allWhether 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.

Returns:
The form array.

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.

Parameters:
[in,out]$formThe form being saved.
[in]$form_stateThe 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.

Parameters:
[in]$formThe form being validated
[in,out]$form_stateThe 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.

Parameters:
[in]$strThe string to parse.
Returns:
The array of extensions.

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.

Parameters:
[in]$strThe string representing all the IPs and Masks.
[in]$has_delayWhether a delay may follow the IPs and Masks.
Returns:
An array ready to use by the anti-pounding code.

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.

Parameters:
[in]$emitWhether this function emits errors
Returns:
The preferences

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().

Documentation generated by Doxygen on Mon Oct 10 2011 14:30:48