Code Duplication    Length = 12-13 lines in 2 locations

admin/actions/categories.php 1 location

@@ 206-217 (lines=12) @@
203
        // ****************************************************************************************************************
204
        xoops_cp_header();
205
        $id = isset($_POST['cat_cid']) ? (int)$_POST['cat_cid'] : 0;
206
        if (!empty($id)) {
207
            $edit = true;
208
            $item = $h_oledrion_cat->get($id);
209
            if (!is_object($item)) {
210
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
211
            }
212
            $item->unsetNew();
213
            $add = false;
214
        } else {
215
            $item = $h_oledrion_cat->create(true);
216
            $add  = true;
217
        }
218
        $opRedirect = 'categories';
219
        $item->setVars($_POST);
220

admin/actions/products.php 1 location

@@ 715-727 (lines=13) @@
712
        // ****************************************************************************************************************
713
        xoops_cp_header();
714
        $id = isset($_POST['product_id']) ? (int)$_POST['product_id'] : 0;
715
        if ($id > 0) {
716
            $edit = true;
717
            $item = $h_oledrion_products->get($id);
718
            if (!is_object($item)) {
719
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
720
            }
721
            $item->unsetNew();
722
            $add = false;
723
        } else {
724
            $item = $h_oledrion_products->create(true);
725
            $edit = false;
726
            $add  = true;
727
        }
728
        $opRedirect = 'products';
729
        $item->setVars($_POST);
730
        $item->setVar('product_submitted', strtotime($_POST['product_submitted']));