Code Duplication    Length = 27-27 lines in 2 locations

admin/maintenance.php 2 locations

@@ 364-390 (lines=27) @@
361
                }
362
            }
363
364
            if (count($errors) > 0) {
365
                foreach ($errors as $error) {
366
                    $protocolObj = $helper->getHandler('Protocol')->create();
367
                    $protocolObj->setVar('protocol_letter_id', 0);
368
                    $protocolObj->setVar('protocol_subscriber_id', 0);
369
                    $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' ml] ' . $error);
370
                    $protocolObj->setVar('protocol_success', false);
371
                    $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
372
                    $protocolObj->setVar('protocol_created', time());
373
                    if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
374
                        echo _AM_XNEWSLETTER_MAINTENANCE_ERROR;
375
                    }
376
                }
377
            } else {
378
                $protocolObj = $helper->getHandler('Protocol')->create();
379
                $protocolObj->setVar('protocol_letter_id', 0);
380
                $protocolObj->setVar('protocol_subscriber_id', 0);
381
                $status = 0 == $number_ids ? _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_NODATA : sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_OK, $number_ids);
382
                $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' ml] ' . $status);
383
                $protocolObj->setVar('protocol_success', true);
384
                $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
385
                $protocolObj->setVar('protocol_created', time());
386
387
                if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
388
                    echo _AM_XNEWSLETTER_MAINTENANCE_ERROR;
389
                }
390
            }
391
            redirect_header($currentFile, 3, sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML_OK, $number_ids));
392
        } else {
393
            xoops_confirm(['ok' => true, 'op' => 'del_invalid_ml'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_ML);
@@ 433-459 (lines=27) @@
430
                }
431
            }
432
433
            if (count($errors) > 0) {
434
                foreach ($errors as $error) {
435
                    $protocolObj = $helper->getHandler('Protocol')->create();
436
                    $protocolObj->setVar('protocol_letter_id', 0);
437
                    $protocolObj->setVar('protocol_subscriber_id', 0);
438
                    $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' cat] ' . $error);
439
                    $protocolObj->setVar('protocol_success', false);
440
                    $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
441
                    $protocolObj->setVar('protocol_created', time());
442
                    if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
443
                        echo _AM_XNEWSLETTER_MAINTENANCE_ERROR;
444
                    }
445
                }
446
            } else {
447
                $protocolObj = $helper->getHandler('Protocol')->create();
448
                $protocolObj->setVar('protocol_letter_id', 0);
449
                $protocolObj->setVar('protocol_subscriber_id', 0);
450
                $status = 0 == $update ? _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_NODATA : sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_OK, $update);
451
                $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' cat] ' . $status);
452
                $protocolObj->setVar('protocol_success', true);
453
                $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
454
                $protocolObj->setVar('protocol_created', time());
455
456
                if (!$helper->getHandler('Protocol')->insert($protocolObj)) {
457
                    echo _AM_XNEWSLETTER_MAINTENANCE_ERROR;
458
                }
459
            }
460
            redirect_header($currentFile, 3, sprintf(_AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL_OK, $number_ids));
461
        } else {
462
            xoops_confirm(['ok' => true, 'op' => 'del_invalid_cat'], $currentFile, _AM_XNEWSLETTER_MAINTENANCE_DELETE_INVALID_CATNL);