You are here

function mimedetect_settings_validate in MimeDetect 5

Same name and namespace in other branches
  1. 6 mimedetect.admin.inc \mimedetect_settings_validate()
  2. 7 mimedetect.admin.inc \mimedetect_settings_validate()

File

./mimedetect.module, line 94
Provide server side mime type detection.

Code

function mimedetect_settings_validate($form_id, $form_values) {

  // Test file binary settings.
  if ($form_values['mimedetect_enable_file_binary']) {
    if (empty($form_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_values['mimedetect_file_binary'])) {
      if (!file_exists($form_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_values['mimedetect_file_binary'],
        )));
      }
      else {
        form_set_error('mimedetect_file_binary', t("%path is not executable by your webserver.", array(
          '%path' => $form_values['mimedetect_file_binary'],
        )));
      }
    }
  }
}