Code Duplication    Length = 3-4 lines in 6 locations

include/ratefile.inc.php 3 locations

@@ 66-68 (lines=3) @@
63
        $criteria->add(new Criteria('ratinguser', $ratinguser));
64
        $ratinguservotecount =& $_entrydata_handler->getVotedataCount($criteria);
65
        unset($criteria);
66
        if ($ratinguservotecount > 0) {
67
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_VOTEONCE);
68
        }
69
    }
70
71
    // Check if ANONYMOUS user is trying to vote more than once per day.
@@ 82-84 (lines=3) @@
79
        $criteria->add(new Criteria('ratingtimestamp', $yesterday, '>'));
80
        $anonvotecount =& $_entrydata_handler->getVotedataCount($criteria);
81
        unset($criteria);
82
        if ($anonvotecount > 0) {
83
            redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_VOTEONCE);
84
        }
85
    }
86
87
    $_votedataob =& $_entrydata_handler->createVotedata(true);
@@ 95-97 (lines=3) @@
92
    $_votedataob->setVar('ratinghostname', $ip);
93
    $_votedataob->setVar('ratingtimestamp', time());
94
    // Save to database
95
    if (!$_entrydata_handler->insertVotedata($_votedataob, true)) {
96
        redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?articleID=' . $lid, 1, _MD_SOAPBOX_CANTVOTEOWN);
97
    }
98
99
    // All is well.  Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
100
    //    updaterating( $lid );

submit.php 3 locations

@@ 96-98 (lines=3) @@
93
            $_entryob->setVar('columnID', (int)($_POST['columnID']));
94
        }
95
			//get category object
96
			if (!isset($_can_edit_categoryob_arr[$_entryob->getVar('columnID')])) {
97
				redirect_header( XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/index.php', 2, _NOPERM );
98
			}
99
			$_categoryob =& $_can_edit_categoryob_arr[$_entryob->getVar('columnID')] ;
100
			//checkbox not post when value is false
101
			if ( $thisgrouptype != XOOPS_GROUP_ADMIN ) {
@@ 171-174 (lines=4) @@
168
			$_entryob->setVar('teaser' , xoops_substr($_entryob->getVar('bodytext' , 'none'), 0, $charlength) ) ;
169
		}
170
		// Save to database
171
		if (!$_entrydata_handler->insertArticle($_entryob)) {
172
			redirect_header( XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/index.php', 2, _MD_SOAPBOX_ERRORSAVINGDB );
173
			break;
174
		}
175
		if ( $xoopsModuleConfig['autoapprove'] != 1 ||  $thisgrouptype == XOOPS_GROUP_ANONYMOUS ) {
176
			// Notify of to admin only for approve
177
			$_entrydata_handler->newArticleTriggerEvent($_entryob , 'article_submit' ) ;
@@ 203-205 (lines=3) @@
200
			}
201
			//get category object check
202
			//get category object
203
			if (!isset($_can_edit_categoryob_arr[$_entryob->getVar('columnID')])) {
204
				redirect_header( XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/index.php', 2, _MD_SOAPBOX_ERRORSAVINGDB );
205
			}
206
			$_categoryob =& $_can_edit_categoryob_arr[$_entryob->getVar('columnID')] ;
207
		} else {
208
			 // there's no parameter, so we're adding an entry