These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | ------------------------------------------------------------------------- |
||
4 | ADSLIGHT 2 : Module for Xoops |
||
5 | |||
6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||
7 | Started with the Classifieds module and made MANY changes |
||
8 | Website : http://www.luc-bizet.fr |
||
9 | Contact : [email protected] |
||
10 | ------------------------------------------------------------------------- |
||
11 | Original credits below Version History |
||
12 | ########################################################################## |
||
13 | # Classified Module for Xoops # |
||
14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||
15 | # Started with the MyAds module and made MANY changes # |
||
16 | ########################################################################## |
||
17 | Original Author: Pascal Le Boustouller |
||
18 | Author Website : [email protected] |
||
19 | Licence Type : GPL |
||
20 | ------------------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | use Xmf\Request; |
||
24 | |||
25 | require_once __DIR__ . '/header.php'; |
||
26 | //require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
0 ignored issues
–
show
|
|||
27 | xoops_load('XoopsLocal'); |
||
28 | |||
29 | $myts = MyTextSanitizer::getInstance(); |
||
30 | $module_id = $xoopsModule->getVar('mid'); |
||
31 | |||
32 | View Code Duplication | if (is_object($GLOBALS['xoopsUser'])) { |
|
33 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
34 | } else { |
||
35 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
36 | } |
||
37 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
38 | $gpermHandler = xoops_getHandler('groupperm'); |
||
39 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
40 | //If no access |
||
41 | View Code Duplication | if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
42 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
43 | } |
||
44 | if (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||
45 | $prem_perm = '0'; |
||
46 | } else { |
||
47 | $prem_perm = '1'; |
||
48 | } |
||
49 | |||
50 | include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php'; |
||
51 | //include XOOPS_ROOT_PATH . '/modules/adslight/class/utility.php'; |
||
52 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
53 | |||
54 | # function viewads |
||
55 | ##################################################### |
||
56 | /** |
||
57 | * @param int $lid |
||
58 | */ |
||
59 | function viewAds($lid = 0) |
||
60 | { |
||
61 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $meta, $moduleDirName, $main_lang, $prem_perm, $xoopsModule; |
||
62 | global $xoopsModuleConfig, $xoopsUser; |
||
63 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||
64 | $contact_pm = $contact = ''; |
||
65 | $pictures_array = array(); |
||
66 | $cid = 0; |
||
67 | |||
68 | $tempXoopsLocal = new XoopsLocal; |
||
69 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||
70 | include XOOPS_ROOT_PATH . '/header.php'; |
||
71 | include XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
72 | $lid = ((int)$lid > 0) ? (int)$lid : 0; |
||
73 | $rate = ($GLOBALS['xoopsModuleConfig']['adslight_rate_item'] == '1') ? '1' : '0'; |
||
74 | $xoopsTpl->assign('rate', $rate); |
||
75 | $xoopsTpl->assign('xmid', $xoopsModule->getVar('mid')); |
||
76 | $xoopsTpl->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
77 | |||
78 | // Hack redirection erreur 404 si lid=null |
||
79 | View Code Duplication | if ($lid == '') { |
|
80 | header('Status: 301 Moved Permanently', false, 301); |
||
81 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||
82 | // exit(); |
||
83 | redirect_header(XOOPS_URL . '/modules/adslight/404.php', 1); |
||
84 | } |
||
85 | |||
86 | $xoopsTpl->assign('adslight_active_bookmark', $GLOBALS['xoopsModuleConfig']['adslight_active_bookmark']); |
||
87 | $xoopsTpl->assign('adslight_style_bookmark', $GLOBALS['xoopsModuleConfig']['adslight_style_bookmark']); |
||
88 | $xoopsTpl->assign('adslight_active_xpayement', $GLOBALS['xoopsModuleConfig']['adslight_active_xpayment']); |
||
89 | |||
90 | // adslight 2 |
||
91 | $xoopsTpl->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||
92 | $xoopsTpl->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||
93 | |||
94 | if ($GLOBALS['xoopsUser']) { |
||
95 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
96 | if ($usid = $member_usid) { |
||
97 | $xoopsTpl->assign('istheirs', true); |
||
98 | |||
99 | if (strlen($GLOBALS['xoopsUser']->getVar('name'))) { |
||
100 | $xoopsTpl->assign('user_name', $GLOBALS['xoopsUser']->getVar('name') . ' (' . $GLOBALS['xoopsUser']->getVar('uname') . ')'); |
||
101 | } else { |
||
102 | $xoopsTpl->assign('user_name', $GLOBALS['xoopsUser']->getVar('uname')); |
||
103 | } |
||
104 | |||
105 | $xoopsTpl->assign('user_email', $GLOBALS['xoopsUser']->getVar('email')); |
||
106 | |||
107 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid=$member_usid")); |
||
108 | |||
109 | $xoopsTpl->assign('show_user', $show_user); |
||
110 | $xoopsTpl->assign('show_user_link', 'members.php?usid=' . $member_usid); |
||
111 | } |
||
112 | } |
||
113 | |||
114 | if ($GLOBALS['xoopsUser']) { |
||
115 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
116 | } |
||
117 | |||
118 | $cat_perms = ''; |
||
119 | $categories = AdslightUtility::getMyItemIds('adslight_view'); |
||
120 | if (is_array($categories) && count($categories) > 0) { |
||
121 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
122 | } |
||
123 | |||
124 | $result = $xoopsDB->query('SELECT l.lid, l.cid, l.title, l.status, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.typeusure, l.date, 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 ' |
||
125 | . $xoopsDB->prefix('adslight_listing') |
||
126 | . ' l LEFT JOIN ' |
||
127 | . $xoopsDB->prefix('adslight_pictures') |
||
128 | . " p ON l.lid=p.lid WHERE l.valid='Yes' AND l.lid = " |
||
129 | . $xoopsDB->escape($lid) |
||
130 | . " and l.status!='1' $cat_perms"); |
||
131 | $recordexist = $xoopsDB->getRowsNum($result); |
||
132 | |||
133 | // Hack redirection erreur 404 si recordexist=null |
||
134 | View Code Duplication | if ($recordexist == '') { |
|
135 | header('Status: 301 Moved Permanently', false, 301); |
||
136 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||
137 | // exit(); |
||
138 | redirect_header(XOOPS_URL . '/modules/adslight/404.php', 1); |
||
139 | } |
||
140 | |||
141 | if ($recordexist) { |
||
142 | list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid, $photo, $hits, $item_rating, $item_votes, $user_rating, $user_votes, $comments, $cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($result); |
||
143 | |||
144 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||
145 | $startdate = (time() - (86400 * $newcount)); |
||
146 | if ($startdate < $date) { |
||
147 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||
148 | $xoopsTpl->assign('new', $newitem); |
||
149 | } |
||
150 | |||
151 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
152 | $xoopsTpl->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
153 | $xoopsTpl->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
154 | $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
155 | $xoopsTpl->assign('ad_exists', $recordexist); |
||
156 | $xoopsTpl->assign('mydirname', $moduleDirName); |
||
157 | |||
158 | $count = 0; |
||
159 | $x = 0; |
||
160 | $i = 0; |
||
161 | |||
162 | $result3 = $xoopsDB->query('SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid)); |
||
163 | list($ccid, $pid, $ctitle) = $xoopsDB->fetchRow($result3); |
||
164 | |||
165 | $xoopsTpl->assign('category_title', $ctitle); |
||
166 | |||
167 | $module_id = $xoopsModule->getVar('mid'); |
||
168 | View Code Duplication | if (is_object($GLOBALS['xoopsUser'])) { |
|
169 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
170 | } else { |
||
171 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
172 | } |
||
173 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
174 | $gpermHandler = xoops_getHandler('groupperm'); |
||
175 | $xoopsTpl->assign('purchasable', $gpermHandler->checkRight('adslight_purchase', $cid, $groups, $module_id)); |
||
176 | |||
177 | $ctitle = $myts->htmlSpecialChars($ctitle); |
||
178 | $varid[$x] = $ccid; |
||
179 | $varnom[$x] = $ctitle; |
||
180 | |||
181 | list($nbe) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="Yes" AND cid=' . $xoopsDB->escape($cid) . ' AND status!="1"')); |
||
182 | |||
183 | if ($pid != 0) { |
||
184 | $x = 1; |
||
185 | while ($pid != 0) { |
||
186 | $result4 = $xoopsDB->query('SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($pid)); |
||
187 | list($ccid, $pid, $ctitle) = $xoopsDB->fetchRow($result4); |
||
188 | |||
189 | $ctitle = $myts->htmlSpecialChars($ctitle); |
||
190 | $varid[$x] = $ccid; |
||
191 | $varnom[$x] = $ctitle; |
||
192 | ++$x; |
||
193 | } |
||
194 | --$x; |
||
195 | } |
||
196 | $subcats = ''; |
||
197 | $arrow = ' <img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="»" >'; |
||
198 | while ($x != -1) { |
||
199 | $subcats .= ' ' . $arrow . ' <a href="viewcats.php?cid=' . $varid[$x] . '">' . $varnom[$x] . '</a>'; |
||
200 | --$x; |
||
201 | } |
||
202 | $xoopsTpl->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'); |
||
203 | $xoopsTpl->assign('nav_sub', $subcats); |
||
204 | $xoopsTpl->assign('nav_subcount', $nbe); |
||
205 | $viewcount_judge = true; |
||
206 | $useroffset = ''; |
||
207 | if ($GLOBALS['xoopsUser']) { |
||
208 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
209 | if (isset($timezone)) { |
||
210 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||
211 | } else { |
||
212 | $useroffset = $xoopsConfig['default_TZ']; |
||
213 | } |
||
214 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
215 | $adslight_admin = true; |
||
216 | } else { |
||
217 | $adslight_admin = false; |
||
218 | } |
||
219 | |||
220 | if (($adslight_admin = true) |
||
221 | || ($GLOBALS['xoopsUser']->getVar('uid') == $usid) |
||
222 | ) { |
||
223 | $viewcount_judge = false; |
||
224 | } |
||
225 | |||
226 | $contact_pm = '<a href="' . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . addslashes($usid) . '"> ' . _ADSLIGHT_CONTACT_BY_PM . '</a>'; |
||
227 | } |
||
228 | if (true === $viewcount_judge) { |
||
229 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_listing') . ' SET hits=hits+1 WHERE lid = ' . $xoopsDB->escape($lid)); |
||
230 | } |
||
231 | if ($item_votes == 1) { |
||
232 | $votestring = _ADSLIGHT_ONEVOTE; |
||
233 | } else { |
||
234 | $votestring = sprintf(_ADSLIGHT_NUMVOTES, $item_votes); |
||
235 | } |
||
236 | $date = ($useroffset * 3600) + $date; |
||
237 | $date2 = $date + ($expire * 86400); |
||
238 | $date = formatTimestamp($date, 's'); |
||
239 | $date2 = formatTimestamp($date2, 's'); |
||
240 | $title = $myts->htmlSpecialChars($title); |
||
241 | $status = $myts->htmlSpecialChars($status); |
||
242 | $expire = $myts->htmlSpecialChars($expire); |
||
243 | $type = $myts->htmlSpecialChars($type); |
||
244 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
245 | $tel = $myts->htmlSpecialChars($tel); |
||
246 | // $price = XoopsLocal::number_format($price, 2, ',', ' '); |
||
247 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
248 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
249 | $submitter = $myts->htmlSpecialChars($submitter); |
||
250 | $usid = $myts->htmlSpecialChars($usid); |
||
251 | $town = $myts->htmlSpecialChars($town); |
||
252 | $country = $myts->htmlSpecialChars($country); |
||
253 | $contactby = $myts->htmlSpecialChars($contactby); |
||
254 | $premium = $myts->htmlSpecialChars($premium); |
||
255 | |||
256 | if ($status == 2) { |
||
257 | $sold = _ADSLIGHT_RESERVED; |
||
258 | } else { |
||
259 | $sold = ''; |
||
260 | } |
||
261 | |||
262 | $xoopsTpl->assign('printA', '<a href="print.php?op=PrintAd&lid=' . $lid . '" ><img src="assets/images/print.gif" border=0 alt="' . _ADSLIGHT_PRINT . '" ></a> '); |
||
263 | |||
264 | if ($usid > 0) { |
||
265 | $xoopsTpl->assign('submitter', '<img src="assets/images/lesannonces.png" border="0" alt="' |
||
266 | . _ADSLIGHT_VIEW_MY_ADS |
||
267 | . '" > <a href="members.php?usid=' |
||
268 | . addslashes($usid) |
||
269 | . '" >' |
||
270 | . _ADSLIGHT_VIEW_MY_ADS |
||
271 | . ' ' |
||
272 | . $submitter |
||
273 | . '</a>'); |
||
274 | } else { |
||
275 | $xoopsTpl->assign('submitter', _ADSLIGHT_VIEW_MY_ADS . ' $submitter'); |
||
276 | } |
||
277 | $xoopsTpl->assign('lid', $lid); |
||
278 | $xoopsTpl->assign('read', "$hits " . _ADSLIGHT_VIEW2); |
||
279 | $xoopsTpl->assign('rating', $tempXoopsLocal->number_format($item_rating, 2)); |
||
280 | $xoopsTpl->assign('votes', $votestring); |
||
281 | $xoopsTpl->assign('lang_rating', _ADSLIGHT_RATINGC); |
||
282 | $xoopsTpl->assign('lang_ratethisitem', _ADSLIGHT_RATETHISITEM); |
||
283 | $xoopsTpl->assign('xoop_user', false); |
||
284 | $isOwner = ''; |
||
285 | if ($GLOBALS['xoopsUser']) { |
||
286 | $xoopsTpl->assign('xoop_user', true); |
||
287 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
288 | if ($usid == $currentid) { |
||
289 | $xoopsTpl->assign('modifyads', '<img src=' |
||
290 | . $pathIcon16 |
||
291 | . '/edit.png border="0" alt="' |
||
292 | . _ADSLIGHT_MODIFANN |
||
293 | . '" > <a href="modify.php?op=ModAd&lid=' |
||
294 | . $lid |
||
295 | . '">' |
||
296 | . _ADSLIGHT_MODIFANN |
||
297 | . '</a>'); |
||
298 | $xoopsTpl->assign('deleteads', '<img src=' |
||
299 | . $pathIcon16 |
||
300 | . '/delete.png border="0" alt="' |
||
301 | . _ADSLIGHT_SUPPRANN |
||
302 | . '" > <a href="modify.php?op=ListingDel&lid=' |
||
303 | . $lid |
||
304 | . '">' |
||
305 | . _ADSLIGHT_SUPPRANN |
||
306 | . '</a>'); |
||
307 | $xoopsTpl->assign('add_photos', '<img src="assets/images/shape_square_add.png" border="0" alt="' |
||
308 | . _ADSLIGHT_SUPPRANN |
||
309 | . '" > <a href="view_photos.php?lid=' |
||
310 | . $lid |
||
311 | . '&uid=' |
||
312 | . $usid |
||
313 | . '">' |
||
314 | . _ADSLIGHT_ADD_PHOTOS |
||
315 | . '</a>'); |
||
316 | |||
317 | $isOwner = true; |
||
318 | $xoopsTpl->assign('isOwner', $isOwner); |
||
319 | } |
||
320 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
321 | $xoopsTpl->assign('admin', '<a href="' |
||
322 | . XOOPS_URL |
||
323 | . '/modules/adslight/admin/modify_ads.php?op=ModifyAds&lid=' |
||
324 | . $lid |
||
325 | . '"><img src=' |
||
326 | . $pathIcon16 |
||
327 | . '/edit.png border=0 alt="' |
||
328 | . _ADSLIGHT_MODADMIN |
||
329 | . '" ></a>'); |
||
330 | } |
||
331 | } |
||
332 | |||
333 | $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"); |
||
334 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||
335 | |||
336 | $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"); |
||
337 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||
338 | |||
339 | $result9 = $xoopsDB->query('SELECT nom_usure FROM ' . $xoopsDB->prefix('adslight_usure') . " WHERE id_usure='" . $xoopsDB->escape($typeusure) . "'"); |
||
340 | list($nom_usure) = $xoopsDB->fetchRow($result9); |
||
341 | |||
342 | $xoopsTpl->assign('type', $myts->htmlSpecialChars($nom_type)); |
||
343 | $xoopsTpl->assign('title', $title); |
||
344 | $xoopsTpl->assign('status', $status); |
||
345 | $xoopsTpl->assign('desctext', $desctext); |
||
346 | $xoopsTpl->assign('xoops_pagetitle', $title . ' - ' . $town . ': ' . $country . ' - ' . $ctitle); |
||
347 | |||
348 | // meta description tags for ads |
||
349 | $desctextclean = strip_tags($desctext, '<font><img><strong><i><u>'); |
||
350 | $GLOBALS['xoTheme']->addMeta('meta', 'description', "$title - " . substr($desctextclean, 0, 150)); |
||
351 | |||
352 | if ($price > 0) { |
||
353 | $xoopsTpl->assign('price', '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ' - ' . $typeprice); |
||
354 | $xoopsTpl->assign('price_head', _ADSLIGHT_PRICE2); |
||
355 | // $xoopsTpl->assign('price_price', $price.' '.$GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'].' '); |
||
356 | |||
357 | $xoopsTpl->assign('price_price', AdslightUtility::getMoneyFormat('%.2n', $price)); |
||
358 | |||
359 | $xoopsTpl->assign('price_typeprice', $myts->htmlSpecialChars($nom_price)); |
||
360 | $xoopsTpl->assign('price_currency', $GLOBALS['xoopsModuleConfig']['adslight_currency_code']); |
||
361 | $xoopsTpl->assign('price_amount', $price); |
||
362 | } |
||
363 | |||
364 | $xoopsTpl->assign('usure_typeusure', $nom_usure); |
||
365 | $xoopsTpl->assign('premium', $premium); |
||
366 | |||
367 | // $xoopsTpl->assign('mustlogin', _ADSLIGHT_MUSTLOGIN); |
||
368 | $xoopsTpl->assign('redirect', '' . '?xoops_redirect=/modules/adslight/index.php'); |
||
369 | |||
370 | if ($town) { |
||
371 | $xoopsTpl->assign('local_town', $town); |
||
372 | } |
||
373 | if ($GLOBALS['xoopsModuleConfig']['adslight_use_country'] == 1) { |
||
374 | if ($country) { |
||
375 | $xoopsTpl->assign('local_country', $country); |
||
376 | $xoopsTpl->assign('country_head', '<img src="assets/images/world_go.png" border="0" alt="country" > ' . _ADSLIGHT_COUNTRY); |
||
377 | } |
||
378 | } |
||
379 | |||
380 | $tphon = ''; |
||
381 | if ($tel) { |
||
382 | $tphon = '<br>' . _ADSLIGHT_ORBY . ' <strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||
383 | } |
||
384 | |||
385 | if ($contactby == 1) { |
||
386 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . ''; |
||
387 | } |
||
388 | if ($contactby == 2) { |
||
389 | $contact = $contact_pm . '' . $tphon; |
||
390 | } |
||
391 | if ($contactby == 3) { |
||
392 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . '<br>' . _ADSLIGHT_ORBY . '' . $contact_pm; |
||
393 | } |
||
394 | if ($contactby == 4) { |
||
395 | $contact = '<br><strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||
396 | } |
||
397 | // $xoopsTpl->assign('contact', $contact); |
||
398 | $xoopsTpl->assign('local_head', '<img src="assets/images/house.png" border="0" alt="local_head" > ' . _ADSLIGHT_LOCAL); |
||
399 | |||
400 | if ($lid) { |
||
401 | if ($sold) { |
||
402 | $xoopsTpl->assign('bullinfotext', $sold); |
||
403 | } else { |
||
404 | if ($GLOBALS['xoopsUser']) { |
||
405 | $xoopsTpl->assign('bullinfotext', _ADSLIGHT_CONTACT_SUBMITTER . ' ' . $submitter . ' ' . _ADSLIGHT_CONTACTBY2 . ' ' . $contact); |
||
406 | } else { |
||
407 | $xoopsTpl->assign('bullinfotext', '<span style="color: #de090e;"><b>' . _ADSLIGHT_MUSTLOGIN . '</b></span>'); |
||
408 | } |
||
409 | } |
||
410 | } |
||
411 | |||
412 | $user_profile = XoopsUser::getUnameFromId($usid); |
||
413 | $xoopsTpl->assign('user_profile', '<img src="assets/images/profil.png" border="0" alt="' |
||
414 | . _ADSLIGHT_PROFILE |
||
415 | . '" > <a rel="nofollow" href="' |
||
416 | . XOOPS_URL |
||
417 | . '/user.php?usid=' |
||
418 | . addslashes($usid) |
||
419 | . '">' |
||
420 | . _ADSLIGHT_PROFILE |
||
421 | . ' ' |
||
422 | . $user_profile |
||
423 | . '</a>'); |
||
424 | |||
425 | if ($photo != '') { |
||
426 | require_once __DIR__ . '/class/pictures.php'; |
||
427 | |||
428 | $criteria_lid = new criteria('lid', $lid); |
||
429 | $criteria_uid = new criteria('uid', $usid); |
||
430 | $album_factory = new AdslightPicturesHandler($xoopsDB); |
||
431 | $pictures_object_array = $album_factory->getObjects($criteria_lid, $criteria_uid); |
||
432 | $pictures_number = $album_factory->getCount($criteria_lid, $criteria_uid); |
||
433 | View Code Duplication | if ($pictures_number == 0) { |
|
434 | $nopicturesyet = _ADSLIGHT_NOTHINGYET; |
||
435 | $xoopsTpl->assign('lang_nopicyet', $nopicturesyet); |
||
436 | } else { |
||
437 | |||
438 | /** |
||
439 | * Lets populate an array with the data from the pictures |
||
440 | */ |
||
441 | $i = 0; |
||
442 | foreach ($pictures_object_array as $picture) { |
||
443 | $pictures_array[$i]['url'] = $picture->getVar('url', 's'); |
||
444 | $pictures_array[$i]['desc'] = $picture->getVar('title', 's'); |
||
445 | $pictures_array[$i]['cod_img'] = $picture->getVar('cod_img', 's'); |
||
446 | $pictures_array[$i]['lid'] = $picture->getVar('lid', 's'); |
||
447 | $xoopsTpl->assign('pics_array', $pictures_array); |
||
448 | |||
449 | ++$i; |
||
450 | } |
||
451 | } |
||
452 | $owner = new XoopsUser(); |
||
453 | $identifier = $owner->getUnameFromId($usid); |
||
454 | if ($GLOBALS['xoopsModuleConfig']['adslight_lightbox'] == 1) { |
||
455 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||
456 | <script type="text/javascript" src="assets/lightbox/js/jquery-1.7.2.min.js"></script> |
||
457 | <script type="text/javascript" src="assets/lightbox/js/jquery-ui-1.8.18.custom.min"></script> |
||
458 | <script type="text/javascript" src="assets/lightbox/js/jquery.smooth-scroll.min.js"></script> |
||
459 | <script type="text/javascript" src="assets/lightbox/js/lightbox.js"></script> |
||
460 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" > |
||
461 | <link rel="stylesheet" type="text/css" media="screen" href="assets/lightbox/css/lightbox.css"></link>'; |
||
462 | } else { |
||
463 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||
464 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" >'; |
||
465 | } |
||
466 | |||
467 | $xoopsTpl->assign('path_uploads', $GLOBALS['xoopsModuleConfig']['adslight_link_upload']); |
||
468 | |||
469 | $xoopsTpl->assign('permit', $prem_perm); |
||
470 | |||
471 | if ($GLOBALS['xoopsModuleConfig']['active_rewriteurl'] > 0) { |
||
472 | /* ici le meta Canonicale pour le Rewrite */ |
||
473 | $xoopsTpl->assign('xoops_module_header', $header_lightbox); |
||
474 | } else { |
||
475 | $xoopsTpl->assign('xoops_module_header', $header_lightbox); |
||
476 | } |
||
477 | $xoopsTpl->assign('photo', $photo); |
||
478 | $xoopsTpl->assign('pic_lid', $pic_lid); |
||
479 | $xoopsTpl->assign('pic_owner', $uid_owner); |
||
480 | } else { |
||
481 | $xoopsTpl->assign('photo', ''); |
||
482 | } |
||
483 | $xoopsTpl->assign('date', '<img alt="date" border="0" src="assets/images/date.png" > <strong>' |
||
484 | . _ADSLIGHT_DATE2 |
||
485 | . ':</strong> ' |
||
486 | . $date |
||
487 | . '<br><img alt="date_error" border="0" src="assets/images/date_error.png" > <strong>' |
||
488 | . _ADSLIGHT_DISPO |
||
489 | . ':</strong> ' |
||
490 | . $date2); |
||
491 | } else { |
||
492 | $xoopsTpl->assign('no_ad', _ADSLIGHT_NOCLAS); |
||
493 | } |
||
494 | $result8 = $xoopsDB->query('SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid)); |
||
495 | |||
496 | list($ctitle) = $xoopsDB->fetchRow($result8); |
||
497 | $xoopsTpl->assign('friend', '<img src="assets/images/friend.gif" border="0" alt="' |
||
498 | . _ADSLIGHT_SENDFRIENDS |
||
499 | . '" > <a rel="nofollow" href="sendfriend.php?op=SendFriend&lid=' |
||
500 | . $lid |
||
501 | . '">' |
||
502 | . _ADSLIGHT_SENDFRIENDS |
||
503 | . '</a>'); |
||
504 | |||
505 | $xoopsTpl->assign('alerteabus', '<img src="assets/images/error.png" border="0" alt="' |
||
506 | . _ADSLIGHT_ALERTEABUS |
||
507 | . '" > <a rel="nofollow" href="report-abuse.php?op=ReportAbuse&lid=' |
||
508 | . $lid |
||
509 | . '">' |
||
510 | . _ADSLIGHT_ALERTEABUS |
||
511 | . '</a>'); |
||
512 | |||
513 | $xoopsTpl->assign('link_main', '<a href="../adslight/">' . _ADSLIGHT_MAIN . '</a>'); |
||
514 | $xoopsTpl->assign('link_cat', '<a href="viewcats.php?cid=' . addslashes($cid) . '">' . _ADSLIGHT_GORUB . ' ' . $ctitle . '</a>'); |
||
515 | |||
516 | $xoopsTpl->assign('printA', '<img src="assets/images/print.gif" border="0" alt="' |
||
517 | . _ADSLIGHT_PRINT |
||
518 | . '" > <a rel="nofollow" href="print.php?op=PrintAd&lid=' |
||
519 | . $lid |
||
520 | . '">' |
||
521 | . _ADSLIGHT_PRINT |
||
522 | . '</a>'); |
||
523 | } |
||
524 | |||
525 | # function categorynewgraphic |
||
526 | ##################################################### |
||
527 | /** |
||
528 | * @param $cid |
||
529 | * |
||
530 | * @return string |
||
531 | */ |
||
532 | function categorynewgraphic($cid) |
||
533 | { |
||
534 | global $xoopsDB; |
||
535 | |||
536 | $cat_perms = ''; |
||
537 | $categories = AdslightUtility::getMyItemIds('adslight_view'); |
||
538 | if (is_array($categories) && count($categories) > 0) { |
||
539 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
540 | } |
||
541 | |||
542 | $newresult = $xoopsDB->query('SELECT date FROM ' |
||
543 | . $xoopsDB->prefix('adslight_listing') |
||
544 | . ' WHERE cid=' |
||
545 | . $xoopsDB->escape($cid) |
||
546 | . ' AND valid = "Yes" ' |
||
547 | . $cat_perms |
||
548 | . ' ORDER BY DATE DESC LIMIT 1'); |
||
549 | list($date) = $xoopsDB->fetchRow($newresult); |
||
550 | |||
551 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||
552 | $startdate = (time() - (86400 * $newcount)); |
||
553 | if ($startdate < $date) { |
||
554 | return '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||
555 | } |
||
556 | } |
||
557 | |||
558 | ###################################################### |
||
559 | |||
560 | $pa = Request::getInt('pa', null, 'GET'); |
||
561 | $lid = Request::getInt('lid', null, 'GET'); |
||
562 | $cid = Request::getInt('cid', null, 'GET'); |
||
563 | $usid = Request::getString('usid', '', 'GET'); |
||
564 | $min = Request::getInt('min', null, 'GET'); |
||
565 | $show = Request::getInt('show', null, 'GET'); |
||
566 | $orderby = Request::getInt('orderby', null, 'GET'); |
||
567 | |||
568 | switch ($pa) { |
||
569 | |||
570 | default: |
||
571 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||
572 | |||
573 | viewAds($lid); |
||
574 | break; |
||
575 | } |
||
576 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
577 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.