function domain_configure_form_submit in Domain Access 6.2
Same name and namespace in other branches
- 7.2 domain.admin.inc \domain_configure_form_submit()
Save any changes to the primary domain record.
1 string reference to 'domain_configure_form_submit'
- domain_configure_form in ./
domain.admin.inc - FormsAPI for configuring the domain module.
File
- ./
domain.admin.inc, line 368 - Administration functions for the domain module.
Code
function domain_configure_form_submit($form, &$form_state) {
if ($form_state['values']['op'] == $form_state['values']['reset']) {
domain_set_primary_domain();
return;
}
$subdomain = $form_state['values']['domain_root'];
// Insert query or update query?
$count = db_result(db_query("SELECT 1 FROM {domain} WHERE domain_id = 0"));
if ($count > 0) {
db_query("UPDATE {domain} SET subdomain = '%s', sitename = '%s', scheme = '%s', valid = 1 WHERE domain_id = 0", $form_state['values']['domain_root'], $form_state['values']['domain_sitename'], $form_state['values']['domain_scheme']);
}
else {
db_query("INSERT INTO {domain} (subdomain, sitename, scheme, valid) VALUES ('%s', '%s', '%s', %d)", $form_state['values']['domain_root'], $form_state['values']['domain_sitename'], $form_state['values']['domain_scheme'], 1);
// MySQL won't let us insert row 0 into an autoincrement table.
db_query("UPDATE {domain} SET domain_id = 0 WHERE subdomain = '%s'", $form_state['values']['domain_root']);
}
// Allow other modules to respond to changes.
module_invoke_all('domainupdate', 'update', domain_default(TRUE));
}