You are here

function smileys_admin_form_submit in Smileys 5

Same name and namespace in other branches
  1. 6 smileys.admin.inc \smileys_admin_form_submit()

Implementation of hook_submit().

File

./smileys.module, line 411

Code

function smileys_admin_form_submit($form_id, $form_values) {
  if (isset($form_values['id'])) {
    if ($form_values['op'] == t('Delete Smiley')) {
      smileys_admin_delete($form_values['id']);
      return 'admin/settings/smileys';
    }
    db_query("UPDATE {smileys} SET acronyms='%s', image='%s', description='%s', standalone=%d, promote_to_box=%d WHERE id = %d", $form_values['acronyms'], $form_values['image'], $form_values['description'], $form_values['standalone'], $form_values['promote_to_box'], $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) VALUES ('%s', '%s', '%s', %d, %d)", $form_values["acronyms"], $form_values["image"], $form_values["description"], $form_values["standalone"], $form_values['promote_to_box']);
    $message = t('Added smiley: %smiley', array(
      '%smiley' => $form_values['acronyms'],
    ));
  }
  drupal_set_message($message);
  return 'admin/settings/smileys';
}