You are here

function deploy_server_form_submit in Deploy - Content Staging 6

Same name and namespace in other branches
  1. 5 deploy.module \deploy_server_form_submit()

Submit callback for deploy_server_form().

File

./deploy.servers.admin.inc, line 104
Page handlers for deploy server admin.

Code

function deploy_server_form_submit($form, &$form_state) {
  $url = $form_state['values']['url'];
  $description = $form_state['values']['description'];
  $auth_type = $form_state['values']['auth_type'];

  // If 'sid' exists in the submitted form, then this is an edit. Otherwise it is
  // a new server.
  if (array_key_exists('sid', $form_state['values'])) {
    $sid = $form_state['values']['sid'];
    db_query("UPDATE {deploy_servers} SET description = '%s', url = '%s', auth_type = '%s' WHERE sid = %d", $description, $url, $auth_type, $sid);
    drupal_set_message(t('Deployment server updated'));
  }
  else {
    db_query("INSERT INTO {deploy_servers} (description, url, auth_type) VALUES ('%s', '%s', '%s')", $description, $url, $auth_type);
    drupal_set_message(t('Deployment server added'));
  }
  $form_state['redirect'] = 'admin/build/deploy/servers';
}