You are here

function mail_debugger_php_form_validate in Mail Debugger 7.3

File

modules/php/includes/php.mail_debugger.inc, line 85

Code

function mail_debugger_php_form_validate($values, $elements, &$form_state) {
  try {
    $php = $values['param'];
    if (!empty($php)) {
      $param = eval($values['param']);
      if (!is_array($param)) {
        form_set_error($elements['param'], t("The PHP code to populate \$param must be an array"));
      }
    }
  } catch (Exception $ex) {
    form_set_error($elements['param'], $ex
      ->getMessage());
  }
  if (!valid_email_address($values['to'])) {
    form_set_error($elements['to'], t('Enter a valid e-mail address'));
  }
  if (!empty($values['from']) && !valid_email_address($values['from'])) {
    form_set_error($elements['from'], t('Enter a valid e-mail address'));
  }
  if (empty($value['key'])) {
    form_set_error($elements['key'], t('Enter a valid key parameter'));
  }
}