You are here

function smileys_admin_form_submit in Smileys 6

Same name and namespace in other branches
  1. 5 smileys.module \smileys_admin_form_submit()

Implementation of hook_submit().

File

./smileys.admin.inc, line 273

Code

function smileys_admin_form_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  $form_values['category'] = empty($form_values['category']) ? $form_values['category_other'] : $form_values['category'];
  if (isset($form_values['id'])) {
    db_query("UPDATE {smileys} SET acronyms='%s', image='%s', description='%s', standalone=%d, promote_to_box=%d, package='%s' WHERE id = %d", trim($form_values["acronyms"]), trim($form_values['image']), trim($form_values['description']), $form_values['standalone'], $form_values['promote_to_box'], $form_values['category'], $form_values['id']);
    $message = t('Updated smiley: %smiley', array(
      '%smiley' => $form_values['acronyms'],
    ));
  }
  else {
    db_query("INSERT INTO {smileys} (acronyms, image, description, standalone, promote_to_box, package) VALUES ('%s', '%s', '%s', %d, %d, '%s')", trim($form_values["acronyms"]), trim($form_values["image"]), trim($form_values["description"]), $form_values["standalone"], $form_values['promote_to_box'], $form_values['category']);
    $message = t('Added smiley: %smiley', array(
      '%smiley' => $form_values['acronyms'],
    ));
  }
  drupal_set_message($message);
  $form_state['redirect'] = 'admin/settings/smileys';
}