aggregator_save_category
modules/aggregator/aggregator.module, строка 373
- Версии
- 5 – 6
aggregator_save_category($edit)
Добавление/редактирование/удаление категорий агрегатора.
Параметры
$edit
Ассоциативный массив, определяющий категорию для добавления/редактирования/удаления.
Код
<?php
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']);
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии