function aggregator_save_category in Drupal 6
Same name and namespace in other branches
- 4 modules/aggregator.module \aggregator_save_category()
- 5 modules/aggregator/aggregator.module \aggregator_save_category()
- 7 modules/aggregator/aggregator.module \aggregator_save_category()
Add/edit/delete aggregator categories.
Parameters
$edit: An associative array describing the category to be added/edited/deleted.
1 call to aggregator_save_category()
- aggregator_form_category_submit in modules/
aggregator/ aggregator.admin.inc - Process aggregator_form_category form submissions.
File
- modules/
aggregator/ aggregator.module, line 373 - Used to aggregate syndicated content (RSS, RDF, and Atom).
Code
function aggregator_save_category($edit) {
$link_path = 'aggregator/categories/';
if (!empty($edit['cid'])) {
$link_path .= $edit['cid'];
if (!empty($edit['title'])) {
db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']);
$op = 'update';
}
else {
db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']);
// Make sure there is no active block for this category.
db_query("DELETE FROM {blocks} WHERE module = '%s' AND delta = '%s'", 'aggregator', 'category-' . $edit['cid']);
$edit['title'] = '';
$op = 'delete';
}
}
else {
if (!empty($edit['title'])) {
// A single unique id for bundles and feeds, to use in blocks
db_query("INSERT INTO {aggregator_category} (title, description, block) VALUES ('%s', '%s', 5)", $edit['title'], $edit['description']);
$link_path .= db_last_insert_id('aggregator_category', 'cid');
$op = 'insert';
}
}
if (isset($op)) {
menu_link_maintain('aggregator', $op, $link_path, $edit['title']);
}
}