diff options
-rw-r--r-- | modules/throttle/throttle.module | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module index d31390664..c2e1834aa 100644 --- a/modules/throttle/throttle.module +++ b/modules/throttle/throttle.module @@ -108,14 +108,6 @@ function throttle_exit() { } } -function _throttle_validate($value, $form) { - if ($value != NULL) { - if (!is_numeric($value) || $value < 0) { - form_set_error($form, t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $value))); - } - } -} - /** * Implementation of hook_help(). */ @@ -132,8 +124,6 @@ function throttle_help($section) { } function throttle_admin_settings() { - _throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous'); - _throttle_validate(variable_get('throttle_user', ''), 'throttle_user'); $probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%'); $form['throttle_anonymous'] = array( @@ -162,3 +152,12 @@ function throttle_admin_settings() { return system_settings_form($form); } + +function throttle_admin_settings_validate($form_id, $form_values) { + if (!is_numeric($form_values['throttle_anonymous']) || $form_values['throttle_anonymous'] < 0) { + form_set_error('throttle_anonymous', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_values['throttle_anonymous']))); + } + if (!is_numeric($form_values['throttle_user']) || $form_values['throttle_user'] < 0) { + form_set_error('throttle_user', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_values['throttle_user']))); + } +} |