Code Duplication    Length = 39-39 lines in 4 locations

add_dog.php 2 locations

@@ 380-418 (lines=39) @@
377
        'usercolumns' => $empty
378
    );
379
380
    while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
381
        //create picture information
382
        if ($row['foto'] != '') {
383
            $camera = " <img src=\"assets/images/camera.png\">";
384
        } else {
385
            $camera = '';
386
        }
387
        $name = stripslashes($row['NAAM']) . $camera;
388
        //empty array
389
        unset($columnvalue);
390
        //fill array
391
        for ($i = 1; $i < $numofcolumns; ++$i) {
392
            $x = $columns[$i]['columnnumber'];
393
            if (is_array($columns[$i]['lookupval'])) {
394
                foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
395
                    if ($key == $row['user' . $x]) {
396
                        $value = $keyvalue['value'];
397
                    }
398
                }
399
                //debug information
400
                ///echo $columns[$i]['columnname']."is an array !";
401
            } //format value - cant use object because of query count
402
            elseif (0 === strpos($row['user' . $x], 'http://')) {
403
                $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
404
            } else {
405
                $value = $row['user' . $x];
406
            }
407
            $columnvalue[] = array('value' => $value);
408
        }
409
        $dogs[] = array(
410
            'id'          => $row['Id'],
411
            'name'        => $name,
412
            'gender'      => '<img src="assets/images/male.gif">',
413
            'link'        => "<a href=\"add_dog.php?f=dam&random=" . $random . '&selsire=' . $row['Id'] . "\">" . $name . '</a>',
414
            'colour'      => '',
415
            'number'      => '',
416
            'usercolumns' => $columnvalue
417
        );
418
    }
419
420
    //add data to smarty template
421
    //assign dog
@@ 568-606 (lines=39) @@
565
        'usercolumns' => $empty
566
    );
567
568
    while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
569
        //create picture information
570
        if ($row['foto'] != '') {
571
            $camera = " <img src=\"assets/images/camera.png\">";
572
        } else {
573
            $camera = '';
574
        }
575
        $name = stripslashes($row['NAAM']) . $camera;
576
        //empty array
577
        unset($columnvalue);
578
        //fill array
579
        for ($i = 1; $i < $numofcolumns; ++$i) {
580
            $x = $columns[$i]['columnnumber'];
581
            if (is_array($columns[$i]['lookupval'])) {
582
                foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
583
                    if ($key == $row['user' . $x]) {
584
                        $value = $keyvalue['value'];
585
                    }
586
                }
587
                //debug information
588
                ///echo $columns[$i]['columnname']."is an array !";
589
            } //format value - cant use object because of query count
590
            elseif (0 === strpos($row['user' . $x], 'http://')) {
591
                $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
592
            } else {
593
                $value = $row['user' . $x];
594
            }
595
            $columnvalue[] = array('value' => $value);
596
        }
597
        $dogs[] = array(
598
            'id'          => $row['Id'],
599
            'name'        => $name,
600
            'gender'      => '<img src="assets/images/female.gif">',
601
            'link'        => "<a href=\"add_dog.php?f=check&random=" . $random . '&seldam=' . $row['Id'] . "\">" . $name . '</a>',
602
            'colour'      => '',
603
            'number'      => '',
604
            'usercolumns' => $columnvalue
605
        );
606
    }
607
608
    //add data to smarty template
609
    //assign dog

add_litter.php 2 locations

@@ 323-361 (lines=39) @@
320
            'usercolumns' => $empty
321
        );
322
323
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
324
            //create picture information
325
            if ($row['foto'] != '') {
326
                $camera = " <img src=\"assets/images/camera.png\">";
327
            } else {
328
                $camera = '';
329
            }
330
            $name = stripslashes($row['NAAM']) . $camera;
331
            //empty array
332
            unset($columnvalue);
333
            //fill array
334
            for ($i = 1; $i < $numofcolumns; ++$i) {
335
                $x = $columns[$i]['columnnumber'];
336
                if (is_array($columns[$i]['lookupval'])) {
337
                    foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
338
                        if ($key == $row['user' . $x]) {
339
                            $value = $keyvalue['value'];
340
                        }
341
                    }
342
                    //debug information
343
                    ///echo $columns[$i]['columnname']."is an array !";
344
                } //format value - cant use object because of query count
345
                elseif (0 === strpos($row['user' . $x], 'http://')) {
346
                    $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
347
                } else {
348
                    $value = $row['user' . $x];
349
                }
350
                $columnvalue[] = array('value' => $value);
351
            }
352
            $dogs[] = array(
353
                'id'          => $row['Id'],
354
                'name'        => $name,
355
                'gender'      => '<img src="assets/images/male.gif">',
356
                'link'        => "<a href=\"add_litter.php?f=dam&random=" . $random . '&selsire=' . $row['Id'] . "\">" . $name . '</a>',
357
                'colour'      => '',
358
                'number'      => '',
359
                'usercolumns' => $columnvalue
360
            );
361
        }
362
363
        //add data to smarty template
364
        //assign dog
@@ 509-547 (lines=39) @@
506
            'usercolumns' => $empty
507
        );
508
509
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
510
            //create picture information
511
            if ($row['foto'] != '') {
512
                $camera = " <img src=\"assets/images/camera.png\">";
513
            } else {
514
                $camera = '';
515
            }
516
            $name = stripslashes($row['NAAM']) . $camera;
517
            //empty array
518
            unset($columnvalue);
519
            //fill array
520
            for ($i = 1; $i < $numofcolumns; ++$i) {
521
                $x = $columns[$i]['columnnumber'];
522
                if (is_array($columns[$i]['lookupval'])) {
523
                    foreach ($columns[$i]['lookupval'] as $key => $keyvalue) {
524
                        if ($key == $row['user' . $x]) {
525
                            $value = $keyvalue['value'];
526
                        }
527
                    }
528
                    //debug information
529
                    ///echo $columns[$i]['columnname']."is an array !";
530
                } //format value - cant use object because of query count
531
                elseif (0 === strpos($row['user' . $x], 'http://')) {
532
                    $value = "<a href=\"" . $row['user' . $x] . "\">" . $row['user' . $x] . '</a>';
533
                } else {
534
                    $value = $row['user' . $x];
535
                }
536
                $columnvalue[] = array('value' => $value);
537
            }
538
            $dogs[] = array(
539
                'id'          => $row['Id'],
540
                'name'        => $name,
541
                'gender'      => '<img src="assets/images/female.gif">',
542
                'link'        => "<a href=\"add_litter.php?f=check&random=" . $random . '&seldam=' . $row['Id'] . "\">" . $name . '</a>',
543
                'colour'      => '',
544
                'number'      => '',
545
                'usercolumns' => $columnvalue
546
            );
547
        }
548
549
        //add data to smarty template
550
        //assign dog