Same name and namespace in other branches
  1. 4.6.x modules/aggregator.module \aggregator_save_item()
  2. 5.x modules/aggregator/aggregator.module \aggregator_save_item()
  3. 6.x modules/aggregator/aggregator.module \aggregator_save_item()
  4. 7.x modules/aggregator/aggregator.processor.inc \aggregator_save_item()
1 call to aggregator_save_item()
aggregator_parse_feed in modules/aggregator.module

File

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

Code

function aggregator_save_item($edit) {
  if ($edit['iid'] && $edit['title']) {
    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = '%s' WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['iid']);
  }
  else {
    if ($edit['iid']) {
      db_query('DELETE FROM {aggregator_item} WHERE iid = %d', $edit['iid']);
      db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $edit['iid']);
    }
    else {
      if ($edit['title'] && $edit['link']) {
        $edit['iid'] = db_next_id('{aggregator_item}_iid');
        db_query("INSERT INTO {aggregator_item} (iid, fid, title, link, author, description, timestamp) VALUES (%d, %d, '%s', '%s', '%s', '%s', %d)", $edit['iid'], $edit['fid'], $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['timestamp']);

        // file the items in the categories indicated by the feed
        $categories = db_query('SELECT cid FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']);
        while ($category = db_fetch_object($categories)) {
          db_query('INSERT INTO {aggregator_category_item} (cid, iid) VALUES (%d, %d)', $category->cid, $edit['iid']);
        }
      }
    }
  }
}