function mimedetect_settings_validate in MimeDetect 6
Same name and namespace in other branches
- 5 mimedetect.module \mimedetect_settings_validate()
- 7 mimedetect.admin.inc \mimedetect_settings_validate()
File
- ./
mimedetect.admin.inc, line 33
Code
function mimedetect_settings_validate($form_id, &$form_state) {
// Test file binary settings.
if ($form_state['values']['mimedetect_enable_file_binary']) {
if (empty($form_state['values']['mimedetect_file_binary'])) {
form_set_error('mimedetect_file_binary', t("You must specify the path to the 'file' binary if it is enabled."));
}
if (!is_executable($form_state['values']['mimedetect_file_binary'])) {
if (!file_exists($form_state['values']['mimedetect_file_binary'])) {
form_set_error('mimedetect_file_binary', t("The path %path does not exist or is not readable by your webserver.", array(
'%path' => $form_state['values']['mimedetect_file_binary'],
)));
}
else {
form_set_error('mimedetect_file_binary', t("%path is not executable by your webserver.", array(
'%path' => $form_state['values']['mimedetect_file_binary'],
)));
}
}
}
}