function shoutbox_admin_settings_validate in Shoutbox 7.2
Same name and namespace in other branches
- 6.2 shoutbox.pages.inc \shoutbox_admin_settings_validate()
- 7 shoutbox.pages.inc \shoutbox_admin_settings_validate()
Validate the admin settings form.
File
- ./
shoutbox.pages.inc, line 234 - Page callbacks for the shoutbox module.
Code
function shoutbox_admin_settings_validate($form, &$form_state) {
if (!is_numeric($form_state['values']['shoutbox_showamount_block'])) {
form_set_error('shoutbox_showamount_block', t('Block amount must be numeric'));
}
if (!is_numeric($form_state['values']['shoutbox_showamount_page'])) {
form_set_error('shoutbox_showamount_page', t('Page amount must be numeric'));
}
if (!is_numeric($form_state['values']['shoutbox_max_length'])) {
form_set_error('shoutbox_max_length', t('Shoutbox length must be numeric'));
}
if (!is_numeric($form_state['values']['shoutbox_refresh'])) {
form_set_error('shoutbox_refresh', t('Refresh setting must be a numeric value'));
}
if (!is_numeric($form_state['values']['shoutbox_anonymous_timeout'])) {
form_set_error('shoutbox_anonymous_timeout', t('Anonymous timeout setting must be a numeric value'));
}
if (!is_numeric($form_state['values']['shoutbox_registered_timeout'])) {
form_set_error('shoutbox_registered_timeout', t('Registered timeout setting must be a numeric value'));
}
if (!is_numeric($form_state['values']['shoutbox_expire'])) {
form_set_error('shoutbox_expire', t('Expiration setting must be a numeric value'));
}
if ($form_state['values']['shoutbox_replace_singular'] != '' || $form_state['values']['shoutbox_replace_singular'] != '') {
if ($form_state['values']['shoutbox_replace_singular'] == '') {
form_set_error('shoutbox_replace_singular', t('Both fields must be empty or filled.'));
}
elseif ($form_state['values']['shoutbox_replace_plural'] == '') {
form_set_error('shoutbox_replace_plural', t('Both fields must be empty or filled.'));
}
else {
$bProceed = true;
if (is_numeric($form_state['values']['shoutbox_replace_singular'])) {
form_set_error('shoutbox_replace_singular', t('"shout" replacement must contain only letters.'));
}
if (is_numeric($form_state['values']['shoutbox_replace_plural'])) {
form_set_error('shoutbox_replace_plural', t('"shout" replacement must contain only letters.'));
}
if ($bProceed) {
if (isset($form_state['values']['shoutbox_replace_singular']) && $form_state['values']['shoutbox_replace_singular'] != '') {
$form_state['values']['shoutbox_replace_singular'] = strtolower($form_state['values']['shoutbox_replace_singular']);
}
if (isset($form_state['values']['shoutbox_replace_plural']) && $form_state['values']['shoutbox_replace_plural'] != '') {
$form_state['values']['shoutbox_replace_plural'] = strtolower($form_state['values']['shoutbox_replace_plural']);
}
}
}
}
}