Code Duplication    Length = 19-20 lines in 3 locations

class/class.coupon.php 1 location

@@ 97-115 (lines=19) @@
94
     * @return mixed reference to the <a href='psi_element://Coupon'>Coupon</a> object, FALSE if failed
95
     *                         object, FALSE if failed
96
     */
97
    public function &get($coupid = false)
98
    {
99
        if ($coupid === false) {
100
            return false;
101
        }
102
        $coupid = (int)$coupid;
103
        if ($coupid > 0) {
104
            $sql = 'SELECT * FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid=' . $coupid;
105
            if (!$result = $this->db->query($sql)) {
106
                return false;
107
            }
108
            $coupon =& $this->create(false);
109
            $coupon->assignVars($this->db->fetchArray($result));
110
111
            return $coupon;
112
        }
113
114
        return false;
115
    }
116
117
    /**
118
     * Save coupon in database

class/class.directory.php 1 location

@@ 119-137 (lines=19) @@
116
     * @return mixed reference to the <a href='psi_element://efqDirectory'>efqDirectory</a> object, FALSE if failed
117
     *                        object, FALSE if failed
118
     */
119
    public function &get($dirid = false)
120
    {
121
        if ($dirid === false) {
122
            return false;
123
        }
124
        $dirid = (int)$dirid;
125
        if ($dirid > 0) {
126
            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' WHERE dirid=' . $dirid;
127
            if (!$result = $this->db->query($sql)) {
128
                return false;
129
            }
130
            $directory =& $this->create(false);
131
            $directory->assignVars($this->db->fetchArray($result));
132
133
            return $directory;
134
        }
135
136
        return false;
137
    }
138
139
    /**
140
     * retrieve all directories

class/class.gmap.php 1 location

@@ 351-370 (lines=20) @@
348
     * @param int $id
349
     * @return bool|efqGmap
350
     */
351
    public function getByDataId($id = 0)
352
    {
353
        if ($id === false) {
354
            return false;
355
        }
356
        $id = (int)$id;
357
        echo $id;
358
        if ($id > 0) {
359
            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps') . ' WHERE dataid=' . (int)$id;
360
            if (!$result = $this->db->query($sql)) {
361
                return false;
362
            }
363
            $gmap =& $this->create(false);
364
            $gmap->assignVars($this->db->fetchArray($result));
365
366
            return $gmap;
367
        }
368
369
        return false;
370
    }
371
372
    /**
373
     * Function insertGmap inserts google map data into DB