mambax7 /
extgallery
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * ExtGallery User area |
||
| 4 | * |
||
| 5 | * You may not change or alter any portion of this comment or credits |
||
| 6 | * of supporting developers from this source code or any supporting source code |
||
| 7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | * |
||
| 12 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 13 | * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
| 14 | * @author Zoullou (http://www.zoullou.net) |
||
| 15 | * @package ExtGallery |
||
| 16 | * @version $Id: hook-photo.php 8088 2011-11-06 09:38:12Z beckmi $ |
||
| 17 | */ |
||
| 18 | |||
| 19 | |||
| 20 | use XoopsModules\Extgallery; |
||
| 21 | |||
| 22 | include __DIR__ . '/header.php'; |
||
| 23 | require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/publicPerm.php'; |
||
| 24 | |||
| 25 | $photoId = \Xmf\Request::getInt('id', 0, 'GET'); |
||
|
0 ignored issues
–
show
|
|||
| 26 | |||
| 27 | |||
| 28 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||
| 29 | /** @var Extgallery\Photo $photo */ |
||
| 30 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||
| 31 | $photoHandler->updateHits($photoId); |
||
| 32 | $photo = $photoHandler->get($photoId); |
||
| 33 | |||
| 34 | switch (strtolower(strrchr($photo->getVar('photo_name'), '.'))) { |
||
| 35 | case '.png': |
||
| 36 | $type = 'image/png'; |
||
| 37 | break; |
||
| 38 | case '.gif': |
||
| 39 | $type = 'image/gif'; |
||
| 40 | break; |
||
| 41 | case '.jpg': |
||
| 42 | $type = 'image/jpeg'; |
||
| 43 | break; |
||
| 44 | default: |
||
| 45 | $type = 'application/octet-stream'; |
||
| 46 | break; |
||
| 47 | } |
||
| 48 | |||
| 49 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||
| 50 | |||
| 51 | // If require image don't exist |
||
| 52 | if (0 == $photo->getVar('cat_id')) { |
||
| 53 | header('Content-type: image/jpeg'); |
||
| 54 | readfile(XOOPS_ROOT_PATH . '/modules/extgallery/assets/images/dont-exist.jpg'); |
||
| 55 | |||
| 56 | // If user is allowed to view this picture |
||
| 57 | } elseif ($permHandler->isAllowed($xoopsUser, 'public_access', $photo->getVar('cat_id'))) { |
||
| 58 | $photo = $photoHandler->objectToArray($photo); |
||
| 59 | header('Content-type: ' . $type . ''); |
||
| 60 | readfile(XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/medium/' . $photo['photo_name']); |
||
| 61 | |||
| 62 | // If user isn't allowed to view this picture |
||
| 63 | } else { |
||
| 64 | header('Content-type: image/jpeg'); |
||
| 65 | readfile(XOOPS_ROOT_PATH . '/modules/extgallery/assets/images/not-allowed.jpg'); |
||
| 66 | } |
||
| 67 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths