Code Duplication    Length = 33-35 lines in 2 locations

admin/category.php 1 location

@@ 297-329 (lines=33) @@
294
        redirect_header($redirect_to, 2, $redirect_msg);
295
        break;
296
297
    case 'del':
298
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
299
300
        $module_id    = $xoopsModule->getVar('mid');
301
        $gpermHandler = xoops_getHandler('groupperm');
302
303
        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
304
        $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
305
306
        $categoryObj = new Smartfaq\Category($categoryid);
307
308
        $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
309
        $name    = isset($_POST['name']) ? $_POST['name'] : '';
310
311
        if ($confirm) {
312
            if (!$categoryHandler->delete($categoryObj)) {
313
                redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR);
314
            }
315
            redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
316
        } else {
317
            // no confirm: show deletion condition
318
            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
319
            xoops_cp_header();
320
            xoops_confirm([
321
                              'op'         => 'del',
322
                              'categoryid' => $categoryObj->categoryid(),
323
                              'confirm'    => 1,
324
                              'name'       => $categoryObj->name()
325
                          ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
326
            xoops_cp_footer();
327
        }
328
        exit();
329
        break;
330
331
    case 'cancel':
332
        redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, ''));

admin/question.php 1 location

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