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 Xmf\Request; |
||
0 ignored issues
–
show
|
|||
19 | use XoopsModules\Extgallery; |
||
20 | /** @var Extgallery\Helper $helper */ |
||
21 | $helper = Extgallery\Helper::getInstance(); |
||
22 | |||
23 | include __DIR__ . '/header.php'; |
||
24 | |||
25 | $GLOBALS['xoopsOption']['template_main'] = 'extgallery_public-photo.tpl'; |
||
26 | include XOOPS_ROOT_PATH . '/header.php'; |
||
27 | |||
28 | if (!isset($_GET['photoId'])) { |
||
29 | $photoId = 0; |
||
30 | } else { |
||
31 | $photoId = \Xmf\Request::getInt('photoId', 0, 'GET'); |
||
32 | } |
||
33 | /** @var Extgallery\PublicCategoryHandler $catHandler */ |
||
34 | $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory'); |
||
35 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||
36 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||
37 | /** @var Extgallery\PublicRatingHandler $ratingHandler */ |
||
38 | $ratingHandler = Extgallery\Helper::getInstance()->getHandler('PublicRating'); |
||
39 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||
40 | |||
41 | $photoObj = $photoHandler->getPhoto($photoId); |
||
42 | |||
43 | // Check is the photo exist |
||
44 | if (!$photoObj) { |
||
45 | redirect_header('index.php', 3, _NOPERM); |
||
46 | } |
||
47 | |||
48 | $photo = $photoHandler->objectToArray($photoObj, ['cat_id', 'uid']); |
||
49 | |||
50 | // Check the category access permission |
||
51 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||
52 | if (!$permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_access', $photo['cat']['cat_id'])) { |
||
53 | redirect_header('index.php', 3, _NOPERM); |
||
54 | } |
||
55 | |||
56 | // Don't update counter if user come from rating page |
||
57 | if (isset(Request::getString('HTTP_REFERER', '', 'SERVER')) && basename(Request::getString('HTTP_REFERER', '', 'SERVER')) != 'public-rating.php?photoId=' . $photoId) { |
||
58 | $photoHandler->updateHits($photoId); |
||
59 | } |
||
60 | |||
61 | // Plugin traitement |
||
62 | $plugin = Extgallery\Helper::getInstance()->getHandler('Plugin'); |
||
63 | $params = ['catId' => $photo['cat']['cat_id'], 'photoId' => $photo['photo_id'], 'link' => []]; |
||
64 | $plugin->triggerEvent('photoAlbumLink', $params); |
||
65 | $photo['link'] = $params['link']; |
||
66 | |||
67 | $photo['photo_date'] = formatTimestamp($photo['photo_date'], _MEDIUMDATESTRING); |
||
68 | $xoopsTpl->assign('photo', $photo); |
||
69 | |||
70 | $cat = $catHandler->objectToArray($catHandler->getCat($photo['cat']['cat_id'])); |
||
71 | $xoopsTpl->assign('cat', $cat); |
||
72 | |||
73 | $catPath = $catHandler->objectToArray($catHandler->getPath($photo['cat']['cat_id'], true)); |
||
74 | $xoopsTpl->assign('catPath', $catPath); |
||
75 | |||
76 | $photosIds = $photoHandler->getPhotoAlbumId($photoObj->getVar('cat_id')); |
||
77 | |||
78 | $nbPhoto = count($photosIds); |
||
79 | $currentPhotoPlace = array_search($photoId, $photosIds); |
||
80 | |||
81 | if (1 == $nbPhoto) { |
||
82 | $prev = 0; |
||
83 | $next = 0; |
||
84 | } elseif (0 == $currentPhotoPlace) { |
||
85 | $prev = 0; |
||
86 | $next = $photosIds[$currentPhotoPlace + 1]; |
||
87 | } elseif (($currentPhotoPlace + 1) == $nbPhoto) { |
||
88 | $prev = $photosIds[$currentPhotoPlace - 1]; |
||
89 | $next = 0; |
||
90 | } else { |
||
91 | $prev = $photosIds[$currentPhotoPlace - 1]; |
||
92 | $next = $photosIds[$currentPhotoPlace + 1]; |
||
93 | } |
||
94 | $xoopsTpl->assign('prevId', $prev); |
||
95 | $xoopsTpl->assign('nextId', $next); |
||
96 | $xoopsTpl->assign('currentPhoto', $currentPhotoPlace + 1); |
||
97 | $xoopsTpl->assign('totalPhoto', $nbPhoto); |
||
98 | |||
99 | //DNPROSSI - changed photo_desc to photo_title |
||
100 | $xoopsTpl->assign('xoops_pagetitle', $photo['photo_title'] . ' - ' . $cat['cat_name']); |
||
101 | $xoTheme->addMeta('meta', 'description', $photo['photo_title'] . ' - ' . $cat['cat_desc']); |
||
102 | |||
103 | $rel = 'alternate'; |
||
104 | $attributes['rel'] = $rel; |
||
105 | $attributes['type'] = 'application/rss+xml'; |
||
106 | $attributes['title'] = _MD_EXTGALLERY_RSS; |
||
107 | $attributes['href'] = XOOPS_URL . '/modules/extgallery/public-rss.php'; |
||
108 | $xoTheme->addMeta('link', $rel, $attributes); |
||
109 | $xoTheme->addStylesheet('modules/extgallery/assets/css/style.css'); |
||
110 | |||
111 | $xoopsTpl->assign('rating', $ratingHandler->getRate($photoId)); |
||
112 | |||
113 | $lang = [ |
||
114 | 'preview' => _MD_EXTGALLERY_PREVIEW, |
||
115 | 'next' => _MD_EXTGALLERY_NEXT, |
||
116 | 'of' => _MD_EXTGALLERY_OF, |
||
117 | 'voteFor' => _MD_EXTGALLERY_VOTE_FOR_THIS_PHOTO, |
||
118 | 'photoInfo' => _MD_EXTGALLERY_PHOTO_INFORMATION, |
||
119 | 'resolution' => _MD_EXTGALLERY_RESOLUTION, |
||
120 | 'pixels' => _MD_EXTGALLERY_PIXELS, |
||
121 | 'view' => _MD_EXTGALLERY_VIEW, |
||
122 | 'hits' => _MD_EXTGALLERY_HITS, |
||
123 | 'fileSize' => _MD_EXTGALLERY_FILE_SIZE, |
||
124 | 'added' => _MD_EXTGALLERY_ADDED, |
||
125 | 'score' => _MD_EXTGALLERY_SCORE, |
||
126 | 'votes' => _MD_EXTGALLERY_VOTES, |
||
127 | 'downloadOrig' => _MD_EXTGALLERY_DOWNLOAD_ORIG, |
||
128 | 'donwloads' => _MD_EXTGALLERY_DOWNLOADS, |
||
129 | 'sendEcard' => _MD_EXTGALLERY_SEND_ECARD, |
||
130 | 'sends' => _MD_EXTGALLERY_SENDS, |
||
131 | 'submitter' => _MD_EXTGALLERY_SUBMITTER, |
||
132 | 'allPhotoBy' => _MD_EXTGALLERY_ALL_PHOTO_BY |
||
133 | ]; |
||
134 | $xoopsTpl->assign('lang', $lang); |
||
135 | |||
136 | if ($helper->getConfig('enable_rating')) { |
||
137 | $xoopsTpl->assign('canRate', $permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_rate', $cat['cat_id'])); |
||
138 | } else { |
||
139 | $xoopsTpl->assign('canRate', false); |
||
140 | //DNPROSSI - added preferences option - enable_rating |
||
141 | $xoopsTpl->assign('enable_rating', $helper->getConfig('enable_rating')); |
||
142 | } |
||
143 | |||
144 | //DNPROSSI - added preferences option |
||
145 | // enable_info, enable_resolution, enable_download, enable_date |
||
146 | // enable_ecards, enable_submitter_lnk, enable_photo_hits |
||
147 | if ('photo' === $helper->getConfig('info_view') || 'both' === $helper->getConfig('info_view')) { |
||
148 | if ('public' === $helper->getConfig('pubusr_info_view') || 'both' === $helper->getConfig('pubusr_info_view')) { |
||
149 | if (0 == $helper->getConfig('enable_info')) { |
||
150 | $enable_info = $helper->getConfig('enable_info'); |
||
151 | } else { |
||
152 | $enable_info = 1; |
||
153 | } |
||
154 | } else { |
||
155 | $enable_info = 1; |
||
156 | } |
||
157 | } else { |
||
158 | $enable_info = 1; |
||
159 | } |
||
160 | |||
161 | $xoopsTpl->assign('enable_info', $enable_info); |
||
162 | $xoopsTpl->assign('enable_resolution', $helper->getConfig('enable_resolution')); |
||
163 | $xoopsTpl->assign('enable_download', $helper->getConfig('enable_download')); |
||
164 | $xoopsTpl->assign('enable_date', $helper->getConfig('enable_date')); |
||
165 | $xoopsTpl->assign('enable_ecards', $helper->getConfig('enable_ecards')); |
||
166 | $xoopsTpl->assign('enable_submitter_lnk', $helper->getConfig('enable_submitter_lnk')); |
||
167 | $xoopsTpl->assign('enable_photo_hits', $helper->getConfig('enable_photo_hits')); |
||
168 | $xoopsTpl->assign('show_social_book', $helper->getConfig('show_social_book')); |
||
169 | |||
170 | $xoopsTpl->assign('enableExtra', $helper->getConfig('display_extra_field')); |
||
171 | $xoopsTpl->assign('canSendEcard', $permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_ecard', $cat['cat_id'])); |
||
172 | $xoopsTpl->assign('canDownload', $permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_download', $cat['cat_id'])); |
||
173 | |||
174 | $xoopsTpl->assign('extgalleryName', $xoopsModule->getVar('name')); |
||
175 | $xoopsTpl->assign('disp_ph_title', $helper->getConfig('disp_ph_title')); |
||
176 | $xoopsTpl->assign('display_type', $helper->getConfig('display_type')); |
||
177 | $xoopsTpl->assign('show_rss', $helper->getConfig('show_rss')); |
||
178 | |||
179 | // For xoops tag |
||
180 | if ((1 == $helper->getConfig('usetag')) && is_dir('../tag')) { |
||
181 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php'; |
||
182 | $xoopsTpl->assign('tagbar', tagBar($photo['photo_id'], $catid = 0)); |
||
183 | $xoopsTpl->assign('tags', true); |
||
184 | } else { |
||
185 | $xoopsTpl->assign('tags', false); |
||
186 | } |
||
187 | |||
188 | include XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
189 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
190 |
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