You are here

function tinybrowser_profile_form_validate in TinyBrowser 7

Implements hook_validate()

File

./tinybrowser.module, line 906

Code

function tinybrowser_profile_form_validate($form_id, $form_values) {
  $op = $form_values['values']['op'];
  if ($op == t('Cancel')) {
    return;
  }
  if (empty($form_values['values']['profile']['name'])) {
    form_set_error('profile][name', t('You need to enter the name of this profile.'));
  }
  if (!preg_match('/^\\/.*\\/$/', $form_values['values']['profile']['directory']['path_file'])) {
    form_set_error('profile][directory][path_file', t('The file directory path must start with a slash and also must end with a slash'));
  }
  if (!preg_match('/^\\/.*\\/$/', $form_values['values']['profile']['directory']['path_image'])) {
    form_set_error('profile][directory][path_image', t('The image directory path must start with a slash and also must end with a slash'));
  }
  if (!preg_match('/^\\/.*\\/$/', $form_values['values']['profile']['directory']['path_media'])) {
    form_set_error('profile][directory][path_media', t('The media directory path must start with a slash and also must end with a slash'));
  }
}