1 | <?php declare(strict_types=1); |
||||
2 | |||||
3 | /* |
||||
4 | * You may not change or alter any portion of this comment or credits |
||||
5 | * of supporting developers from this source code or any supporting source code |
||||
6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
7 | * |
||||
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 | |||||
13 | /** |
||||
14 | * @copyright XOOPS Project (https://xoops.org) |
||||
15 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||
16 | * @author XOOPS Development Team |
||||
17 | * @author Pascal Le Boustouller: original author ([email protected]) |
||||
18 | * @author Luc Bizet (www.frxoops.org) |
||||
19 | * @author jlm69 (www.jlmzone.com) |
||||
20 | * @author mamba (www.xoops.org) |
||||
21 | */ |
||||
22 | |||||
23 | use Xmf\Module\Admin; |
||||
24 | use Xmf\Request; |
||||
25 | use XoopsModules\Adslight\{ |
||||
26 | Helper, |
||||
27 | PicturesHandler, |
||||
28 | Tree, |
||||
29 | Utility |
||||
30 | }; |
||||
31 | |||||
32 | /** @var Helper $helper */ |
||||
33 | require_once __DIR__ . '/header.php'; |
||||
34 | //require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||||
35 | xoops_load('XoopsLocal'); |
||||
36 | |||||
37 | $myts = \MyTextSanitizer::getInstance(); |
||||
38 | $moduleId = $xoopsModule->getVar('mid'); |
||||
39 | |||||
40 | if (is_object($GLOBALS['xoopsUser'])) { |
||||
41 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||||
42 | } else { |
||||
43 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||
44 | } |
||||
45 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
46 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
47 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||||
48 | //If no access |
||||
49 | if (!$grouppermHandler->checkRight('adslight_view', $perm_itemid, $groups, $moduleId)) { |
||||
50 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||||
51 | } |
||||
52 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $moduleId)) { |
||||
53 | $prem_perm = '1'; |
||||
54 | } else { |
||||
55 | $prem_perm = '0'; |
||||
56 | } |
||||
57 | |||||
58 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||
59 | |||||
60 | # function viewads |
||||
61 | ##################################################### |
||||
62 | /** |
||||
63 | * @param int $lid |
||||
64 | */ |
||||
65 | function viewAds($lid = 0): void |
||||
66 | { |
||||
67 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $meta, $prem_perm, $xoopsUser; |
||||
68 | |||||
69 | $helper = Helper::getInstance(); |
||||
70 | |||||
71 | $moduleDirName = \basename(__DIR__); |
||||
72 | |||||
73 | $pathIcon16 = Admin::iconUrl('', '16'); |
||||
74 | $contact_pm = $contact = ''; |
||||
75 | $picturesArray = []; |
||||
76 | $cid = 0; |
||||
77 | |||||
78 | $tempXoopsLocal = new \XoopsLocal(); |
||||
79 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||||
80 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
81 | // require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||
82 | $lid = max((int)$lid, 0); |
||||
83 | $rate = '1' === $helper->getConfig('adslight_rate_item') ? '1' : '0'; |
||||
84 | $GLOBALS['xoopsTpl']->assign('rate', $rate); |
||||
85 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||||
86 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||||
87 | |||||
88 | // Hack redirection erreur 404 si lid=null |
||||
89 | if ('' === $lid) { |
||||
90 | header('Status: 301 Moved Permanently', false, 301); |
||||
91 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||||
92 | // exit(); |
||||
93 | $helper->redirect('404.php', 1); |
||||
94 | } |
||||
95 | |||||
96 | $GLOBALS['xoopsTpl']->assign('adslight_active_bookmark', $helper->getConfig('adslight_active_bookmark')); |
||||
97 | $GLOBALS['xoopsTpl']->assign('adslight_style_bookmark', $helper->getConfig('adslight_style_bookmark')); |
||||
98 | // $GLOBALS['xoopsTpl']->assign('adslight_active_xpayement', $helper->getConfig('adslight_active_xpayment')); |
||||
99 | |||||
100 | // adslight 2 |
||||
101 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $helper->getConfig('adslight_active_menu')); |
||||
102 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $helper->getConfig('adslight_active_rss')); |
||||
103 | |||||
104 | if ($GLOBALS['xoopsUser']) { |
||||
105 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||||
106 | if ($usid = $member_usid) { |
||||
107 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||||
108 | |||||
109 | if ('' !== $GLOBALS['xoopsUser']->getVar('name')) { |
||||
110 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('name') . ' (' . $GLOBALS['xoopsUser']->getVar('uname') . ')'); |
||||
111 | } else { |
||||
112 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('uname')); |
||||
113 | } |
||||
114 | |||||
115 | $GLOBALS['xoopsTpl']->assign('user_email', $GLOBALS['xoopsUser']->getVar('email')); |
||||
116 | |||||
117 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid={$member_usid}"; |
||||
118 | [$show_user] = $xoopsDB->fetchRow($xoopsDB->query($sql)); |
||||
119 | |||||
120 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||||
121 | $GLOBALS['xoopsTpl']->assign('show_user_link', 'members.php?uid=' . $member_usid); |
||||
122 | } |
||||
123 | } |
||||
124 | |||||
125 | if ($GLOBALS['xoopsUser']) { |
||||
126 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||
127 | } |
||||
128 | |||||
129 | $cat_perms = ''; |
||||
130 | $categories = Utility::getMyItemIds('adslight_view'); |
||||
131 | if (is_array($categories) && count($categories) > 0) { |
||||
132 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||
133 | } |
||||
134 | |||||
135 | $result = $xoopsDB->query( |
||||
136 | 'SELECT l.lid, l.cid, l.title, l.status, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.typecondition, l.date_created, l.email, l.submitter, l.usid, l.town, l.country, l.contactby, l.premium, l.valid, l.photo, l.hits, l.item_rating, l.item_votes, l.user_rating, l.user_votes, l.comments, p.cod_img, p.lid, p.uid_owner, p.url FROM ' |
||||
137 | . $xoopsDB->prefix('adslight_listing') |
||||
138 | . ' l LEFT JOIN ' |
||||
139 | . $xoopsDB->prefix('adslight_pictures') |
||||
140 | . " p ON l.lid=p.lid WHERE l.valid='Yes' AND l.lid = " |
||||
141 | . $xoopsDB->escape($lid) |
||||
142 | . " and l.status!='1' {$cat_perms}" |
||||
143 | ); |
||||
144 | $recordexist = $xoopsDB->getRowsNum($result); |
||||
145 | |||||
146 | // Hack redirection erreur 404 si recordexist=null |
||||
147 | if ('' === $recordexist) { |
||||
148 | header('Status: 301 Moved Permanently', false, 301); |
||||
149 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||||
150 | // exit(); |
||||
151 | $helper->redirect('404.php', 1); |
||||
152 | } |
||||
153 | |||||
154 | if ($recordexist) { |
||||
155 | [ |
||||
156 | $lid, |
||||
157 | $cid, |
||||
158 | $title, |
||||
159 | $status, |
||||
160 | $expire, |
||||
161 | $type, |
||||
162 | $desctext, |
||||
163 | $tel, |
||||
164 | $price, |
||||
165 | $typeprice, |
||||
166 | $typecondition, |
||||
167 | $date_created, |
||||
168 | $email, |
||||
169 | $submitter, |
||||
170 | $usid, |
||||
171 | $town, |
||||
172 | $country, |
||||
173 | $contactby, |
||||
174 | $premium, |
||||
175 | $valid, |
||||
176 | $photo, |
||||
177 | $hits, |
||||
178 | $item_rating, |
||||
179 | $item_votes, |
||||
180 | $user_rating, |
||||
181 | $user_votes, |
||||
182 | $comments, |
||||
183 | $cod_img, |
||||
184 | $pic_lid, |
||||
185 | $uid_owner, |
||||
186 | $url, |
||||
187 | ] = $xoopsDB->fetchRow($result); |
||||
188 | |||||
189 | $newcount = $helper->getConfig('adslight_countday'); |
||||
190 | $startdate = time() - (86400 * $newcount); |
||||
191 | if ($startdate < $date_created) { |
||||
192 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||||
193 | $GLOBALS['xoopsTpl']->assign('new', $newitem); |
||||
194 | } |
||||
195 | |||||
196 | $updir = $helper->getConfig('adslight_link_upload'); |
||||
197 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||||
198 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||||
199 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||||
200 | $GLOBALS['xoopsTpl']->assign('ad_exists', $recordexist); |
||||
201 | $GLOBALS['xoopsTpl']->assign('mydirname', $moduleDirName); |
||||
202 | |||||
203 | $count = 0; |
||||
204 | $x = 0; |
||||
205 | $i = 0; |
||||
206 | $sql = 'SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid); |
||||
207 | $result3 = $xoopsDB->query($sql); |
||||
208 | [$ccid, $pid, $ctitle] = $xoopsDB->fetchRow($result3); |
||||
209 | |||||
210 | $GLOBALS['xoopsTpl']->assign('category_title', $ctitle); |
||||
211 | |||||
212 | $moduleId = $xoopsModule->getVar('mid'); |
||||
213 | if (is_object($GLOBALS['xoopsUser'])) { |
||||
214 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||||
215 | } else { |
||||
216 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||
217 | } |
||||
218 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
219 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
220 | $GLOBALS['xoopsTpl']->assign('purchasable', $grouppermHandler->checkRight('adslight_purchase', $cid, $groups, $moduleId)); |
||||
221 | |||||
222 | $ctitle = \htmlspecialchars($ctitle, ENT_QUOTES | ENT_HTML5); |
||||
223 | $varid[$x] = $ccid; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||||
224 | $varnom[$x] = $ctitle; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
225 | |||||
226 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="Yes" AND cid=' . $xoopsDB->escape($cid) . ' AND status!="1"'; |
||||
227 | [$nbe] = $xoopsDB->fetchRow($xoopsDB->query($sql)); |
||||
228 | if (0 !== (int)$pid) { |
||||
229 | $x = 1; |
||||
230 | while (0 !== (int)$pid) { |
||||
231 | $sql = 'SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($pid); |
||||
232 | $result4 = $xoopsDB->query($sql); |
||||
233 | [$ccid, $pid, $ctitle] = $xoopsDB->fetchRow($result4); |
||||
234 | |||||
235 | $ctitle = \htmlspecialchars($ctitle, ENT_QUOTES | ENT_HTML5); |
||||
236 | $varid[$x] = $ccid; |
||||
237 | $varnom[$x] = $ctitle; |
||||
238 | ++$x; |
||||
239 | } |
||||
240 | --$x; |
||||
241 | } |
||||
242 | $subcats = ''; |
||||
243 | $arrow = ' <img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="»" >'; |
||||
244 | while (-1 !== $x) { |
||||
245 | $subcats .= ' ' . $arrow . ' <a href="viewcats.php?cid=' . $varid[$x] . '">' . $varnom[$x] . '</a>'; |
||||
246 | --$x; |
||||
247 | } |
||||
248 | $GLOBALS['xoopsTpl']->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'); |
||||
249 | $GLOBALS['xoopsTpl']->assign('nav_sub', $subcats); |
||||
250 | $GLOBALS['xoopsTpl']->assign('nav_subcount', $nbe); |
||||
251 | $viewcount_judge = true; |
||||
252 | $useroffset = ''; |
||||
253 | if ($GLOBALS['xoopsUser']) { |
||||
254 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||||
255 | if (isset($timezone)) { |
||||
256 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||||
257 | } else { |
||||
258 | $useroffset = $xoopsConfig['default_TZ']; |
||||
259 | } |
||||
260 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||||
261 | $adslight_admin = true; |
||||
0 ignored issues
–
show
|
|||||
262 | } else { |
||||
263 | $adslight_admin = false; |
||||
264 | } |
||||
265 | |||||
266 | if (($adslight_admin = true) |
||||
267 | || ($GLOBALS['xoopsUser']->getVar('uid') === $usid)) { |
||||
268 | $viewcount_judge = false; |
||||
269 | } |
||||
270 | |||||
271 | $contact_pm = '<a href="' . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . addslashes($usid) . '"> ' . _ADSLIGHT_CONTACT_BY_PM . '</a>'; |
||||
272 | } |
||||
273 | if ($viewcount_judge) { |
||||
274 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_listing') . ' SET hits=hits+1 WHERE lid = ' . $xoopsDB->escape($lid)); |
||||
275 | } |
||||
276 | if (1 === $item_votes) { |
||||
277 | $votestring = _ADSLIGHT_ONEVOTE; |
||||
278 | } else { |
||||
279 | $votestring = sprintf(_ADSLIGHT_NUMVOTES, $item_votes); |
||||
280 | } |
||||
281 | $date_created = ((int)$useroffset * 3600) + $date_created; |
||||
282 | $date2 = $date_created + ($expire * 86400); |
||||
283 | $date_created = formatTimestamp($date_created, 's'); |
||||
284 | $date2 = formatTimestamp($date2, 's'); |
||||
285 | |||||
286 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||
287 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||||
288 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||
289 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||
290 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||
291 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||
292 | // $price = XoopsLocal::number_format($price, 2, ',', ' '); |
||||
293 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||
294 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||
295 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||
296 | $usid = \htmlspecialchars($usid, ENT_QUOTES | ENT_HTML5); |
||||
297 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||
298 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||
299 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||
300 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||
301 | if (2 === (int)$status) { |
||||
302 | $sold = _ADSLIGHT_RESERVED; |
||||
303 | } else { |
||||
304 | $sold = ''; |
||||
305 | } |
||||
306 | |||||
307 | $GLOBALS['xoopsTpl']->assign('printA', '<a href="print.php?op=PrintAd&lid=' . $lid . '" ><img src="assets/images/print.gif" border=0 alt="' . _ADSLIGHT_PRINT . '" ></a> '); |
||||
308 | |||||
309 | if ($usid > 0) { |
||||
310 | $GLOBALS['xoopsTpl']->assign('submitter', '<img src="assets/images/lesannonces.png" border="0" alt="' . _ADSLIGHT_VIEW_MY_ADS . '" > <a href="members.php?usid=' . addslashes($usid) . '" >' . _ADSLIGHT_VIEW_MY_ADS . ' ' . $submitter . '</a>'); |
||||
311 | } else { |
||||
312 | $GLOBALS['xoopsTpl']->assign('submitter', _ADSLIGHT_VIEW_MY_ADS . ' $submitter'); |
||||
313 | } |
||||
314 | $GLOBALS['xoopsTpl']->assign('lid', $lid); |
||||
315 | $GLOBALS['xoopsTpl']->assign('read', "{$hits} " . _ADSLIGHT_VIEW2); |
||||
316 | $GLOBALS['xoopsTpl']->assign('rating', $tempXoopsLocal->number_format($item_rating)); |
||||
317 | $GLOBALS['xoopsTpl']->assign('votes', $votestring); |
||||
318 | $GLOBALS['xoopsTpl']->assign('lang_rating', _ADSLIGHT_RATINGC); |
||||
319 | $GLOBALS['xoopsTpl']->assign('lang_ratethisitem', _ADSLIGHT_RATETHISITEM); |
||||
320 | $GLOBALS['xoopsTpl']->assign('xoop_user', false); |
||||
321 | $isOwner = ''; |
||||
322 | if ($GLOBALS['xoopsUser']) { |
||||
323 | $GLOBALS['xoopsTpl']->assign('xoop_user', true); |
||||
324 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||
325 | if ($usid == $currentid) { |
||||
326 | $GLOBALS['xoopsTpl']->assign('modifyads', '<img src=' . $pathIcon16 . '/edit.png border="0" alt="' . _ADSLIGHT_MODIFANN . '" > <a href="modify.php?op=modad&lid=' . $lid . '">' . _ADSLIGHT_MODIFANN . '</a>'); |
||||
327 | $GLOBALS['xoopsTpl']->assign('deleteads', '<img src=' . $pathIcon16 . '/delete.png border="0" alt="' . _ADSLIGHT_SUPPRANN . '" > <a href="modify.php?op=ListingDel&lid=' . $lid . '">' . _ADSLIGHT_SUPPRANN . '</a>'); |
||||
328 | $GLOBALS['xoopsTpl']->assign('add_photos', '<img src="assets/images/shape_square_add.png" border="0" alt="' . _ADSLIGHT_SUPPRANN . '" > <a href="view_photos.php?lid=' . $lid . '&uid=' . $usid . '">' . _ADSLIGHT_ADD_PHOTOS . '</a>'); |
||||
329 | |||||
330 | $isOwner = true; |
||||
331 | $GLOBALS['xoopsTpl']->assign('isOwner', $isOwner); |
||||
332 | } |
||||
333 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||||
334 | $GLOBALS['xoopsTpl']->assign('admin', '<a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php?op=modifyAds&lid=' . $lid . '"><img src=' . $pathIcon16 . '/edit.png border=0 alt="' . _ADSLIGHT_MODADMIN . '" ></a>'); |
||||
335 | } |
||||
336 | } |
||||
337 | |||||
338 | $sql = 'SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"; |
||||
339 | $result7 = $xoopsDB->query($sql); |
||||
340 | [$nom_type] = $xoopsDB->fetchRow($result7); |
||||
341 | |||||
342 | $sql = 'SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"; |
||||
343 | $result8 = $xoopsDB->query($sql); |
||||
344 | [$nom_price] = $xoopsDB->fetchRow($result8); |
||||
345 | |||||
346 | $sql = 'SELECT nom_condition FROM ' . $xoopsDB->prefix('adslight_condition') . " WHERE id_condition='" . $xoopsDB->escape($typecondition) . "'"; |
||||
347 | $result9 = $xoopsDB->query($sql); |
||||
348 | [$nom_condition] = $xoopsDB->fetchRow($result9); |
||||
349 | |||||
350 | $GLOBALS['xoopsTpl']->assign('type', htmlspecialchars($nom_type, ENT_QUOTES | ENT_HTML5)); |
||||
351 | $GLOBALS['xoopsTpl']->assign('title', $title); |
||||
352 | $GLOBALS['xoopsTpl']->assign('status', $status); |
||||
353 | $GLOBALS['xoopsTpl']->assign('desctext', $desctext); |
||||
354 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title . ' - ' . $town . ': ' . $country . ' - ' . $ctitle); |
||||
355 | |||||
356 | // meta description tags for ads |
||||
357 | $desctextclean = strip_tags($desctext, '<span><img><strong><i><u>'); |
||||
358 | $GLOBALS['xoTheme']->addMeta('meta', 'description', "{$title} - " . mb_substr($desctextclean, 0, 150)); |
||||
359 | |||||
360 | $currencyCode = $helper->getConfig('adslight_currency_code'); |
||||
361 | $currencySymbol = $helper->getConfig('adslight_currency_symbol'); |
||||
362 | $currencyPosition = $helper->getConfig('currency_position'); |
||||
363 | $formattedCurrencyUtilityTemp = Utility::formatCurrencyTemp($price, $currencyCode, $currencySymbol, $currencyPosition); |
||||
364 | |||||
365 | if ($price > 0) { |
||||
366 | $GLOBALS['xoopsTpl']->assign('price', '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $helper->getConfig('adslight_currency_symbol') . ' - ' . $typeprice); |
||||
367 | $GLOBALS['xoopsTpl']->assign('price_head', _ADSLIGHT_PRICE2); |
||||
368 | $GLOBALS['xoopsTpl']->assign('price_price', $formattedCurrencyUtilityTemp); |
||||
369 | |||||
370 | $priceTypeprice = \htmlspecialchars($nom_price, ENT_QUOTES | ENT_HTML5); |
||||
371 | $GLOBALS['xoopsTpl']->assign('price_typeprice', $priceTypeprice); |
||||
372 | $priceCurrency = $helper->getConfig('adslight_currency_code'); |
||||
373 | $GLOBALS['xoopsTpl']->assign('price_currency', $priceCurrency); |
||||
374 | |||||
375 | // $priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $helper->getConfig('adslight_currency_symbol') . ' - ' . $typeprice; |
||||
376 | |||||
377 | $priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $formattedCurrencyUtilityTemp . ' - ' . $priceTypeprice; |
||||
378 | |||||
379 | $GLOBALS['xoopsTpl']->assign('price', $priceHtml); |
||||
380 | |||||
381 | $GLOBALS['xoopsTpl']->assign('price_amount', $price); |
||||
382 | } |
||||
383 | |||||
384 | $GLOBALS['xoopsTpl']->assign('condition_typecondition', $nom_condition); |
||||
385 | $GLOBALS['xoopsTpl']->assign('premium', $premium); |
||||
386 | |||||
387 | // $GLOBALS['xoopsTpl']->assign('mustlogin', _ADSLIGHT_MUSTLOGIN); |
||||
388 | $GLOBALS['xoopsTpl']->assign('redirect', '' . '?xoops_redirect=/modules/adslight/index.php'); |
||||
389 | |||||
390 | if ($town) { |
||||
391 | $GLOBALS['xoopsTpl']->assign('local_town', $town); |
||||
392 | } |
||||
393 | if (1 === $helper->getConfig('adslight_use_country')) { |
||||
394 | if ($country) { |
||||
395 | $GLOBALS['xoopsTpl']->assign('local_country', $country); |
||||
396 | $GLOBALS['xoopsTpl']->assign('country_head', '<img src="assets/images/world_go.png" border="0" alt="country" > ' . _ADSLIGHT_COUNTRY); |
||||
397 | } |
||||
398 | } |
||||
399 | |||||
400 | $tphon = ''; |
||||
401 | if ($tel) { |
||||
402 | $tphon = '<br>' . _ADSLIGHT_ORBY . ' <strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||||
403 | } |
||||
404 | if (1 === (int)$contactby) { |
||||
405 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . ''; |
||||
406 | } |
||||
407 | if (2 === (int)$contactby) { |
||||
408 | $contact = $contact_pm . '' . $tphon; |
||||
409 | } |
||||
410 | if (3 === (int)$contactby) { |
||||
411 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . '<br>' . _ADSLIGHT_ORBY . '' . $contact_pm; |
||||
412 | } |
||||
413 | if (4 === (int)$contactby) { |
||||
414 | $contact = '<br><strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||||
415 | } |
||||
416 | // $GLOBALS['xoopsTpl']->assign('contact', $contact); |
||||
417 | $GLOBALS['xoopsTpl']->assign('local_head', '<img src="assets/images/house.png" border="0" alt="local_head" > ' . _ADSLIGHT_LOCAL); |
||||
418 | |||||
419 | if ($lid) { |
||||
420 | if ($sold) { |
||||
421 | $GLOBALS['xoopsTpl']->assign('bullinfotext', $sold); |
||||
422 | } elseif ($GLOBALS['xoopsUser']) { |
||||
423 | $GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_CONTACT_SUBMITTER . ' ' . $submitter . ' ' . _ADSLIGHT_CONTACTBY2 . ' ' . $contact); |
||||
424 | } else { |
||||
425 | $GLOBALS['xoopsTpl']->assign('bullinfotext', '<span style="color: #de090e;"><b>' . _ADSLIGHT_MUSTLOGIN . '</b></span>'); |
||||
426 | } |
||||
427 | } |
||||
428 | |||||
429 | $user_profile = \XoopsUser::getUnameFromId($usid); |
||||
0 ignored issues
–
show
$usid of type string is incompatible with the type integer expected by parameter $userid of XoopsUser::getUnameFromId() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
430 | $GLOBALS['xoopsTpl']->assign('user_profile', '<img src="assets/images/profil.png" border="0" alt="' . _ADSLIGHT_PROFILE . '" > <a rel="nofollow" href="' . XOOPS_URL . '/user.php?usid=' . addslashes($usid) . '">' . _ADSLIGHT_PROFILE . ' ' . $user_profile . '</a>'); |
||||
431 | if ('' !== $photo) { |
||||
432 | $criteria_lid = new \Criteria('lid', $lid); |
||||
433 | $criteria_uid = new \Criteria('uid', $usid); |
||||
434 | $picturesHandler = $helper->getHandler('Pictures'); |
||||
435 | $pictures_object_array = $picturesHandler->getObjects($criteria_lid, $criteria_uid); |
||||
0 ignored issues
–
show
$criteria_uid of type Criteria is incompatible with the type boolean expected by parameter $id_as_key of XoopsModules\Adslight\Pi...esHandler::getObjects() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
436 | $pictures_number = $picturesHandler->getCount($criteria_lid); |
||||
437 | if (0 === $pictures_number) { |
||||
438 | $nopicturesyet = _ADSLIGHT_NOTHINGYET; |
||||
439 | $GLOBALS['xoopsTpl']->assign('lang_nopicyet', $nopicturesyet); |
||||
440 | } else { |
||||
441 | /** |
||||
442 | * Let's populate an array with the data from the pictures |
||||
443 | */ |
||||
444 | $i = 0; |
||||
445 | foreach ($pictures_object_array as $picture) { |
||||
446 | $picturesArray[$i]['url'] = $picture->getVar('url', 's'); |
||||
447 | $picturesArray[$i]['desc'] = $picture->getVar('title', 's'); |
||||
448 | $picturesArray[$i]['cod_img'] = $picture->getVar('cod_img', 's'); |
||||
449 | $picturesArray[$i]['lid'] = $picture->getVar('lid', 's'); |
||||
450 | $GLOBALS['xoopsTpl']->assign('pics_array', $picturesArray); |
||||
451 | |||||
452 | ++$i; |
||||
453 | } |
||||
454 | } |
||||
455 | $owner = new \XoopsUser(); |
||||
456 | $identifier = $owner::getUnameFromId($usid); |
||||
457 | |||||
458 | Utility::loadLightbox(); // JJDai |
||||
459 | /* |
||||
460 | if (1 === $helper->getConfig('adslight_lightbox')) { |
||||
461 | |||||
462 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||||
463 | <script type="text/javascript" src="assets/lightbox/js/jquery-1.7.2.min.js"></script> |
||||
464 | <script type="text/javascript" src="assets/lightbox/js/jquery-ui-1.8.18.custom.min"></script> |
||||
465 | <script type="text/javascript" src="assets/lightbox/js/jquery.smooth-scroll.min.js"></script> |
||||
466 | <script type="text/javascript" src="assets/lightbox/js/lightbox.js"></script> |
||||
467 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" > |
||||
468 | <link rel="stylesheet" type="text/css" media="screen" href="assets/lightbox/css/lightbox.css"></link>'; |
||||
469 | } else { |
||||
470 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||||
471 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" >'; |
||||
472 | } |
||||
473 | */ |
||||
474 | |||||
475 | $GLOBALS['xoopsTpl']->assign('path_uploads', $helper->getConfig('adslight_link_upload')); |
||||
476 | |||||
477 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||||
478 | if ($helper->getConfig('active_rewriteurl') > 0) { |
||||
479 | /* ici le meta Canonicale pour le Rewrite */ |
||||
480 | //$GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||||
481 | } |
||||
482 | //$GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||||
483 | |||||
484 | $GLOBALS['xoopsTpl']->assign('photo', $photo); |
||||
485 | $GLOBALS['xoopsTpl']->assign('pic_lid', $pic_lid); |
||||
486 | $GLOBALS['xoopsTpl']->assign('pic_owner', $uid_owner); |
||||
487 | } else { |
||||
488 | $GLOBALS['xoopsTpl']->assign('photo', ''); |
||||
489 | } |
||||
490 | $GLOBALS['xoopsTpl']->assign( |
||||
491 | 'date_created', |
||||
492 | '<img alt="date_created" border="0" src="assets/images/date.png" > <strong>' . _ADSLIGHT_DATE2 . ':</strong> ' . $date_created . '<br><img alt="date_error" border="0" src="assets/images/date_error.png" > <strong>' . _ADSLIGHT_DISPO . ':</strong> ' . $date2 |
||||
493 | ); |
||||
494 | } else { |
||||
495 | $GLOBALS['xoopsTpl']->assign('no_ad', _ADSLIGHT_NOCLAS); |
||||
496 | } |
||||
497 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid); |
||||
498 | $result8 = $xoopsDB->query($sql); |
||||
499 | |||||
500 | [$ctitle] = $xoopsDB->fetchRow($result8); |
||||
501 | $GLOBALS['xoopsTpl']->assign('friend', '<img src="assets/images/friend.gif" border="0" alt="' . _ADSLIGHT_SENDFRIENDS . '" > <a rel="nofollow" href="sendfriend.php?op=SendFriend&lid=' . $lid . '">' . _ADSLIGHT_SENDFRIENDS . '</a>'); |
||||
502 | |||||
503 | $GLOBALS['xoopsTpl']->assign('alerteabus', '<img src="assets/images/error.png" border="0" alt="' . _ADSLIGHT_ALERTEABUS . '" > <a rel="nofollow" href="report-abuse.php?op=ReportAbuse&lid=' . $lid . '">' . _ADSLIGHT_ALERTEABUS . '</a>'); |
||||
504 | |||||
505 | $GLOBALS['xoopsTpl']->assign('link_main', '<a href="../adslight/">' . _ADSLIGHT_MAIN . '</a>'); |
||||
506 | $GLOBALS['xoopsTpl']->assign('link_cat', '<a href="viewcats.php?cid=' . addslashes($cid) . '">' . _ADSLIGHT_GORUB . ' ' . $ctitle . '</a>'); |
||||
507 | |||||
508 | $GLOBALS['xoopsTpl']->assign('printA', '<img src="assets/images/print.gif" border="0" alt="' . _ADSLIGHT_PRINT . '" > <a rel="nofollow" href="print.php?op=PrintAd&lid=' . $lid . '">' . _ADSLIGHT_PRINT . '</a>'); |
||||
509 | |||||
510 | //($helper->getConfig('useRating') == 1); |
||||
511 | if ((is_dir('../rating'))) { |
||||
512 | require XOOPS_ROOT_PATH . '/modules/rating/include/rating.php'; |
||||
513 | $GLOBALS['xoopsTpl']->assign('ratingPerm', true); |
||||
514 | $GLOBALS['xoopsTpl']->assign('ratings', rating($lid)); |
||||
0 ignored issues
–
show
The function
rating was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
515 | } else { |
||||
516 | $GLOBALS['xoopsTpl']->assign('ratingPerm', false); |
||||
517 | } |
||||
518 | } |
||||
519 | |||||
520 | # function categorynewgraphic |
||||
521 | ##################################################### |
||||
522 | /** |
||||
523 | * @param $cid |
||||
524 | * @return string |
||||
525 | */ |
||||
526 | function categorynewgraphic($cid): string |
||||
527 | { |
||||
528 | global $xoopsDB; |
||||
529 | $helper = Helper::getInstance(); |
||||
530 | |||||
531 | $cat_perms = ''; |
||||
532 | $categories = Utility::getMyItemIds('adslight_view'); |
||||
533 | if (is_array($categories) && count($categories) > 0) { |
||||
534 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||
535 | } |
||||
536 | |||||
537 | $sql = 'SELECT date_created FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE cid=' . $xoopsDB->escape($cid) . ' AND valid = "Yes" ' . $cat_perms . ' ORDER BY date_created DESC LIMIT 1'; |
||||
538 | $newresult = $xoopsDB->query($sql); |
||||
539 | [$date_created] = $xoopsDB->fetchRow($newresult); |
||||
540 | |||||
541 | $newcount = $helper->getConfig('adslight_countday'); |
||||
542 | $startdate = time() - (86400 * $newcount); |
||||
543 | if ($startdate < $date_created) { |
||||
544 | return '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||||
545 | } |
||||
0 ignored issues
–
show
The function implicitly returns
null when the if condition on line 543 is false . This is incompatible with the type-hinted return string . Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
![]() |
|||||
546 | } |
||||
547 | |||||
548 | ###################################################### |
||||
549 | |||||
550 | $pa = Request::getInt('pa', null, 'GET'); |
||||
551 | $lid = Request::getInt('lid', null, 'GET'); |
||||
552 | $cid = Request::getInt('cid', null, 'GET'); |
||||
553 | $usid = Request::getString('usid', '', 'GET'); |
||||
554 | $min = Request::getInt('min', null, 'GET'); |
||||
555 | $show = Request::getInt('show', null, 'GET'); |
||||
556 | $orderby = Request::getInt('orderby', null, 'GET'); |
||||
557 | |||||
558 | switch ($pa) { |
||||
559 | default: |
||||
560 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||||
561 | |||||
562 | viewAds($lid); |
||||
563 | require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||
564 | break; |
||||
565 | } |
||||
566 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
567 |