Code Duplication    Length = 3-4 lines in 8 locations

include/ratefile.inc.php 5 locations

@@ 64-66 (lines=3) @@
61
        if (!is_object($_categoryob)) {
62
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/index.php', 1, 'no column');
63
        }
64
        if ($_categoryob->getVar('author') === $ratinguser) {
65
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_CANTVOTEOWN);
66
        }
67
68
        //uid check
69
        //uid check
@@ 75-77 (lines=3) @@
72
        $criteria->add(new Criteria('ratinguser', $ratinguser));
73
        $ratinguservotecount = $entrydataHandler->getVotedataCount($criteria);
74
        unset($criteria);
75
        if ($ratinguservotecount > 0) {
76
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_VOTEONCE);
77
        }
78
    }
79
80
    // Check if ANONYMOUS user is trying to vote more than once per day.
@@ 91-93 (lines=3) @@
88
        $criteria->add(new Criteria('ratingtimestamp', $yesterday, '>'));
89
        $anonvotecount = $entrydataHandler->getVotedataCount($criteria);
90
        unset($criteria);
91
        if ($anonvotecount > 0) {
92
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_VOTEONCE);
93
        }
94
    }
95
96
    $_votedataob = $entrydataHandler->createVotedata(true);
@@ 104-106 (lines=3) @@
101
    $_votedataob->setVar('ratinghostname', $ip);
102
    $_votedataob->setVar('ratingtimestamp', time());
103
    // Save to database
104
    if (!$entrydataHandler->insertVotedata($_votedataob, true)) {
105
        redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_CANTVOTEOWN);
106
    }
107
108
    // All is well.  Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
109
    //    updaterating( $lid );
@@ 117-120 (lines=4) @@
114
        redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, $ratemessage);
115
    }
116
    //    exit();
117
} else {
118
    redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_UNKNOWNERROR);
119
    //    exit();
120
}
121

submit.php 3 locations

@@ 100-102 (lines=3) @@
97
            $_entryob->setVar('columnID', (int)$_POST['columnID']);
98
        }
99
        //get category object
100
        if (!isset($canEditCategoryobArray[$_entryob->getVar('columnID')])) {
101
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM);
102
        }
103
        $_categoryob = $canEditCategoryobArray[$_entryob->getVar('columnID')];
104
        //checkbox not post when value is false
105
        if ($thisgrouptype !== XOOPS_GROUP_ADMIN) {
@@ 175-178 (lines=4) @@
172
            $_entryob->setVar('teaser', xoops_substr($_entryob->getVar('bodytext', 'none'), 0, $charlength));
173
        }
174
        // Save to database
175
        if (!$entrydataHandler->insertArticle($_entryob)) {
176
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_SOAPBOX_ERRORSAVINGDB);
177
178
            break;
179
        }
180
        if ($thisgrouptype === XOOPS_GROUP_ANONYMOUS || $xoopsModuleConfig['autoapprove'] !== 1) {
181
            // Notify of to admin only for approve
@@ 208-210 (lines=3) @@
205
            }
206
            //get category object check
207
            //get category object
208
            if (!isset($canEditCategoryobArray[$_entryob->getVar('columnID')])) {
209
                redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_SOAPBOX_ERRORSAVINGDB);
210
            }
211
            $_categoryob = $canEditCategoryobArray[$_entryob->getVar('columnID')];
212
        } else {
213
            // there's no parameter, so we're adding an entry