Code Duplication    Length = 14-14 lines in 2 locations

class/PublicWallUpdates.php 1 location

@@ 260-273 (lines=14) @@
257
     * @param int    $msgid
258
     * @return int
259
     */
260
    public function hasVoted($userid, $type, $comid, $msgid)
261
    {
262
        global $xoopsUser, $xoopsDB;
263
        if ('msg' === $type) {
264
            $sql    = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'";
265
            $result = $xoopsDB->queryF($sql);
266
            $i      = $xoopsDB->getRowsNum($result);
267
        } else {
268
            $sql    = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" . $comid . "' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'";
269
            $result = $xoopsDB->queryF($sql);
270
            $i      = $xoopsDB->getRowsNum($result);
271
        }
272
273
        return $i;
274
    }
275
276
    /**

class/WallUpdates.php 1 location

@@ 325-338 (lines=14) @@
322
     * @param int    $msgid
323
     * @return int
324
     */
325
    public function hasVoted($userid, $type, $comid, $msgid)
326
    {
327
        global $xoopsUser, $xoopsDB;
328
        if ('msg' === $type) {
329
            $sql    = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'";
330
            $result = $xoopsDB->queryF($sql);
331
            $i      = $xoopsDB->getRowsNum($result);
332
        } else {
333
            $sql    = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" . $comid . "' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'";
334
            $result = $xoopsDB->queryF($sql);
335
            $i      = $xoopsDB->getRowsNum($result);
336
        }
337
338
        return $i;
339
    }
340
341
    /**