Example #1
0
        }
        $cache->updateIndexCache();
        if (!$res) {
            flash("action_failed");
        } else {
            flash("success");
        }
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $result = $brand->del(intval($id), "member_id=" . $_SESSION['MemberID']);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $brand_info = $pdb->GetRow("SELECT * FROM {$tb_prefix}brands WHERE member_id=" . $_SESSION['MemberID'] . " AND id={$id}");
            if (!empty($brand_info['picture'])) {
                $brand_info['image'] = pb_get_attachmenturl($brand_info['picture'], "../");
            }
            setvar("item", $brand_info);
        }
        setvar("BrandtypeOptions", $brandtypes->getTypeOptions());
        $tpl_file = "brand_edit";
        template($tpl_file);
        exit;
    }
}
Example #2
0
setvar("AskAction", $typeoption->get_cache_type("common_option"));
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    $action = trim($_GET['action']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "search") {
        if (isset($_GET['q'])) {
            $conditions[] = "Brand.name like '%" . trim($_GET['q']) . "%'";
        }
    }
    if ($do == "del" && !empty($id)) {
        $sql = "SELECT picture FROM {$tb_prefix}brands WHERE id=" . $id;
        $attach_filename = $pdb->GetOne($sql);
        $brand->del($_GET['id']);
        $attachment->deleteBySource($attach_filename);
    }
    if ($do == "edit") {
        $brand_info = null;
        if (!empty($id)) {
            $item_info = $brand->getInfo($id);
            if ($item_info['picture']) {
                $item_info['image'] = pb_get_attachmenturl($item_info['picture'], "../", 'small');
            }
        }
        if (!empty($item_info)) {
            setvar("item", $item_info);
        }
        setvar("BrandtypeOptions", $brandtypes->getTypeOptions());
        $tpl_file = "brand.edit";
Example #3
0
        }
        $cache->updateIndexCache();
        if (!$res) {
            flash("action_failed");
        } else {
            flash("success");
        }
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $result = $brand->del(intval($id), "member_id=" . $the_memberid);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $brand_info = $pdb->GetRow("SELECT * FROM {$tb_prefix}brands WHERE member_id=" . $the_memberid . " AND id={$id}");
            if (!empty($brand_info['picture'])) {
                $brand_info['image'] = pb_get_attachmenturl($brand_info['picture'], "../");
            }
            setvar("item", $brand_info);
        }
        setvar("BrandtypeOptions", $brandtypes->getTypeOptions());
        $tpl_file = "brand_edit";
        template($tpl_file);
        exit;
    }
}