You are here

function aggregator_save_category in Drupal 5

Same name and namespace in other branches
  1. 4 modules/aggregator.module \aggregator_save_category()
  2. 6 modules/aggregator/aggregator.module \aggregator_save_category()
  3. 7 modules/aggregator/aggregator.module \aggregator_save_category()

Add/edit/delete aggregator categories.

1 call to aggregator_save_category()
aggregator_form_category_submit in modules/aggregator/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.

File

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

Code

function aggregator_save_category($edit) {
  if ($edit['cid'] && $edit['title']) {
    db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']);
  }
  else {
    if ($edit['cid']) {
      db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']);
    }
    else {
      if ($edit['title']) {

        // A single unique id for bundles and feeds, to use in blocks
        $next_id = db_next_id('{aggregator_category}_cid');
        db_query("INSERT INTO {aggregator_category} (cid, title, description, block) VALUES (%d, '%s', '%s', 5)", $next_id, $edit['title'], $edit['description']);
      }
    }
  }
}