Code Duplication    Length = 15-16 lines in 2 locations

hook-photo.php 1 location

@@ 49-63 (lines=15) @@
46
$permHandler = ExtgalleryPublicPermHandler::getInstance();
47
48
// If require image don't exist
49
if (0 == $photo->getVar('cat_id')) {
50
    header('Content-type: image/jpeg');
51
    readfile(__DIR__ . '/assets/images/dont-exist.jpg');
52
53
    // If user is allowed to view this picture
54
} elseif ($permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_access', $photo->getVar('cat_id'))) {
55
    $photo = $photoHandler->objectToArray($photo);
56
    header('Content - type: ' . $type . '');
57
    readfile(XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/ medium/' . $photo['photo_name']);
58
59
    // If user isn't allowed to view this picture
60
} else {
61
    header('Content-type: image/jpeg');
62
    readfile(__DIR__ . '/assets/images/not-allowed.jpg');
63
}
64

hook-thumb.php 1 location

@@ 48-63 (lines=16) @@
45
$permHandler = ExtgalleryPublicPermHandler::getInstance();
46
47
// If require image don't exist
48
if (0 == $photo->getVar('cat_id')) {
49
    header('Content-type: image/jpeg');
50
    readfile(__DIR__ . '/assets/images/dont-exist.jpg');
51
52
    // If user is allowed to view this picture
53
} elseif ($permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_access', $photo->getVar('cat_id'))) {
54
    $photo = $photoHandler->objectToArray($photo);
55
56
    header('Content - type: ' . $type . '');
57
    readfile(XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/thumb/thumb_' . $photo['photo_name']);
58
59
    // If user isn't allowed to view this picture
60
} else {
61
    header('Content-type: image/jpeg');
62
    readfile(__DIR__ . '/assets/images/not-allowed.jpg');
63
}
64