Code Duplication    Length = 19-19 lines in 2 locations

admin/bmh.php 1 location

@@ 73-91 (lines=19) @@
70
            $catsubscrCriteria = new CriteriaCompo();
71
            $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $subscr_id));
72
            $catsubscrsCount = $xnewsletter->getHandler('catsubscr')->getCount($catsubscrCriteria);
73
            if ($catsubscrsCount > 0) {
74
                $catsubscrObjs = $xnewsletter->getHandler('catsubscr')->getAll($catsubscrCriteria);
75
                foreach ($catsubscrObjs as $catsubscr_id => $catsubscrObj) {
76
                    $catsubscrObj = $xnewsletter->getHandler('catsubscr')->get($catsubscrObj->getVar('catsubscr_id'));
77
                    $catObj = $xnewsletter->getHandler('cat')->get($catsubscrObj->getVar('catsubscr_catid'));
78
                    $cat_mailinglist = $catObj->getVar('cat_mailinglist');
79
80
                    if ($xnewsletter->getHandler('catsubscr')->delete($catsubscrObj, true)) {
81
                        //handle mailinglists
82
                        if ($cat_mailinglist > 0) {
83
                            require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
84
                            subscribingMLHandler(0, $subscr_id, $cat_mailinglist);
85
                        }
86
                    } else {
87
                        $actionprot_err .= $catsubscrObj->getHtmlErrors();
88
                        ++$count_err;
89
                    }
90
                }
91
            }
92
93
            if ($count_err == 0) {
94
                redirect_header("?op=handle_bmh&bmh_id={$bmh_id}&bmh_measure=" . _AM_XNEWSLETTER_BMH_MEASURE_VAL_DELETE . "&filter={$filter}", 3, _AM_XNEWSLETTER_FORMDELOK);

subscription.php 1 location

@@ 651-669 (lines=19) @@
648
                    $catsubscrCriteria = new CriteriaCompo();
649
                    $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $subscr_id));
650
                    $catsubscrCount = $xnewsletter->getHandler('catsubscr')->getCount($catsubscrCriteria);
651
                    if ($catsubscrCount > 0) {
652
                        $catsubscrObjs = $xnewsletter->getHandler('catsubscr')->getAll($catsubscrCriteria);
653
                        foreach (array_keys($catsubscrObjs) as $cat) {
654
                            $catsubscrObj = $xnewsletter->getHandler('catsubscr')->get($catsubscrObjs[$cat]->getVar('catsubscr_id'));
655
                            $catObj = $xnewsletter->getHandler('cat')->get($catsubscrObjs[$cat]->getVar('catsubscr_catid'));
656
                            $cat_mailinglist = $catObj->getVar('cat_mailinglist');
657
658
                            if ($xnewsletter->getHandler('catsubscr')->delete($catsubscrObj, true)) {
659
                                //handle mailinglists
660
                                if ($cat_mailinglist > 0) {
661
                                    require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
662
                                    subscribingMLHandler(0, $subscr_id, $cat_mailinglist);
663
                                }
664
                            } else {
665
                                $actionProts_error .= $catsubscrObj->getHtmlErrors();
666
                                $count_err++;
667
                            }
668
                        }
669
                    }
670
                } else {
671
                    redirect_header($currentFile, 2, _MA_XNEWSLETTER_SUBSCRIPTION_ERROR);
672
                }