Code Duplication    Length = 28-30 lines in 3 locations

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(
287
                              'op'      => 'del',
288
                              'faqid'   => $faqObj->faqid(),
289
                              'confirm' => 1,
290
                              'name'    => $faqObj->question()
291
                          ), 'question.php', _AM_SF_DELETETHISQUESTION . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE);
292
            xoops_cp_footer();
293
        }
294

admin/category.php 1 location

@@ 311-338 (lines=28) @@
308
        redirect_header($redirect_to, 2, $redirect_msg);
309
        break;
310
311
    case 'del':
312
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
313
314
        $module_id    = $xoopsModule->getVar('mid');
315
        $gpermHandler = xoops_getHandler('groupperm');
316
317
        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
318
        $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
319
320
        $categoryObj = new sfCategory($categoryid);
321
322
        $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
323
        $name    = isset($_POST['name']) ? $_POST['name'] : '';
324
325
        if ($confirm) {
326
            if (!$categoryHandler->delete($categoryObj)) {
327
                redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR);
328
            }
329
            redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
330
        } else {
331
            // no confirm: show deletion condition
332
            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
333
            xoops_cp_header();
334
            xoops_confirm(array(
335
                              'op'         => 'del',
336
                              'categoryid' => $categoryObj->categoryid(),
337
                              'confirm'    => 1,
338
                              'name'       => $categoryObj->name()
339
                          ), 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
340
            xoops_cp_footer();
341
        }

admin/faq.php 1 location

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