You are here

function hosting_server_validate in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 server/hosting_server.module \hosting_server_validate()
  2. 7.3 server/hosting_server.module \hosting_server_validate()

Implementation of hook_validate().

File

server/hosting_server.module, line 330

Code

function hosting_server_validate(&$node, &$form) {
  hosting_ip_validate($node);
  if (!_hosting_valid_fqdn($node->title)) {
    form_set_error('title', t('Invalid hostname. Use a proper hostname or an IP address.'));
  }
  if (!$node->nid && db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE type='server' AND title='%s'", $node->title))) {
    form_set_error('title', t("The hostname you have specified is already in use."));
  }
  hosting_server_services_from_post($node);
  hosting_server_invoke_services($node, 'validate', $node, $form);
}