Code Duplication    Length = 17-17 lines in 2 locations

main/inc/lib/group_portal_manager.lib.php 1 location

@@ 1140-1156 (lines=17) @@
1137
        $image_array_sys = self::get_group_picture_path_by_id($id, 'system', false, true);
1138
        $image_array = self::get_group_picture_path_by_id($id, 'web', false, true);
1139
        $file = $image_array_sys['dir'].$size_picture.$picture_file;
1140
        if (file_exists($file)) {
1141
            $picture['file'] = $image_array['dir'].$size_picture.$picture_file;
1142
            $picture['style'] = '';
1143
            if ($height > 0) {
1144
                $dimension = api_getimagesize($picture['file']);
1145
                $margin = (($height - $dimension['width']) / 2);
1146
                //@ todo the padding-top should not be here
1147
                $picture['style'] = ' style="padding-top:'.$margin.'px; width:'.$dimension['width'].'px; height:'.$dimension['height'].';" ';
1148
            }
1149
        } else {
1150
            $file = $image_array_sys['dir'].$picture_file;
1151
            if (file_exists($file) && !is_dir($file)) {
1152
                $picture['file'] = $image_array['dir'].$picture_file;
1153
            } else {
1154
                $picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_group.png';
1155
            }
1156
        }
1157
        return $picture;
1158
    }
1159

main/inc/lib/usergroup.lib.php 1 location

@@ 1399-1415 (lines=17) @@
1396
        $image_array_sys = $this->get_group_picture_path_by_id($id, 'system', false, true);
1397
        $image_array = $this->get_group_picture_path_by_id($id, 'web', false, true);
1398
        $file = $image_array_sys['dir'].$size_picture.$picture_file;
1399
        if (file_exists($file)) {
1400
            $picture['file'] = $image_array['dir'].$size_picture.$picture_file;
1401
            $picture['style'] = '';
1402
            if ($height > 0) {
1403
                $dimension = api_getimagesize($picture['file']);
1404
                $margin = (($height - $dimension['width']) / 2);
1405
                //@ todo the padding-top should not be here
1406
                $picture['style'] = ' style="padding-top:'.$margin.'px; width:'.$dimension['width'].'px; height:'.$dimension['height'].';" ';
1407
            }
1408
        } else {
1409
            $file = $image_array_sys['dir'].$picture_file;
1410
            if (file_exists($file) && !is_dir($file)) {
1411
                $picture['file'] = $image_array['dir'].$picture_file;
1412
            } else {
1413
                $picture['file'] = Display::returnIconPath('unknown_group.png');
1414
            }
1415
        }
1416
        return $picture;
1417
    }
1418