function removeCategory($categoryid) { global $db; $tbl_cat = MYSQL_TABLE_PREFIX . 'media_categories'; $cid = (int) $categoryid; $sql = "SELECT * FROM `" . $tbl_cat . "` WHERE `parentid`=" . $cid . ";"; $result = $db->query($sql); while ($row = mysql_fetch_assoc($result)) { removeCategory($row['categoryid']); } $sql = "DELETE FROM `" . $tbl_cat . "` WHERE `categoryid`=" . $cid . " LIMIT 1;"; $db->query($sql); $db->delete('media_categories_permissions', '`categoryid`=' . $cid); }
function delete_all() { global $wpdb; $ids = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'spidercatalog_product_categories'); foreach ($ids as $id) { if (isset($_POST['check_' . $id])) { removeCategory($id); } } return true; }
@addDownload($categoryid, $_POST['name'], $_POST['description'], $_POST['path'], $_POST['version'], $_POST['release_notes'], $_POST['thumbnail'], $_POST['disable']); redirect(makeURL($mod, array('categoryid' => $categoryid))); } } } else { $breadcrumbs->addElement($lang->get('adddownload'), makeURL($mod, array('categoryid' => $categoryid, 'mode' => 'adddownload'))); $smarty->assign('files', listAvailableDownloads()); $smarty->assign('path', $template_dir . "/adddownload.tpl"); $smarty->assign('dir', $download_dir); } break; } case 'removecategory': if ($isallowed && $mode == 'removecategory') { if (isset($_POST['yes'])) { removeCategory($categoryid); $categoryid = $category['parentid']; } else { $breadcrumbs->addElement($lang->get('removecategory'), makeURL($mod, array('mode' => 'removecategory'))); $smarty->assign('path', $template_dir . "/removecategory.tpl"); $smarty->assign('url_no', makeURL($mod, array('categoryid' => $categoryid))); break; } } case 'editcategory': if ($isallowed && $mode == 'editcategory') { $smarty->assign('languages', $lang->listLanguages()); $grouplist = $rights->getAllGroups(); $smarty->assign('groups', $grouplist); if (isset($_POST['save'])) { $assigned_groups = array();
case 'addCategory': addCategory(); break; //send a post to the EditCategories.php //send a post to the EditCategories.php case 'listCategories': listCategories($r); break; case 'getCategoryList': getCategoryList($r); break; case 'changeCategory': changeCategory($q[1]); break; case 'removeCategory': removeCategory($r); break; case 'getCategory': getCategory(intval($r), $s); break; case 'getProduct': getProduct(intval($r), $s); break; case 'addProduct': addProduct(intval($r)); break; case 'removeProduct': removeProduct(intval($r)); break; case 'addDosage': addDosage(intval($r));
<?php chdir("../../database"); require_once "store_backoffice.php"; if (isset($_GET["storeId"]) and isset($_GET["category"]) and strlen($_GET["category"]) > 0) { $checkExists = checkCategory($_GET["category"], $_GET["storeId"]); if (!isset($checkExists[0]["id"])) { echo json_encode(array("result" => "category dont exists")); } else { removeCategory($checkExists[0]["id"]); echo json_encode(array("result" => "ok")); } } else { echo json_encode(array("result" => "missingParams")); }
function Categories_Spider_Catalog() { ////////including functions for categories require_once "Categories.php"; require_once "Categories.html.php"; if (!function_exists('print_html_nav')) { require_once "nav_function/nav_html_func.php"; } if (isset($_GET["task"])) { $task = $_GET["task"]; } else { $task = ''; } if (isset($_GET["id"])) { $id = $_GET["id"]; } else { $id = 0; } global $wpdb; switch ($task) { case 'add_cat': add_category(); break; case 'publish_cat': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } change_cat($id); showCategory(); break; case 'publish': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); publish_all(TRUE); showCategory(); break; case 'unpublish_cat': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } change_cat($id); showCategory(); break; case 'unpublish': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); publish_all(FALSE); showCategory(); break; case 'edit_cat': if ($id) { editCategory($id); } else { $id = $wpdb->get_var("SELECT MAX( id ) FROM " . $wpdb->prefix . "spidercatalog_product_categories"); editCategory($id); } break; case 'save': if ($id) { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); apply_cat($id); } else { save_cat(); check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); } showCategory(); break; case 'apply': if ($id) { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); apply_cat($id); editCategory($id); } else { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); $true = save_cat(); if ($true) { $id = $wpdb->get_var("SELECT MAX( id ) FROM " . $wpdb->prefix . "spidercatalog_product_categories"); editCategory($id); } else { ?> <h1>Database Error Please install plugin again</h1><?php showCategory(); } } break; case 'remove_cat': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } removeCategory($id); showCategory(); break; case 'delete': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); delete_all(); showCategory(); break; default: showCategory(); break; } }