You are here

function fckeditor_admin_profile_form_submit in FCKeditor - WYSIWYG HTML editor 6.2

File

./fckeditor.admin.inc, line 981
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben

Code

function fckeditor_admin_profile_form_submit($form, &$form_state) {
  $edit =& $form_state['values'];
  if (isset($edit['_profile'])) {
    db_query("DELETE FROM {fckeditor_settings} WHERE name = '%s'", $edit['_profile']->name);
    db_query("DELETE FROM {fckeditor_role} WHERE name = '%s'", $edit['_profile']->name);
    drupal_set_message(t('Your FCKeditor profile has been updated.'));
  }
  else {
    drupal_set_message(t('Your FCKeditor profile has been created.'));
  }
  $settings = fckeditor_admin_values_to_settings($edit);
  db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], $settings);
  fckeditor_rebuild_selectors($edit['name']);
  if (!empty($edit['rids'])) {
    foreach (array_keys($edit['rids']) as $rid) {
      if ($edit['rids'][$rid] != 0) {
        db_query("INSERT INTO {fckeditor_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid);
      }
    }
  }
  $form_state['redirect'] = 'admin/settings/fckeditor';
}