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