function rate_settings_form_validate in Rate 7
Form validate callback for the settings form.
File
- ./
rate.admin.inc, line 857 - Rating admin
Code
function rate_settings_form_validate($form, &$form_state) {
if (!empty($form_state['values'][RATE_VAR_BOT_BOTSCOUT_KEY])) {
$url = "http://botscout.com/test/?ip=84.16.230.111&key=" . $form_state['values'][RATE_VAR_BOT_BOTSCOUT_KEY];
$data = drupal_http_request($url, array(
'timeout' => 5,
));
if ($data->code == 200) {
if ($data->data[0] == 'Y' || $data->data[0] == 'N') {
drupal_set_message(t('Rate has succesfully contacted the BotScout server.'));
}
else {
form_set_error(RATE_VAR_BOT_BOTSCOUT_KEY, t('Invalid API-key.'));
}
}
else {
form_set_error(RATE_VAR_BOT_BOTSCOUT_KEY, t('Rate was unable to contact the BotScout server.'));
}
}
}