Exemple #1
0
    print_table_header(construct_phrase($vbphrase['dl2_category_removal'], htmlspecialchars_uni($cat['name'])));
    print_description_row(construct_phrase($vbphrase['dl2_category_removal_confirmation'], htmlspecialchars_uni($cat['name'])));
    print_select_row($vbphrase['dl2_category_removal_delete_or_move'], 'destination', $categories);
    print_submit_row($vbphrase['yes'], 0, 2, $vbphrase['no']);
    print_cp_footer();
}
// ###################### Do Delete Cat #######################
if ($_GET['do'] == "dodelcat") {
    $vbulletin->input->clean_array_gpc('p', array('delete' => TYPE_UINT, 'destination' => TYPE_UINT));
    if (empty($vbulletin->GPC['delete'])) {
        print_stop_message('please_complete_required_fields');
    } else {
        if ($vbulletin->GPC['delete'] == $vbulletin->GPC['destination']) {
            print_stop_message('dl2_error_cant_move_into_self');
        } else {
            if (!$dl->validate_move($vbulletin->GPC['delete'], $vbulletin->GPC['destination'])) {
                print_stop_message('dl2_error_cannot_move_into_subcat');
            } else {
                $cat = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "dl2_categories WHERE id = " . $vbulletin->GPC['delete']);
                $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_categories WHERE id = " . $vbulletin->GPC['delete']);
                if ($db->affected_rows() > 0) {
                    if ($vbulletin->GPC['destination'] == 0) {
                        $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_categories WHERE parent = " . $vbulletin->GPC['delete']);
                    } else {
                        $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_categories SET parent = " . $vbulletin->GPC['destination'] . " WHERE parent = " . $vbulletin->GPC['delete']);
                    }
                    $dl->modify_subcount($cat['parent'], -$db->affected_rows() + $cat['subs']);
                    $dl->modify_subcount($vbulletin->GPC['destination'], $db->affected_rows() + $cat['subs']);
                    if ($vbulletin->GPC['destination'] == 0) {
                        $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_files WHERE category = " . $vbulletin->GPC['delete']);
                    } else {
Exemple #2
0
    }
}
// ########################################################
// #################### Do Delete Cat #####################
// ########################################################
if ($_POST['do'] == "dodelcat") {
    if (!$_POST['confirm']) {
        print_stop_message('ecdownloads_did_not_confirm');
    } else {
        if ($_POST['delete'] == '' or $_POST['delete'] == 0) {
            print_stop_message('ecdownloads_cant_delete_air');
        } else {
            if ($_POST['delete'] == $_POST['destination']) {
                print_stop_message('ecdownloads_cant_move_into_self');
            } else {
                if (!$dl->validate_move($_POST['delete'], $_POST['destination'])) {
                    print_stop_message('ecdownloads_cant_move_into_subcat');
                } else {
                    $cat = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "dl_cats WHERE `id`=" . $db->sql_prepare($_POST['delete']));
                    $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_cats WHERE `id`=" . $db->sql_prepare($_POST['delete']));
                    if ($db->affected_rows() > 0) {
                        if ($_POST['destination'] == 0) {
                            $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_cats WHERE `parent`=" . $db->sql_prepare($_POST['delete']));
                        } else {
                            $db->query_write("UPDATE " . TABLE_PREFIX . "dl_cats SET `parent`=" . $db->sql_prepare($_POST['destination']) . " WHERE `parent`=" . $db->sql_prepare($_POST['delete']));
                        }
                        $dl->modify_subcount($cat['parent'], -$db->affected_rows() + $cat['subs']);
                        $dl->modify_subcount($_POST['destination'], $db->affected_rows() + $cat['subs']);
                        if ($_POST['destination'] == 0) {
                            $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_files WHERE `category`=" . $db->sql_prepare($_POST['delete']));
                        } else {