--------------------- | index.php | ======================================== | Manage Categories +-------------------------------------------------------------------------- */ include("../../includes/ini.inc.php"); include("../../includes/global.inc.php"); require_once("../../classes/db.inc.php"); $db = new db(); include_once("../../includes/functions.inc.php"); $config = fetchDbConfig("config"); include_once("../../language/".$config['defaultLang']."/lang.inc.php"); $enableSSl = 1; include("../../includes/sslSwitch.inc.php"); include("../includes/auth.inc.php"); if(permission("categories","read")==FALSE){ header("Location: ".$GLOBALS['rootRel']."admin/401.php"); exit; } $catsPerPage = 25; if(isset($_GET["delete"]) && $_GET["delete"]>0){ // delete index $where = "cat_id=".$db->mySQLSafe($_GET["delete"]); $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); // delete category $where = "cat_id=".$db->mySQLSafe($_GET["delete"]); $delete = $db->delete($glob['dbprefix']."CubeCart_category", $where); if($delete == TRUE){ $msg = "
".$lang['admin']['categories']['delete_success']."
"; } else { $msg = "".$lang['admin']['categories']['delete_failed']."
"; } } elseif(isset($_POST['cat_id'])) { $record["cat_name"] = $db->mySQLSafe($_POST['cat_name']); $record["cat_father_id"] = $db->mySQLSafe($_POST['cat_father_id']); $record["cat_image"] = $db->mySQLSafe($_POST['imageName']); $record["per_ship"] = $db->mySQLSafe($_POST['per_ship']); $record["item_ship"] = $db->mySQLSafe($_POST['item_ship']); $record["item_int_ship"] = $db->mySQLSafe($_POST['item_int_ship']); $record["per_int_ship"] = $db->mySQLSafe($_POST['per_int_ship']); if($_POST['cat_id']>0) { // update product count. This is gona be tricky!!! if($_POST['oldFatherId']!==$_POST['cat_father_id'] && $_POST['noProducts']>0) { // change old count $db->categoryNos($_POST['oldFatherId'], "-", $_POST['noProducts']); // update n