Code Duplication    Length = 42-42 lines in 2 locations

virtual.php 2 locations

@@ 129-170 (lines=42) @@
126
            }
127
        }
128
129
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
130
            //create picture information
131
            if ($row['foto'] != '') {
132
                $camera = " <img src=\"assets/images/dog-icon25.png\">";
133
            } else {
134
                $camera = '';
135
            }
136
            $name = stripslashes($row['d_naam']) . $camera;
137
            //empty array
138
            unset($columnvalue);
139
            //fill array
140
            for ($i = 1; $i < $numofcolumns; ++$i) {
141
                $x = $columns[$i]['columnnumber'];
142
                //echo $x."columnnumber";
143
                if (is_array($columns[$i]['lookupval'])) {
144
                    foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
145
                        if ($keyvalue['id'] == $row['user' . $x]) {
146
                            //echo "key:".$row['user5']."<br />";
147
                            $value = $keyvalue['value'];
148
                        }
149
                    }
150
                    //debug information
151
                    ///echo $columns[$i]['columnname']."is an array !";
152
                } //format value - cant use object because of query count
153
                elseif (0 === strpos($row['user' . $x], 'http://')) {
154
                    $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
155
                } else {
156
                    $value = $row['user' . $x];
157
                }
158
                $columnvalue[] = array('value' => $value);
159
                unset($value);
160
            }
161
            $dogs[] = array(
162
                'id'          => $row['d_id'],
163
                'name'        => $name,
164
                'gender'      => "<img src=\"assets/images/male.gif\" alt=\"" . _MA_PEDIGREE_FEMALE . "\">",
165
                'link'        => "<a href=\"virtual.php?f=dam&selsire=" . $row['d_id'] . "\">" . $name . '</a>',
166
                'colour'      => '',
167
                'number'      => '',
168
                'usercolumns' => isset($columnvalue) ? $columnvalue : 0
169
            );
170
        }
171
172
        //add data to smarty template
173
        //assign dog
@@ 317-358 (lines=42) @@
314
            }
315
        }
316
317
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
318
            //create picture information
319
            if ($row['foto'] != '') {
320
                $camera = " <img src=\"assets/images/dog-icon25.png\">";
321
            } else {
322
                $camera = '';
323
            }
324
            $name = stripslashes($row['d_naam']) . $camera;
325
            //empty array
326
            unset($columnvalue);
327
            //fill array
328
            for ($i = 1; $i < $numofcolumns; ++$i) {
329
                $x = $columns[$i]['columnnumber'];
330
                //echo $x."columnnumber";
331
                if (is_array($columns[$i]['lookupval'])) {
332
                    foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
333
                        if ($keyvalue['id'] == $row['user' . $x]) {
334
                            //echo "key:".$row['user5']."<br />";
335
                            $value = $keyvalue['value'];
336
                        }
337
                    }
338
                    //debug information
339
                    ///echo $columns[$i]['columnname']."is an array !";
340
                } //format value - cant use object because of query count
341
                elseif (0 === strpos($row['user' . $x], 'http://')) {
342
                    $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
343
                } else {
344
                    $value = $row['user' . $x];
345
                }
346
                $columnvalue[] = array('value' => $value);
347
                unset($value);
348
            }
349
            $dogs[] = array(
350
                'id'          => $row['d_id'],
351
                'name'        => $name,
352
                'gender'      => "<img src=\"assets/images/female.gif\" alt=\"" . _MA_PEDIGREE_FEMALE . "\">",
353
                'link'        => "<a href=\"virtual.php?f=check&selsire=" . $selsire . '&seldam=' . $row['d_id'] . "\">" . $name . '</a>',
354
                'colour'      => '',
355
                'number'      => '',
356
                'usercolumns' => isset($columnvalue) ? $columnvalue : 0
357
            );
358
        }
359
360
        //add data to smarty template
361
        //assign dog