function domain_conf_form_submit in Domain Access 6.2
Same name and namespace in other branches
- 5 domain_conf/domain_conf.module \domain_conf_form_submit()
- 7.3 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
- 7.2 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
FormsAPI for domain_conf_form().
1 string reference to 'domain_conf_form_submit'
- domain_conf_default in domain_conf/
domain_conf.admin.inc - Special configuration options for the main domain.
File
- domain_conf/
domain_conf.admin.inc, line 154 - Domain manager configuration options.
Code
function domain_conf_form_submit($form, &$form_state) {
$new_settings = array();
// Throw away what we don't need.
$ignore = array(
'form_token',
'form_id',
'form_build_id',
'op',
'submit',
'domain_id',
);
foreach ($form_state['values'] as $key => $value) {
if (in_array($key, $ignore)) {
continue;
}
$new_settings[$key] = $value;
}
// INSERT or UPDATE?
$result = db_fetch_object(db_query("SELECT domain_id, settings FROM {domain_conf} WHERE domain_id = %d", $form_state['values']['domain_id']));
if (!empty($result->settings)) {
$settings = domain_unserialize($result->settings);
$merged_settings = array_merge($settings, $new_settings);
$sql = "UPDATE {domain_conf} SET settings = %b WHERE domain_id = %d";
db_query($sql, serialize($merged_settings), $form_state['values']['domain_id']);
}
else {
$sql = "INSERT INTO {domain_conf} (domain_id, settings) VALUES (%d, %b)";
db_query($sql, $form_state['values']['domain_id'], serialize($new_settings));
}
drupal_set_message(t('Domain options saved successfully.'));
// Clear the cache.
cache_clear_all();
}