Code Duplication    Length = 27-27 lines in 2 locations

admin/maintenance.php 2 locations

@@ 450-476 (lines=27) @@
447
                }
448
            }
449
450
            if (count($errors) > 0) {
451
                foreach ($errors as $error) {
452
                    $protocolObj = $helper->getHandler('Protocol')->create();
453
                    $protocolObj->setVar('protocol_letter_id', 0);
454
                    $protocolObj->setVar('protocol_subscriber_id', 0);
455
                    $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' ml] ' . $error);
456
                    $protocolObj->setVar('protocol_success', false);
457
                    $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
458
                    $protocolObj->setVar('protocol_created', time());
459
                    if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
460
                        $GLOBALS['xoopsTpl']->assign('error', _AM_XNEWSLETTER_MAINTENANCE_ERROR);
461
                    }
462
                }
463
            } else {
464
                $protocolObj = $helper->getHandler('Protocol')->create();
465
                $protocolObj->setVar('protocol_letter_id', 0);
466
                $protocolObj->setVar('protocol_subscriber_id', 0);
467
                $status = 0 == $number_ids ? _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_NODATA : sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_OK, $number_ids);
468
                $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' ml] ' . $status);
469
                $protocolObj->setVar('protocol_success', true);
470
                $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
471
                $protocolObj->setVar('protocol_created', time());
472
473
                if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
474
                    $GLOBALS['xoopsTpl']->assign('error', _AM_XNEWSLETTER_MAINTENANCE_ERROR);
475
                }
476
            }
477
            redirect_header($currentFile, 3, sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_OK, $number_ids));
478
        } else {
479
            xoops_confirm(['ok' => true, 'op' => 'del_invalid_ml'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML);
@@ 519-545 (lines=27) @@
516
                }
517
            }
518
519
            if (count($errors) > 0) {
520
                foreach ($errors as $error) {
521
                    $protocolObj = $helper->getHandler('Protocol')->create();
522
                    $protocolObj->setVar('protocol_letter_id', 0);
523
                    $protocolObj->setVar('protocol_subscriber_id', 0);
524
                    $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' cat] ' . $error);
525
                    $protocolObj->setVar('protocol_success', false);
526
                    $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
527
                    $protocolObj->setVar('protocol_created', time());
528
                    if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
529
                        $GLOBALS['xoopsTpl']->assign('error', _AM_XNEWSLETTER_MAINTENANCE_ERROR);
530
                    }
531
                }
532
            } else {
533
                $protocolObj = $helper->getHandler('Protocol')->create();
534
                $protocolObj->setVar('protocol_letter_id', 0);
535
                $protocolObj->setVar('protocol_subscriber_id', 0);
536
                $status = 0 == $update ? _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_NODATA : sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_OK, $update);
537
                $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' cat] ' . $status);
538
                $protocolObj->setVar('protocol_success', true);
539
                $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
540
                $protocolObj->setVar('protocol_created', time());
541
542
                if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
543
                    $GLOBALS['xoopsTpl']->assign('error', _AM_XNEWSLETTER_MAINTENANCE_ERROR);
544
                }
545
            }
546
            redirect_header($currentFile, 3, sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_OK, $number_ids));
547
        } else {
548
            xoops_confirm(['ok' => true, 'op' => 'del_invalid_cat'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL);