function edit_news_delete() { cn_dsi_check(); if (!test('Nud')) { msg_info("Unable to delete news: no permission"); } $FlatDB = new FlatDB(); list($id, $source) = GET('id, source', 'GET'); $ida = db_index_load($source); $nloc = db_get_nloc($id); $db = db_news_load($nloc); // ------ $FlatDB->cn_remove_categories($db[$id]['c'], $db[$id]['id']); $FlatDB->cn_update_date(0, $db[$id]['id']); $FlatDB->cn_user_sync($db[$id]['u'], 0, $db[$id]['id']); $FlatDB->cn_remove_tags($db[$id]['tg'], $db[$id]['id']); // ------ unset($db[$id]); unset($ida[$id]); // Remove from meta-index $_ts_id = bt_get_id($id, 'nts_id'); bt_del_id($id, 'nts_id'); bt_del_id($_ts_id, 'nid_ts'); // Remove page alias $_ts_pg = bt_get_id($id, 'ts_pg'); bt_del_id($id, 'ts_pg'); bt_del_id($_ts_pg, 'pg_ts'); // save block db_save_news($db, $nloc); db_index_save($ida, $source); db_index_update_overall($source); cn_relocation(cn_url_modify(array('reset'), 'mod=editnews', "source={$source}")); $FlatDB->cache_clean(); }