Code Duplication    Length = 18-19 lines in 2 locations

view_photos.php 1 location

@@ 106-123 (lines=18) @@
103
$pictures_number = $album_factory->getCount($criteria_lid, $criteria_uid);
104
105
// Are there pictures in the album?
106
if (0 == $pictures_number) {
107
    $xoopsTpl->assign('lang_nopicyet', _ADSLIGHT_NOTHINGYET);
108
} else {
109
    // no pictures in the album
110
    /**
111
     * Lets populate an array with the data from the pictures
112
     */
113
    $i = 0;
114
    foreach ($pictures_object_array as $picture) {
115
        $pictures_array[$i]['url']     = $picture->getVar('url', 's');
116
        $pictures_array[$i]['desc']    = $picture->getVar('title', 's');
117
        $pictures_array[$i]['cod_img'] = $picture->getVar('cod_img', 's');
118
        $pictures_array[$i]['lid']     = $picture->getVar('lid', 's');
119
        $xoopsTpl->assign('pics_array', $pictures_array);
120
121
        ++$i;
122
    }
123
}
124
125
/**
126
 * Show the form if it is the owner and he can still upload pictures

viewads.php 1 location

@@ 433-451 (lines=19) @@
430
            $album_factory         = new AdslightPicturesHandler($xoopsDB);
431
            $pictures_object_array = $album_factory->getObjects($criteria_lid, $criteria_uid);
432
            $pictures_number       = $album_factory->getCount($criteria_lid, $criteria_uid);
433
            if ($pictures_number == 0) {
434
                $nopicturesyet = _ADSLIGHT_NOTHINGYET;
435
                $xoopsTpl->assign('lang_nopicyet', $nopicturesyet);
436
            } else {
437
438
                /**
439
                 * Lets populate an array with the data from the pictures
440
                 */
441
                $i = 0;
442
                foreach ($pictures_object_array as $picture) {
443
                    $pictures_array[$i]['url']     = $picture->getVar('url', 's');
444
                    $pictures_array[$i]['desc']    = $picture->getVar('title', 's');
445
                    $pictures_array[$i]['cod_img'] = $picture->getVar('cod_img', 's');
446
                    $pictures_array[$i]['lid']     = $picture->getVar('lid', 's');
447
                    $xoopsTpl->assign('pics_array', $pictures_array);
448
449
                    ++$i;
450
                }
451
            }
452
            $owner      = new XoopsUser();
453
            $identifier = $owner->getUnameFromId($usid);
454
            if ($GLOBALS['xoopsModuleConfig']['adslight_lightbox'] == 1) {