Code Duplication    Length = 14-14 lines in 2 locations

class/db.php 1 location

@@ 627-640 (lines=14) @@
624
     * @param string posts (serialized values)
625
     * @return void
626
     */
627
    public function saveSettings($id, $posts)
628
    {
629
        global $xoopsDB;
630
        $sql    = 'SELECT value FROM ' . $xoopsDB->prefix('smallworld_settings') . ' WHERE userid = ' . (int)$id . '';
631
        $result = $xoopsDB->queryF($sql);
632
        $i      = $xoopsDB->getRowsNum($result);
633
        if ($i > 0) {
634
            $sql = 'UPDATE ' . $xoopsDB->prefix('smallworld_settings') . " SET value = '" . $posts . "' WHERE userid = " . (int)$id . '';
635
        } else {
636
            $sql = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_settings') . " (id,userid,value) VALUES ('', '" . $id . "', '" . $posts . "')";
637
        }
638
        $result = $xoopsDB->queryF($sql);
639
        $this->GetSettings($id);
640
    }
641
642
    /**
643
     * Retrieve private settings

class/SmallWorldDB.php 1 location

@@ 630-643 (lines=14) @@
627
     * @param string posts (serialized values)
628
     * @return void
629
     */
630
    public function saveSettings($id, $posts)
631
    {
632
        global $xoopsDB;
633
        $sql    = 'SELECT value FROM ' . $xoopsDB->prefix('smallworld_settings') . ' WHERE userid = ' . (int)$id . '';
634
        $result = $xoopsDB->queryF($sql);
635
        $i      = $xoopsDB->getRowsNum($result);
636
        if ($i > 0) {
637
            $sql = 'UPDATE ' . $xoopsDB->prefix('smallworld_settings') . " SET value = '" . $posts . "' WHERE userid = " . (int)$id . '';
638
        } else {
639
            $sql = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_settings') . " (userid,value) VALUES ('" . $id . "', '" . $posts . "')";
640
        }
641
        $result = $xoopsDB->queryF($sql);
642
        $this->GetSettings($id);
643
    }
644
645
    /**
646
     * Retrieve private settings