mambax7 /
extgallery
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 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 (https://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; |
||||
| 19 | use XoopsModules\Extgallery; |
||||
| 20 | |||||
| 21 | require_once __DIR__ . '/header.php'; |
||||
| 22 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||||
| 23 | |||||
| 24 | /** @var Extgallery\Helper $helper */ |
||||
| 25 | $helper = Extgallery\Helper::getInstance(); |
||||
| 26 | |||||
| 27 | $GLOBALS['xoopsOption']['template_main'] = 'extgallery_public-album.tpl'; |
||||
| 28 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
| 29 | |||||
| 30 | if (!isset($_GET['id'])) { |
||||
| 31 | $catId = 0; |
||||
| 32 | } else { |
||||
| 33 | $catId = Request::getInt('id', 0, 'GET'); |
||||
| 34 | } |
||||
| 35 | if (!isset($_GET['start'])) { |
||||
| 36 | $start = 0; |
||||
| 37 | } else { |
||||
| 38 | $start = Request::getInt('start', 0, 'GET'); |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | // HACK BLUETEEN TO SORT PHOTO BY USERS |
||||
| 42 | //photo_date - photo_title - photo_hits - photo_rating |
||||
| 43 | if (Request::hasVar('sortby', 'GET') |
||||
| 44 | && ('photo_date' === $_GET['sortby'] |
||||
| 45 | || 'photo_title' === $_GET['sortby'] |
||||
| 46 | || 'photo_hits' === $_GET['sortby'] |
||||
| 47 | || 'photo_rating' === $_GET['sortby'])) { |
||||
| 48 | $sortby = $_GET['sortby']; |
||||
| 49 | } else { |
||||
| 50 | $sortby = 'photo_date'; |
||||
| 51 | } |
||||
| 52 | |||||
| 53 | //ASC ou DESC |
||||
| 54 | if (Request::hasVar('orderby', 'GET') && ('DESC' === $_GET['orderby'] || 'ASC' === $_GET['orderby'])) { |
||||
| 55 | $orderby = $_GET['orderby']; |
||||
| 56 | } else { |
||||
| 57 | $orderby = $GLOBALS['xoopsModuleConfig']['display_set_order']; |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | $SortbyOrderby = $sortby . ' ' . $orderby; |
||||
| 61 | |||||
| 62 | /** |
||||
| 63 | * @param $SortbyOrderby |
||||
| 64 | * |
||||
| 65 | * @return array|string |
||||
| 66 | */ |
||||
| 67 | function convertorderbytrans($SortbyOrderby) |
||||
| 68 | { |
||||
| 69 | $orderbyTrans = []; |
||||
| 70 | if ('photo_date DESC' === $SortbyOrderby) { |
||||
| 71 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEASC; |
||||
| 72 | } |
||||
| 73 | if ('photo_date ASC' === $SortbyOrderby) { |
||||
| 74 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEDESC; |
||||
| 75 | } |
||||
| 76 | if ('photo_title ASC' === $SortbyOrderby) { |
||||
| 77 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_TITREASC; |
||||
| 78 | } |
||||
| 79 | if ('photo_title DESC' === $SortbyOrderby) { |
||||
| 80 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_TITREDESC; |
||||
| 81 | } |
||||
| 82 | if ('uid ASC' === $SortbyOrderby) { |
||||
| 83 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DESIGNERASC; |
||||
| 84 | } |
||||
| 85 | if ('uid DESC' === $SortbyOrderby) { |
||||
| 86 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DESIGNERDESC; |
||||
| 87 | } |
||||
| 88 | if ('photo_hits DESC' === $SortbyOrderby) { |
||||
| 89 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_HITSASC; |
||||
| 90 | } |
||||
| 91 | if ('photo_hits ASC' === $SortbyOrderby) { |
||||
| 92 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_HITSDESC; |
||||
| 93 | } |
||||
| 94 | if ('photo_rating DESC' === $SortbyOrderby) { |
||||
| 95 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_NOTEASC; |
||||
| 96 | } |
||||
| 97 | if ('photo_rating ASC' === $SortbyOrderby) { |
||||
| 98 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_NOTEDESC; |
||||
| 99 | } |
||||
| 100 | |||||
| 101 | return $orderbyTrans; |
||||
| 102 | } |
||||
| 103 | |||||
| 104 | // Check the access permission |
||||
| 105 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||||
| 106 | if ((null === $GLOBALS['xoopsUser'] || !is_object($GLOBALS['xoopsUser'])) || !$permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_access', $catId)) { |
||||
| 107 | redirect_header('index.php', 3, _NOPERM); |
||||
| 108 | } |
||||
| 109 | /** @var Extgallery\PublicCategoryHandler $catHandler */ |
||||
| 110 | $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory'); |
||||
| 111 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||||
| 112 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||||
| 113 | |||||
| 114 | $catObj = $catHandler->getCat($catId); |
||||
| 115 | |||||
| 116 | if (null === $catObj) { |
||||
| 117 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 118 | exit; |
||||
| 119 | } |
||||
| 120 | |||||
| 121 | $ajaxeffect = $helper->getConfig('use_ajax_effects'); |
||||
| 122 | $xoopsTpl->assign('use_ajax_effects', $ajaxeffect); |
||||
| 123 | |||||
| 124 | $cat = $catHandler->objectToArray($catObj); |
||||
| 125 | $xoopsTpl->assign('cat', $cat); |
||||
| 126 | |||||
| 127 | $catPath = $photoHandler->objectToArray($catHandler->getPath($catId)); |
||||
| 128 | $xoopsTpl->assign('catPath', $catPath); |
||||
| 129 | |||||
| 130 | $photos = $photoHandler->objectToArray($photoHandler->getAlbumPhotoPage($catId, $start, $sortby, $orderby), ['uid']); //xoops - blueteen - tri de l'affichage |
||||
| 131 | |||||
| 132 | // Plugin traitement |
||||
| 133 | $plugin = Extgallery\Helper::getInstance()->getHandler('Plugin'); |
||||
| 134 | $nbPhoto = count($photos); |
||||
| 135 | foreach ($photos as $i => $iValue) { |
||||
| 136 | $params = ['catId' => $catId, 'photoId' => $photos[$i]['photo_id'], 'link' => []]; |
||||
| 137 | $plugin->triggerEvent('photoAlbumLink', $params); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 138 | $photos[$i]['link'] = $params['link']; |
||||
| 139 | } |
||||
| 140 | |||||
| 141 | $k = $helper->getConfig('nb_column') - (count($photos) % $helper->getConfig('nb_column')); |
||||
| 142 | if ($k != $helper->getConfig('nb_column')) { |
||||
| 143 | for ($i = 0; $i < $k; ++$i) { |
||||
| 144 | $photos[] = []; |
||||
| 145 | } |
||||
| 146 | } |
||||
| 147 | |||||
| 148 | // HACK DATE BY MAGE : DISPLAY PUBLICATION DATE |
||||
| 149 | foreach (array_keys($photos) as $i) { |
||||
| 150 | if (isset($photos[$i]['photo_date'])) { |
||||
| 151 | $photos[$i]['photo_date'] = date(_SHORTDATESTRING, $photos[$i]['photo_date']); |
||||
| 152 | } |
||||
| 153 | } |
||||
| 154 | // END HACK DATE BY MAGE : DISPLAY PUBLICATION DATE |
||||
| 155 | |||||
| 156 | $xoopsTpl->assign('photos', $photos); |
||||
| 157 | /** @var xos_opal_Theme $xoTheme */ |
||||
| 158 | $pageNav = new \XoopsPageNav($photoHandler->getAlbumCount($catId), $helper->getConfig('nb_column') * $helper->getConfig('nb_line'), $start, 'start', 'id=' . $catId . '&orderby=' . $orderby . '&sortby=' . $sortby); //xoops - blueteen - tri de l'affichage |
||||
| 159 | $xoopsTpl->assign('pageNav', $pageNav->renderNav()); |
||||
| 160 | if (isset($catObj)) { |
||||
| 161 | $xoopsTpl->assign('xoops_pagetitle', $catObj->getVar('cat_name')); |
||||
| 162 | $xoTheme->addMeta('meta', 'description', $catObj->getVar('cat_desc')); |
||||
| 163 | } |
||||
| 164 | |||||
| 165 | $jquery = $helper->getConfig('enable_jquery'); |
||||
| 166 | $xoopsTpl->assign('jquery', $jquery); |
||||
| 167 | if (1 == $jquery && 'none' !== $ajaxeffect) { |
||||
| 168 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||||
| 169 | switch ($ajaxeffect) { |
||||
| 170 | case 'lightbox': |
||||
| 171 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
||||
| 172 | $xoTheme->addStylesheet('browse.php?modules/system/css/lightbox.css'); |
||||
| 173 | |||||
| 174 | break; |
||||
| 175 | case 'tooltip': |
||||
| 176 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/tooltip/image.tooltip.js'); |
||||
| 177 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/tooltip/image.tooltip.css'); |
||||
| 178 | |||||
| 179 | break; |
||||
| 180 | case 'overlay': |
||||
| 181 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/overlay/overlay.jquery.tools.min.js'); |
||||
| 182 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/overlay/overlay.css'); |
||||
| 183 | |||||
| 184 | break; |
||||
| 185 | case 'fancybox': |
||||
| 186 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/fancybox/mousewheel.js'); |
||||
| 187 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/fancybox/fancybox.pack.js'); |
||||
| 188 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/fancybox/fancybox.css'); |
||||
| 189 | |||||
| 190 | break; |
||||
| 191 | case 'prettyphoto': |
||||
| 192 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/prettyphoto/jquery.prettyPhoto.js'); |
||||
| 193 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/prettyphoto/prettyPhoto.css'); |
||||
| 194 | |||||
| 195 | break; |
||||
| 196 | } |
||||
| 197 | } |
||||
| 198 | |||||
| 199 | $rel = 'alternate'; |
||||
| 200 | $attributes['rel'] = $rel; |
||||
| 201 | $attributes['type'] = 'application/rss+xml'; |
||||
| 202 | $attributes['title'] = _MD_EXTGALLERY_RSS; |
||||
| 203 | $attributes['href'] = XOOPS_URL . '/modules/extgallery/public-rss.php'; |
||||
| 204 | $xoTheme->addMeta('link', $rel, $attributes); |
||||
| 205 | $xoTheme->addStylesheet('modules/extgallery/assets/css/style.css'); |
||||
| 206 | |||||
| 207 | $lang = [ |
||||
| 208 | 'hits' => _MD_EXTGALLERY_HITS, |
||||
| 209 | 'comments' => _MD_EXTGALLERY_COMMENTS, |
||||
| 210 | 'rate_score' => _MD_EXTGALLERY_RATING_SCORE, |
||||
| 211 | ]; |
||||
| 212 | $xoopsTpl->assign('lang', $lang); |
||||
| 213 | |||||
| 214 | $xoopsTpl->assign('enableExtra', $helper->getConfig('display_extra_field')); |
||||
| 215 | $xoopsTpl->assign('enableRating', $helper->getConfig('enable_rating')); |
||||
| 216 | $xoopsTpl->assign('nbColumn', $helper->getConfig('nb_column')); |
||||
| 217 | $xoopsTpl->assign('extgalleryName', $xoopsModule->getVar('name')); |
||||
| 218 | $xoopsTpl->assign('disp_ph_title', $helper->getConfig('disp_ph_title')); |
||||
| 219 | |||||
| 220 | $xoopsTpl->assign('extgalleryID', $catId); //xoops - blueteen - tri de l'affichage |
||||
| 221 | $xoopsTpl->assign('extgalleryStart', $start); //xoops -blueteen - tri de l'affichage |
||||
| 222 | $xoopsTpl->assign('extgallerySortbyOrderby', _MD_EXTGALLERY_ORDERBY . convertorderbytrans($SortbyOrderby)); //xoops - blueteen - tri de l'affichage |
||||
|
0 ignored issues
–
show
Are you sure
convertorderbytrans($SortbyOrderby) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 223 | |||||
| 224 | //DNPROSSI - VOLTAN - added preferences option |
||||
| 225 | // enable_info, enable_submitter_lnk, enable_photo_hits |
||||
| 226 | if ('album' === $helper->getConfig('info_view') || 'both' === $helper->getConfig('info_view')) { |
||||
| 227 | if ('public' === $helper->getConfig('pubusr_info_view') || 'both' === $helper->getConfig('pubusr_info_view')) { |
||||
| 228 | if (0 == $helper->getConfig('enable_info')) { |
||||
| 229 | $enable_info = $helper->getConfig('enable_info'); |
||||
| 230 | } else { |
||||
| 231 | $enable_info = 1; |
||||
| 232 | } |
||||
| 233 | } else { |
||||
| 234 | $enable_info = 1; |
||||
| 235 | } |
||||
| 236 | } else { |
||||
| 237 | $enable_info = 1; |
||||
| 238 | } |
||||
| 239 | $xoopsTpl->assign('enable_info', $enable_info); |
||||
| 240 | $xoopsTpl->assign('enable_photo_hits', $helper->getConfig('enable_photo_hits')); |
||||
| 241 | $xoopsTpl->assign('enable_submitter_lnk', $helper->getConfig('enable_submitter_lnk')); |
||||
| 242 | $xoopsTpl->assign('enable_show_comments', $helper->getConfig('enable_show_comments')); |
||||
| 243 | $xoopsTpl->assign('enable_date', $helper->getConfig('enable_date')); |
||||
| 244 | $xoopsTpl->assign('show_rss', $helper->getConfig('show_rss')); |
||||
| 245 | |||||
| 246 | //for tooltip |
||||
| 247 | $xoopsTpl->assign('album_tooltip_borderwidth', $helper->getConfig('album_tooltip_borderwidth')); |
||||
| 248 | $xoopsTpl->assign('album_tooltip_bordercolor', $helper->getConfig('album_tooltip_bordercolor')); |
||||
| 249 | $xoopsTpl->assign('album_tooltip_width', $helper->getConfig('album_tooltip_width')); |
||||
| 250 | |||||
| 251 | //for overlay |
||||
| 252 | $xoopsTpl->assign('album_overlay_bg', $helper->getConfig('album_overlay_bg')); |
||||
| 253 | $xoopsTpl->assign('album_overlay_width', $helper->getConfig('album_overlay_width')); |
||||
| 254 | $xoopsTpl->assign('album_overlay_height', $helper->getConfig('album_overlay_height')); |
||||
| 255 | |||||
| 256 | //for fancybox |
||||
| 257 | $xoopsTpl->assign('album_fancybox_color', $helper->getConfig('album_fancybox_color')); |
||||
| 258 | $xoopsTpl->assign('album_fancybox_opacity', $helper->getConfig('album_fancybox_opacity')); |
||||
| 259 | $xoopsTpl->assign('album_fancybox_tin', $helper->getConfig('album_fancybox_tin')); |
||||
| 260 | $xoopsTpl->assign('album_fancybox_tout', $helper->getConfig('album_fancybox_tout')); |
||||
| 261 | $xoopsTpl->assign('album_fancybox_title', $helper->getConfig('album_fancybox_title')); |
||||
| 262 | $xoopsTpl->assign('album_fancybox_showtype', $helper->getConfig('album_fancybox_showtype')); |
||||
| 263 | |||||
| 264 | //for prettyphoto |
||||
| 265 | $xoopsTpl->assign('album_prettyphoto_speed', $helper->getConfig('album_prettyphoto_speed')); |
||||
| 266 | $xoopsTpl->assign('album_prettyphoto_theme', $helper->getConfig('album_prettyphoto_theme')); |
||||
| 267 | $xoopsTpl->assign('album_prettyphoto_slidspeed', $helper->getConfig('album_prettyphoto_slidspe')); |
||||
| 268 | $xoopsTpl->assign('album_prettyphoto_autoplay', $helper->getConfig('album_prettyphoto_autopla')); |
||||
| 269 | |||||
| 270 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 271 |