function contact_admin_edit_submit in Drupal 4
Same name and namespace in other branches
- 5 modules/contact/contact.module \contact_admin_edit_submit()
- 6 modules/contact/contact.admin.inc \contact_admin_edit_submit()
Process the contact category edit page form submission.
File
- modules/
contact.module, line 216 - Enables the use of personal and site-wide contact forms.
Code
function contact_admin_edit_submit($form_id, $form_values) {
if ($form_values['selected']) {
// Unselect all other contact categories.
db_query('UPDATE {contact} SET selected = 0');
}
$recipients = explode(',', $form_values['recipients']);
foreach ($recipients as $key => $recipient) {
// E-mail address validation has already been done in _validate.
$recipients[$key] = trim($recipient);
}
$form_values['recipients'] = implode(',', $recipients);
if (arg(3) == 'add') {
db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
drupal_set_message(t('Category %category has been added.', array(
'%category' => theme('placeholder', $form_values['category']),
)));
watchdog('mail', t('Contact form: category %category added.', array(
'%category' => theme('placeholder', $form_values['category']),
)), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
}
else {
db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
drupal_set_message(t('Category %category has been updated.', array(
'%category' => theme('placeholder', $form_values['category']),
)));
watchdog('mail', t('Contact form: category %category updated.', array(
'%category' => theme('placeholder', $form_values['category']),
)), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
}
return 'admin/contact';
}