You are here

function domain_conf_form_submit in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
  2. 7.3 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
  3. 7.2 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()

FormsAPI

File

domain_conf/domain_conf.module, line 260
Domain manager configuration options.

Code

function domain_conf_form_submit($form_id, $form_values) {

  // Throw away what we don't need.
  $settings = $form_values;
  $unset = array(
    'form_token',
    'form_id',
    'op',
    'submit',
  );
  foreach ($unset as $key) {
    unset($settings[$key]);
  }

  // INSERT or UPDATE?
  $check = db_fetch_array(db_query("SELECT domain_id FROM {domain_conf} WHERE domain_id = %d", $form_values['domain_id']));
  if (isset($check['domain_id'])) {
    $sql = "UPDATE {domain_conf} SET settings = %b WHERE domain_id = %d";
    db_query($sql, serialize($settings), $form_values['domain_id']);
  }
  else {
    $sql = "INSERT INTO {domain_conf} VALUES (%d, %b)";
    db_query($sql, $form_values['domain_id'], serialize($settings));
  }

  // Clear the cache.
  cache_clear_all();
  drupal_set_message(t('Domain options saved successfully.'));
}