Code Duplication    Length = 14-17 lines in 2 locations

hook-photo.php 1 location

@@ 31-44 (lines=14) @@
28
$photoHandler->updateHits($photoId);
29
$photo = $photoHandler->get($photoId);
30
31
switch (strtolower(strrchr($photo->getVar('photo_name'), '.'))) {
32
    case '.png':
33
        $type = 'image/png';
34
        break;
35
    case '.gif':
36
        $type = 'image/gif';
37
        break;
38
    case '.jpg':
39
        $type = 'image/jpeg';
40
        break;
41
    default:
42
        $type = 'application/octet-stream';
43
        break;
44
}
45
46
$permHandler = ExtgalleryPublicPermHandler::getInstance();
47

public-download.php 1 location

@@ 35-51 (lines=17) @@
32
    redirect_header('index.php');
33
}
34
35
switch (strtolower(strrchr($photo->getVar('photo_name'), '.'))) {
36
    case '.png':
37
        $type = 'image/png';
38
        break;
39
    case '.gif':
40
        $type = 'image/gif';
41
        break;
42
    case '.jpg':
43
        $type = 'image/jpeg';
44
        break;
45
    case '.jpeg':
46
        $type = 'image/jpeg';
47
        break;
48
    default:
49
        $type = 'application/octet-stream';
50
        break;
51
}
52
53
header('Content-Type: ' . $type . '');
54
header('Content-Disposition: attachment; filename="' . $photo->getVar('photo_name') . '"');