Code Duplication    Length = 16-16 lines in 2 locations

class/db.php 1 location

@@ 439-454 (lines=16) @@
436
     * @param int $friend
437
     * @return void
438
     */
439
    public function SetFriendshitStat($stat, $myUid, $friend)
440
    {
441
        global $xoopsDB;
442
        if (1 == $stat) {
443
            $sql    = 'UPDATE ' . $xoopsDB->prefix('smallworld_friends') . " SET status = '2' WHERE `me` = '" . $friend . "' AND `you` = '" . $myUid . "'";
444
            $result = $xoopsDB->queryF($sql);
445
            $query  = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_friends') . " (id,me,you,status,date) VALUES ('', '" . $myUid . "', '" . $friend . "', '2', UNIX_TIMESTAMP())";
446
            $result = $xoopsDB->queryF($query);
447
        }
448
        if ($stat < 0) {
449
            $sql     = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$friend . "' AND you = '" . (int)$myUid . "'";
450
            $sql2    = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE you = '" . (int)$friend . "' AND me = '" . (int)$myUid . "'";
451
            $result  = $xoopsDB->queryF($sql);
452
            $result2 = $xoopsDB->queryF($sql2);
453
        }
454
    }
455
456
    /**
457
     * deleteWallMsg function

class/SmallWorldDB.php 1 location

@@ 442-457 (lines=16) @@
439
     * @param int $friend
440
     * @return void
441
     */
442
    public function SetFriendshitStat($stat, $myUid, $friend)
443
    {
444
        global $xoopsDB;
445
        if (1 == $stat) {
446
            $sql    = 'UPDATE ' . $xoopsDB->prefix('smallworld_friends') . " SET status = '2' WHERE `me` = '" . $friend . "' AND `you` = '" . $myUid . "'";
447
            $result = $xoopsDB->queryF($sql);
448
            $query  = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_friends') . " (me,you,status,date) VALUES ('" . $myUid . "', '" . $friend . "', '2', UNIX_TIMESTAMP())";
449
            $result = $xoopsDB->queryF($query);
450
        }
451
        if ($stat < 0) {
452
            $sql     = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$friend . "' AND you = '" . (int)$myUid . "'";
453
            $sql2    = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE you = '" . (int)$friend . "' AND me = '" . (int)$myUid . "'";
454
            $result  = $xoopsDB->queryF($sql);
455
            $result2 = $xoopsDB->queryF($sql2);
456
        }
457
    }
458
459
    /**
460
     * deleteWallMsg function