Code Duplication    Length = 17-17 lines in 2 locations

class/db.php 1 location

@@ 390-406 (lines=17) @@
387
     * @param int $userid
388
     * @return void
389
     */
390
    public function toogleFriendInvite($status, $friendid, $userid)
391
    {
392
        global $xoopsDB;
393
        if (0 == $status) {
394
            $sql    = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_friends') . " (id,me,you,status,date) VALUES ('', '" . $userid . "', '" . $friendid . "', '1', UNIX_TIMESTAMP())";
395
            $result = $xoopsDB->queryF($sql);
396
        }
397
        if ($status > 0) {
398
            $sql     = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$friendid . "' AND you = '" . (int)$userid . "'";
399
            $sql2    = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$userid . "' AND you = '" . (int)$friendid . "'";
400
            $result  = $xoopsDB->queryF($sql);
401
            $result2 = $xoopsDB->queryF($sql2);
402
403
            // Since friendship is canceled also following is deleted
404
            $this->toogleFollow(1, $userid, $friendid);
405
        }
406
    }
407
408
    /**
409
     * toogleFollow function

class/SmallWorldDB.php 1 location

@@ 393-409 (lines=17) @@
390
     * @param int $userid
391
     * @return void
392
     */
393
    public function toogleFriendInvite($status, $friendid, $userid)
394
    {
395
        global $xoopsDB;
396
        if (0 == $status) {
397
            $sql    = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_friends') . " (me,you,status,date) VALUES ('" . $userid . "', '" . $friendid . "', '1', UNIX_TIMESTAMP())";
398
            $result = $xoopsDB->queryF($sql);
399
        }
400
        if ($status > 0) {
401
            $sql     = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$friendid . "' AND you = '" . (int)$userid . "'";
402
            $sql2    = 'DELETE FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . (int)$userid . "' AND you = '" . (int)$friendid . "'";
403
            $result  = $xoopsDB->queryF($sql);
404
            $result2 = $xoopsDB->queryF($sql2);
405
406
            // Since friendship is canceled also following is deleted
407
            $this->toogleFollow(1, $userid, $friendid);
408
        }
409
    }
410
411
    /**
412
     * toogleFollow function