Code Duplication    Length = 6-6 lines in 2 locations

ratenews.php 2 locations

@@ 141-146 (lines=6) @@
138
    // Check if News POSTER is voting (UNLESS Anonymous users allowed to post)
139
    if (0 != $ratinguser) {
140
        $result = $xoopsDB->query('SELECT uid FROM ' . $xoopsDB->prefix('news_stories') . " WHERE storyid=$storyid");
141
        while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) {
142
            if ($ratinguserDB == $ratinguser) {
143
                redirect_header(XOOPS_URL . '/modules/news/article.php?storyid=' . $storyid, 4, _NW_CANTVOTEOWN);
144
            }
145
        }
146
147
        // Check if REG user is trying to vote twice.
148
        $result = $xoopsDB->query('SELECT ratinguser FROM ' . $xoopsDB->prefix('news_stories_votedata') . " WHERE storyid=$storyid");
149
        while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) {
@@ 149-154 (lines=6) @@
146
147
        // Check if REG user is trying to vote twice.
148
        $result = $xoopsDB->query('SELECT ratinguser FROM ' . $xoopsDB->prefix('news_stories_votedata') . " WHERE storyid=$storyid");
149
        while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) {
150
            if ($ratinguserDB == $ratinguser) {
151
                redirect_header(XOOPS_URL . '/modules/news/article.php?storyid=' . $storyid, 4, _NW_VOTEONCE);
152
            }
153
        }
154
    } else {
155
        // Check if ANONYMOUS user is trying to vote more than once per day.
156
        $yesterday = (time() - (86400 * $anonwaitdays));
157
        $result    = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('news_stories_votedata') . " WHERE storyid=$storyid AND ratinguser=0 AND ratinghostname = '$ip'  AND ratingtimestamp > $yesterday");