redirect(url('admin_download_cat.php'));
} elseif ($cat_to_del > 0) {
    $Template->set_filenames(array('admin_download_cat_remove' => 'download/admin_download_cat_remove.tpl'));
    $Template->assign_vars(array('CATEGORY_TREE' => $download_categories->build_select_form(0, 'id_parent', 'id_parent', $cat_to_del), 'IDCAT' => $cat_to_del, 'L_REMOVING_CATEGORY' => $DOWNLOAD_LANG['removing_category'], 'L_EXPLAIN_REMOVING' => $DOWNLOAD_LANG['explain_removing_category'], 'L_DELETE_CATEGORY_AND_CONTENT' => $DOWNLOAD_LANG['delete_category_and_its_content'], 'L_MOVE_CONTENT' => $DOWNLOAD_LANG['move_category_content'], 'L_SUBMIT' => $LANG['delete'], 'U_FORM_TARGET' => HOST . DIR . url('/download/admin_download_cat.php?token=' . $Session->get_token())));
    include_once 'admin_download_menu.php';
    $Template->pparse('admin_download_cat_remove');
} elseif (retrieve(POST, 'submit', false)) {
    $error_string = 'e_success';
    if ($cat_to_del_post > 0) {
        $action = retrieve(POST, 'action', '');
        $delete_content = $action != 'move';
        $id_parent = retrieve(POST, 'id_parent', 0);
        if ($delete_content) {
            $download_categories->Delete_category_recursively($cat_to_del_post);
        } else {
            $download_categories->Delete_category_and_move_content($cat_to_del_post, $id_parent);
        }
        import('content/syndication/feed');
        Feed::clear_cache('download');
    } else {
        $id_cat = retrieve(POST, 'idcat', 0);
        $id_parent = retrieve(POST, 'id_parent', 0);
        $name = retrieve(POST, 'name', '');
        $description = retrieve(POST, 'description', '', TSTRING_PARSE);
        $icon = retrieve(POST, 'image', '');
        $icon_path = retrieve(POST, 'alt_image', '');
        $visible = retrieve(POST, 'visible_cat', false);
        $secure = retrieve(POST, 'secure', -1);
        if (!empty($icon_path)) {
            $icon = $icon_path;
        }