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 | $GLOBALS['xoopsOption']['template_main'] = 'extgallery_public-useralbum.tpl'; |
||
| 25 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 26 | |||
| 27 | $userId = Request::getInt('id', 0, 'GET'); |
||
| 28 | $start = Request::getInt('start', 0, 'GET'); |
||
| 29 | |||
| 30 | $ajaxeffect = $helper->getConfig('use_ajax_effects'); |
||
| 31 | $xoopsTpl->assign('use_ajax_effects', $ajaxeffect); |
||
| 32 | |||
| 33 | //HACK BLUETEEN TO SORT PHOTOS BY USERS |
||
| 34 | //photo_date - photo_title - photo_hits - photo_rating |
||
| 35 | if (Request::hasVar('sortby', 'GET') |
||
| 36 | && ('photo_date' === $_GET['sortby'] |
||
| 37 | || 'photo_title' === $_GET['sortby'] |
||
| 38 | || 'photo_hits' === $_GET['sortby'] |
||
| 39 | || 'photo_rating' === $_GET['sortby'])) { |
||
| 40 | $sortby = $_GET['sortby']; |
||
| 41 | } else { |
||
| 42 | $sortby = 'photo_date'; |
||
| 43 | } |
||
| 44 | |||
| 45 | //ASC ou DESC |
||
| 46 | if (Request::hasVar('orderby', 'GET') && ('DESC' === $_GET['orderby'] || 'ASC' === $_GET['orderby'])) { |
||
| 47 | $orderby = $_GET['orderby']; |
||
| 48 | } else { |
||
| 49 | $orderby = $GLOBALS['xoopsModuleConfig']['display_set_order']; |
||
| 50 | } |
||
| 51 | |||
| 52 | $SortbyOrderby = $sortby . ' ' . $orderby; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param $SortbyOrderby |
||
| 56 | * |
||
| 57 | * @return array|string |
||
| 58 | */ |
||
| 59 | function convertorderbytrans($SortbyOrderby) |
||
| 60 | { |
||
| 61 | $orderbyTrans = []; |
||
| 62 | if ('photo_date DESC' === $SortbyOrderby) { |
||
| 63 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEASC; |
||
| 64 | } |
||
| 65 | if ('photo_date ASC' === $SortbyOrderby) { |
||
| 66 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEDESC; |
||
| 67 | } |
||
| 68 | if ('photo_title ASC' === $SortbyOrderby) { |
||
| 69 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_TITREASC; |
||
| 70 | } |
||
| 71 | if ('photo_title DESC' === $SortbyOrderby) { |
||
| 72 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_TITREDESC; |
||
| 73 | } |
||
| 74 | if ('uid ASC' === $SortbyOrderby) { |
||
| 75 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DESIGNERASC; |
||
| 76 | } |
||
| 77 | if ('uid DESC' === $SortbyOrderby) { |
||
| 78 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_DESIGNERDESC; |
||
| 79 | } |
||
| 80 | if ('photo_hits DESC' === $SortbyOrderby) { |
||
| 81 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_HITSASC; |
||
| 82 | } |
||
| 83 | if ('photo_hits ASC' === $SortbyOrderby) { |
||
| 84 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_HITSDESC; |
||
| 85 | } |
||
| 86 | if ('photo_rating DESC' === $SortbyOrderby) { |
||
| 87 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_NOTEASC; |
||
| 88 | } |
||
| 89 | if ('photo_rating ASC' === $SortbyOrderby) { |
||
| 90 | $orderbyTrans = _MD_EXTGALLERY_ORDERBY_NOTEDESC; |
||
| 91 | } |
||
| 92 | |||
| 93 | return $orderbyTrans; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||
| 97 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||
| 98 | |||
| 99 | $photos = $photoHandler->objectToArray($photoHandler->getUserAlbumPhotoPage($userId, $start, $sortby, $orderby), ['uid']); |
||
| 100 | $k = $helper->getConfig('nb_column') - (count($photos) % $helper->getConfig('nb_column')); |
||
| 101 | if ($k != $helper->getConfig('nb_column')) { |
||
| 102 | for ($i = 0; $i < $k; ++$i) { |
||
| 103 | $photos[] = []; |
||
| 104 | } |
||
| 105 | } |
||
| 106 | |||
| 107 | // HACK DATE BY MAGE : DISPLAY PUBLICATION DATE |
||
| 108 | foreach (array_keys($photos) as $i) { |
||
| 109 | if (isset($photos[$i]['photo_date'])) { |
||
| 110 | $photos[$i]['photo_date'] = date(_SHORTDATESTRING, $photos[$i]['photo_date']); |
||
| 111 | } |
||
| 112 | } |
||
| 113 | // END HACK DATE BY MAGE : DISPLAY PUBLICATION DATE |
||
| 114 | |||
| 115 | $xoopsTpl->assign('photos', $photos); |
||
| 116 | |||
| 117 | $pageNav = new \XoopsPageNav($photoHandler->getUserAlbumCount($userId), $helper->getConfig('nb_column') * $helper->getConfig('nb_line'), $start, 'start', 'id=' . $userId . '&orderby=' . $orderby . '&sortby=' . $sortby); //xoops - blueteen - tri de l'affichage |
||
| 118 | $xoopsTpl->assign('pageNav', $pageNav->renderNav()); |
||
| 119 | |||
| 120 | $albumName = ''; |
||
| 121 | if (count($photos) > 0) { |
||
| 122 | $albumName = $photos[0]['user']['uname'] . _MD_EXTGALLERY_USERS_SUB_PHOTO_ALBUM; |
||
| 123 | $xoopsTpl->assign('xoops_pagetitle', $albumName); |
||
| 124 | $xoTheme->addMeta('meta', 'description', $albumName); |
||
| 125 | } |
||
| 126 | |||
| 127 | $jquery = $helper->getConfig('enable_jquery'); |
||
| 128 | $xoopsTpl->assign('jquery', $jquery); |
||
| 129 | if (1 == $jquery && 'none' !== $ajaxeffect) { |
||
| 130 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||
| 131 | switch ($ajaxeffect) { |
||
| 132 | case 'lightbox': |
||
| 133 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.lightbox.js'); |
||
| 134 | $xoTheme->addStylesheet('browse.php?modules/system/css/lightbox.css'); |
||
| 135 | break; |
||
| 136 | case 'tooltip': |
||
| 137 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/tooltip/image.tooltip.js'); |
||
| 138 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/tooltip/image.tooltip.css'); |
||
| 139 | break; |
||
| 140 | case 'overlay': |
||
| 141 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/overlay/overlay.jquery.tools.min.js'); |
||
| 142 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/overlay/overlay.css'); |
||
| 143 | break; |
||
| 144 | case 'fancybox': |
||
| 145 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/fancybox/mousewheel.js'); |
||
| 146 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/fancybox/fancybox.pack.js'); |
||
| 147 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/fancybox/fancybox.css'); |
||
| 148 | break; |
||
| 149 | case 'prettyphoto': |
||
| 150 | $xoTheme->addScript('browse.php?modules/extgallery/assets/js/prettyphoto/jquery.prettyPhoto.js'); |
||
| 151 | $xoTheme->addStylesheet('browse.php?modules/extgallery/assets/js/prettyphoto/prettyPhoto.css'); |
||
| 152 | break; |
||
| 153 | } |
||
| 154 | } |
||
| 155 | |||
| 156 | $rel = 'alternate'; |
||
| 157 | $attributes['rel'] = $rel; |
||
| 158 | $attributes['type'] = 'application/rss+xml'; |
||
| 159 | $attributes['title'] = _MD_EXTGALLERY_RSS; |
||
| 160 | $attributes['href'] = XOOPS_URL . '/modules/extgallery/public-rss.php'; |
||
| 161 | $xoTheme->addMeta('link', $rel, $attributes); |
||
| 162 | $xoTheme->addStylesheet('modules/extgallery/assets/css/style.css'); |
||
| 163 | |||
| 164 | $lang = ['hits' => _MD_EXTGALLERY_HITS, 'comments' => _MD_EXTGALLERY_COMMENTS, 'albumName' => $albumName]; |
||
| 165 | $xoopsTpl->assign('lang', $lang); |
||
| 166 | |||
| 167 | $xoopsTpl->assign('enableExtra', $helper->getConfig('display_extra_field')); |
||
| 168 | $xoopsTpl->assign('enableRating', $helper->getConfig('enable_rating')); |
||
| 169 | $xoopsTpl->assign('nbColumn', $helper->getConfig('nb_column')); |
||
| 170 | $xoopsTpl->assign('extgalleryName', $xoopsModule->getVar('name')); |
||
| 171 | $xoopsTpl->assign('disp_ph_title', $helper->getConfig('disp_ph_title')); |
||
| 172 | |||
| 173 | $xoopsTpl->assign('extgalleryUID', $userId); //xoops - blueteen - tri de l'affichage |
||
| 174 | $xoopsTpl->assign('extgalleryStart', $start); //xoops -blueteen - tri de l'affichage |
||
| 175 | $xoopsTpl->assign('extgallerySortbyOrderby', _MD_EXTGALLERY_ORDERBY . convertorderbytrans($SortbyOrderby)); //xoops - blueteen - tri de l'affichage |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 176 | |||
| 177 | //DNPROSSI - VOLTAN - added preferences option |
||
| 178 | // enable_info, enable_submitter_lnk, enable_photo_hits |
||
| 179 | if ('album' === $helper->getConfig('info_view') || 'both' === $helper->getConfig('info_view')) { |
||
| 180 | if ('user' === $helper->getConfig('pubusr_info_view') || 'both' === $helper->getConfig('pubusr_info_view')) { |
||
| 181 | if (0 == $helper->getConfig('enable_info')) { |
||
| 182 | $enable_info = $helper->getConfig('enable_info'); |
||
| 183 | } else { |
||
| 184 | $enable_info = 1; |
||
| 185 | } |
||
| 186 | } else { |
||
| 187 | $enable_info = 1; |
||
| 188 | } |
||
| 189 | } else { |
||
| 190 | $enable_info = 1; |
||
| 191 | } |
||
| 192 | $xoopsTpl->assign('enable_info', $enable_info); |
||
| 193 | $xoopsTpl->assign('enable_photo_hits', $helper->getConfig('enable_photo_hits')); |
||
| 194 | $xoopsTpl->assign('enable_submitter_lnk', $helper->getConfig('enable_submitter_lnk')); |
||
| 195 | $xoopsTpl->assign('enable_show_comments', $helper->getConfig('enable_show_comments')); |
||
| 196 | $xoopsTpl->assign('enable_date', $helper->getConfig('enable_date')); |
||
| 197 | $xoopsTpl->assign('show_rss', $helper->getConfig('show_rss')); |
||
| 198 | |||
| 199 | //for tooltip |
||
| 200 | $xoopsTpl->assign('album_tooltip_borderwidth', $helper->getConfig('album_tooltip_borderwidth')); |
||
| 201 | $xoopsTpl->assign('album_tooltip_bordercolor', $helper->getConfig('album_tooltip_bordercolor')); |
||
| 202 | $xoopsTpl->assign('album_tooltip_width', $helper->getConfig('album_tooltip_width')); |
||
| 203 | |||
| 204 | //for overlay |
||
| 205 | $xoopsTpl->assign('album_overlay_bg', $helper->getConfig('album_overlay_bg')); |
||
| 206 | $xoopsTpl->assign('album_overlay_width', $helper->getConfig('album_overlay_width')); |
||
| 207 | $xoopsTpl->assign('album_overlay_height', $helper->getConfig('album_overlay_height')); |
||
| 208 | |||
| 209 | //for fancybox |
||
| 210 | $xoopsTpl->assign('album_fancybox_color', $helper->getConfig('album_fancybox_color')); |
||
| 211 | $xoopsTpl->assign('album_fancybox_opacity', $helper->getConfig('album_fancybox_opacity')); |
||
| 212 | $xoopsTpl->assign('album_fancybox_tin', $helper->getConfig('album_fancybox_tin')); |
||
| 213 | $xoopsTpl->assign('album_fancybox_tout', $helper->getConfig('album_fancybox_tout')); |
||
| 214 | $xoopsTpl->assign('album_fancybox_title', $helper->getConfig('album_fancybox_title')); |
||
| 215 | $xoopsTpl->assign('album_fancybox_showtype', $helper->getConfig('album_fancybox_showtype')); |
||
| 216 | |||
| 217 | //for prettyphoto |
||
| 218 | $xoopsTpl->assign('album_prettyphoto_speed', $helper->getConfig('album_prettyphoto_speed')); |
||
| 219 | $xoopsTpl->assign('album_prettyphoto_theme', $helper->getConfig('album_prettyphoto_theme')); |
||
| 220 | $xoopsTpl->assign('album_prettyphoto_slidspeed', $helper->getConfig('album_prettyphoto_slidspe')); |
||
| 221 | $xoopsTpl->assign('album_prettyphoto_autoplay', $helper->getConfig('album_prettyphoto_autopla')); |
||
| 222 | |||
| 223 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 224 |