Code Duplication    Length = 28-30 lines in 3 locations

admin/category.php 1 location

@@ 281-308 (lines=28) @@
278
        redirect_header($redirect_to, 2, $redirect_msg);
279
        break;
280
281
    case 'del':
282
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
283
284
        $module_id    = $xoopsModule->getVar('mid');
285
        $gpermHandler = xoops_getHandler('groupperm');
286
287
        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
288
        $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
289
290
        $categoryObj = new sfCategory($categoryid);
291
292
        $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
293
        $name    = isset($_POST['name']) ? $_POST['name'] : '';
294
295
        if ($confirm) {
296
            if (!$categoryHandler->delete($categoryObj)) {
297
                redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR);
298
            }
299
            redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
300
        } else {
301
            // no confirm: show deletion condition
302
            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
303
            xoops_cp_header();
304
            xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br /> <br />" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
305
            xoops_cp_footer();
306
        }
307
        exit();
308
        break;
309
310
    case 'cancel':
311
        redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, ''));

admin/faq.php 1 location

@@ 525-554 (lines=30) @@
522
        redirect_header('faq.php', 2, $redirect_msg);
523
        break;
524
525
    case 'del':
526
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
527
528
        $module_id    = $xoopsModule->getVar('mid');
529
        $gpermHandler = xoops_getHandler('groupperm');
530
531
        $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0;
532
        $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : $faqid;
533
534
        $faqObj = new sfFaq($faqid);
535
536
        $confirm  = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
537
        $question = isset($_POST['question']) ? $_POST['question'] : '';
538
539
        if ($confirm) {
540
            if (!$faqHandler->delete($faqObj)) {
541
                redirect_header('faq.php', 2, _AM_SF_FAQ_DELETE_ERROR . sf_formatErrors($faqObj->getErrors()));
542
            }
543
544
            redirect_header('faq.php', 2, sprintf(_AM_SF_ARTISDELETED, $faqObj->question()));
545
        } else {
546
            // no confirm: show deletion condition
547
            $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
548
            xoops_cp_header();
549
            xoops_confirm(array('op' => 'del', 'faqid' => $faqObj->faqid(), 'confirm' => 1, 'name' => $faqObj->question()), 'faq.php', _AM_SF_DELETETHISARTICLE . " <br />'" . $faqObj->question() . "'. <br /> <br />", _AM_SF_DELETE);
550
            xoops_cp_footer();
551
        }
552
553
        exit();
554
        break;
555
556
    case 'default':
557
    default:

admin/question.php 1 location

@@ 262-291 (lines=30) @@
259
260
        break;
261
262
    case 'del':
263
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
264
265
        $module_id    = $xoopsModule->getVar('mid');
266
        $gpermHandler = xoops_getHandler('groupperm');
267
268
        $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0;
269
        $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : $faqid;
270
271
        $faqObj = new sfFaq($faqid);
272
273
        $confirm  = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
274
        $question = isset($_POST['question']) ? $_POST['question'] : '';
275
276
        if ($confirm) {
277
            if (!$faqHandler->delete($faqObj)) {
278
                redirect_header('question.php', 2, _AM_SF_FAQ_DELETE_ERROR);
279
            }
280
281
            redirect_header('question.php', 2, sprintf(_AM_SF_QUESTIONISDELETED, $faqObj->question()));
282
        } else {
283
            // no confirm: show deletion condition
284
            $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
285
            xoops_cp_header();
286
            xoops_confirm(array('op' => 'del', 'faqid' => $faqObj->faqid(), 'confirm' => 1, 'name' => $faqObj->question()), 'question.php', _AM_SF_DELETETHISQUESTION . " <br />'" . $faqObj->question() . "'. <br /> <br />", _AM_SF_DELETE);
287
            xoops_cp_footer();
288
        }
289
290
        exit();
291
        break;
292
293
    case 'default':
294
    default: