Save input formats on the overview page.

File

modules/filter.module, line 310
Framework for handling filtering of content.

Code

function filter_admin_save() {
  $edit = $_POST['edit'];
  variable_set('filter_default_format', $edit['default']);
  foreach ($edit['name'] as $id => $name) {
    $name = trim($name);
    if (strlen($name) == 0) {
      drupal_set_message(t('You must enter a name for this input format.'));
      drupal_goto('admin/filters');
    }
    else {
      db_query("UPDATE {filter_formats} SET name='%s' WHERE format = %d", $name, $id);
    }
  }

  // We store the roles as a string for ease of use.
  // We use leading and trailing comma's to allow easy substring matching.
  foreach ($edit['roles'] as $id => $format) {
    $roles = ',';
    foreach ($format as $rid => $value) {
      if ($value) {
        $roles .= $rid . ',';
      }
    }
    db_query("UPDATE {filter_formats} SET roles = '%s' WHERE format = %d", $roles, $id);
  }
  drupal_set_message(t('The input format settings have been updated.'));
  drupal_goto('admin/filters');
}