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 | */ |
||
| 17 | |||
| 18 | use XoopsModules\Extgallery; |
||
| 19 | |||
| 20 | include __DIR__ . '/header.php'; |
||
| 21 | //require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/publicPerm.php'; |
||
| 22 | |||
| 23 | $photoId = \Xmf\Request::getInt('id', 0, 'GET'); |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||
| 26 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||
| 27 | $photo = $photoHandler->get($photoId); |
||
| 28 | |||
| 29 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||
| 30 | if (!$permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_download', $photo->getVar('cat_id'))) { |
||
| 31 | redirect_header('index.php'); |
||
| 32 | } |
||
| 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 | case '.jpeg': |
||
| 45 | $type = 'image/jpeg'; |
||
| 46 | break; |
||
| 47 | default: |
||
| 48 | $type = 'application/octet-stream'; |
||
| 49 | break; |
||
| 50 | } |
||
| 51 | |||
| 52 | header('Content-Type: ' . $type . ''); |
||
| 53 | header('Content-Disposition: attachment; filename="' . $photo->getVar('photo_name') . '"'); |
||
| 54 | |||
| 55 | //if ($photo->getVar('photo_havelarge')) { |
||
| 56 | // if ($permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_download_original', $photo->getVar('cat_id')) && $photo->getVar('photo_orig_name') != "") { |
||
| 57 | // $photoName = "original/".$photo->getVar('photo_orig_name'); |
||
| 58 | // } else { |
||
| 59 | // $photoName = "large/large_".$photo->getVar('photo_name'); |
||
| 60 | // } |
||
| 61 | //} else { |
||
| 62 | // $photoName = "medium/".$photo->getVar('photo_name'); |
||
| 63 | //} |
||
| 64 | |||
| 65 | if ($permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_download_original', $photo->getVar('cat_id')) |
||
| 66 | && '' != $photo->getVar('photo_orig_name')) { |
||
| 67 | $photoName = 'original/' . $photo->getVar('photo_orig_name'); |
||
| 68 | } else { |
||
| 69 | if ($photo->getVar('photo_havelarge')) { |
||
| 70 | $photoName = 'large/large_' . $photo->getVar('photo_name'); |
||
| 71 | } else { |
||
| 72 | $photoName = 'medium/' . $photo->getVar('photo_name'); |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | $photoHandler->updateDownload($photoId); |
||
| 77 | |||
| 78 | if ('' == $photo->getVar('photo_serveur')) { |
||
| 79 | readfile(XOOPS_ROOT_PATH . '/uploads/extgallery/public-photo/' . $photoName); |
||
| 80 | } else { |
||
| 81 | readfile($photo->getVar('photo_serveur') . $photoName); |
||
| 82 | } |
||
| 83 |
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