You are here

function uptolike_admin_statistic_form_validate in Uptolike share buttons 7

Validation handler for admin setting form.

File

./uptolike.admin.inc, line 107
Code for admin pages of Uptolike module.

Code

function uptolike_admin_statistic_form_validate($form, &$form_state) {
  if (isset($form_state['values']['uptolike_email'])) {
    if (!valid_email_address($form_state['values']['uptolike_email'])) {
      form_error($form['uptolike_account_info']['uptolike_email'], t('Email address is invalid.'));
    }
  }
  if (isset($form_state['values']['uptolike_status']) && $form_state['values']['uptolike_status'] == 'badCredentials') {
    form_error($form['uptolike_status'], t('Wrong key! Make sure you copied the key without extra characters (spaces, etc.).'));
    drupal_set_message(t('If the key has not been received, write a letter to support !email.', array(
      '!email' => l(UPTOLIKE_SUPPORT_EMAIL, 'mailto:' . UPTOLIKE_SUPPORT_EMAIL),
    )), 'warning');
  }
  if (isset($form_state['values']['uptolike_status']) && $form_state['values']['uptolike_status'] == 'foreignAccess') {
    form_error($form['uptolike_status'], t('Wrong key! Make sure you copied the key without extra characters (spaces, etc.).'));
    drupal_set_message(t('This project belongs to another user. Contact Support !email specifying the site address in the letter.', array(
      '!email' => l(UPTOLIKE_SUPPORT_EMAIL, 'mailto:' . UPTOLIKE_SUPPORT_EMAIL),
    )), 'warning');
  }
}