You are here

function aggregator_form_feed_submit in Drupal 4

Same name and namespace in other branches
  1. 5 modules/aggregator/aggregator.module \aggregator_form_feed_submit()
  2. 6 modules/aggregator/aggregator.admin.inc \aggregator_form_feed_submit()
  3. 7 modules/aggregator/aggregator.admin.inc \aggregator_form_feed_submit()

Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.

File

modules/aggregator.module, line 496
Used to aggregate syndicated content (RSS, RDF, and Atom).

Code

function aggregator_form_feed_submit($form_id, $form_values) {
  if ($_POST['op'] == t('Delete')) {
    $title = $form_values['title'];

    // Unset the title:
    unset($form_values['title']);
  }
  aggregator_save_feed($form_values);
  menu_rebuild();
  if (isset($form_values['fid'])) {
    if (isset($form_values['title'])) {
      drupal_set_message(t('The feed %feed has been updated.', array(
        '%feed' => theme('placeholder', $form_values['title']),
      )));
      if (arg(0) == 'admin') {
        return 'admin/aggregator/';
      }
      else {
        return 'aggregator/sources/' . $form_values['fid'];
      }
    }
    else {
      watchdog('aggregator', t('Feed %feed deleted.', array(
        '%feed' => theme('placeholder', $title),
      )));
      drupal_set_message(t('The feed %feed has been deleted.', array(
        '%feed' => theme('placeholder', $title),
      )));
      if (arg(0) == 'admin') {
        return 'admin/aggregator/';
      }
      else {
        return 'aggregator/sources/';
      }
    }
  }
  else {
    watchdog('aggregator', t('Feed %feed added.', array(
      '%feed' => theme('placeholder', $form_values['title']),
    )), WATCHDOG_NOTICE, l(t('view'), 'admin/aggregator'));
    drupal_set_message(t('The feed %feed has been added.', array(
      '%feed' => theme('placeholder', $form_values['title']),
    )));
  }
}