function imageinfo_cache_admin_form_validate in Imageinfo Cache 6
Same name and namespace in other branches
- 6.2 imageinfo_cache.admin.inc \imageinfo_cache_admin_form_validate()
validate imageinfo_cache_admin_form submissions.
File
- ./
imageinfo_cache.admin.inc, line 89 - Configuration page for imageinfo cache module.
Code
function imageinfo_cache_admin_form_validate($form, &$form_state) {
$values = $form_state['values'];
// Check that imageinfo_cache_socket_timeout is a positive interger.
if (empty($values['imageinfo_cache_socket_timeout']) || !is_numeric($values['imageinfo_cache_socket_timeout']) || $values['imageinfo_cache_socket_timeout'] < 1) {
form_set_error('imageinfo_cache_socket_timeout', t('Number must be a positive interger.'));
}
// Check that imageinfo_cache_async_max is a positive interger.
if (empty($values['imageinfo_cache_async_max']) || !is_numeric($values['imageinfo_cache_async_max']) || $values['imageinfo_cache_async_max'] < 1) {
form_set_error('imageinfo_cache_async_max', t('Number must be a positive interger.'));
}
// If the IP field is not blank, check that its a valid address.
if (!empty($values['imageinfo_cache_server_addr']) && ip2long($values['imageinfo_cache_server_addr']) === FALSE) {
form_set_error('imageinfo_cache_server_addr', t('Must be a valid IP address.'));
}
if (empty($values['imageinfo_cache_url_key']) || !is_numeric($values['imageinfo_cache_url_key']) || $values['imageinfo_cache_url_key'] < 1) {
form_set_error('imageinfo_cache_url_key', t('Number must be a positive interger.'));
}
}