function aggregator_save_item in Drupal 5
Same name and namespace in other branches
- 4 modules/aggregator.module \aggregator_save_item()
- 6 modules/aggregator/aggregator.module \aggregator_save_item()
- 7 modules/aggregator/aggregator.processor.inc \aggregator_save_item()
1 call to aggregator_save_item()
- aggregator_parse_feed in modules/
aggregator/ aggregator.module
File
- modules/
aggregator/ aggregator.module, line 953 - 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', guid = '%s', timestamp = %d WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['guid'], $edit['timestamp'], $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, guid) VALUES (%d, %d, '%s', '%s', '%s', '%s', %d, '%s')", $edit['iid'], $edit['fid'], $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['timestamp'], $edit['guid']);
// 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']);
}
}
}
}
}