Code Duplication    Length = 23-25 lines in 2 locations

class/class.datafield.php 1 location

@@ 84-106 (lines=23) @@
81
        $data_result = $this->db->query($sql) or $this->errorhandler->show("0013");
82
        //$numrows = $this->db->getRowsNum($data_result);
83
        $arr = array();
84
        while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $itemid, $value, $customtitle, $custom) = $this->db->fetchRow($data_result)) {
85
            $fieldvalue = $this->getFieldValue($fieldtype, $options, $value);
86
            if ($icon != '') {
87
                $iconurl = "<img src=\"uploads/$icon\" />";
88
            } else {
89
                $iconurl = "";
90
            }
91
            if ($custom != '0' && $customtitle != "") {
92
                $title = $customtitle;
93
            }
94
            $arr[] = array(
95
                'dtypeid'     => $dtypeid,
96
                'title'       => $title,
97
                'section'     => $section,
98
                'icon'        => $iconurl,
99
                'ftypeid'     => $ftypeid,
100
                'fieldtype'   => $fieldtype,
101
                'ext'         => $ext,
102
                'options'     => $options,
103
                'custom'      => $custom,
104
                'itemid'      => $itemid,
105
                'value'       => $fieldvalue,
106
                'customtitle' => $customtitle
107
            );
108
        }
109

class/class.listing.php 1 location

@@ 264-288 (lines=25) @@
261
        $numrows = $this->db->getRowsNum($result);
262
        //$arr = $this->db->fetchArray($result);
263
        $arr = array();
264
        while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $itemid, $value, $customtitle) = $this->db->fetchRow($result)) {
265
            $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value);
266
            if ($icon != '') {
267
                $iconurl = "<img src=\"uploads/$icon\">";
268
            } else {
269
                $iconurl = '';
270
            }
271
            if ($custom != '0' && $customtitle != '') {
272
                $title = $customtitle;
273
            }
274
            $arr[] = array(
275
                'dtypeid'     => $dtypeid,
276
                'title'       => $title,
277
                'section'     => $section,
278
                'icon'        => $iconurl,
279
                'ftypeid'     => $ftypeid,
280
                'fieldtype'   => $fieldtype,
281
                'ext'         => $ext,
282
                'options'     => $options,
283
                'custom'      => $custom,
284
                'itemid'      => $itemid,
285
                'value'       => $fieldvalue,
286
                'customtitle' => $customtitle
287
            );
288
        }
289
290
        return $arr;
291
    }