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 | use XoopsModules\Adslight; |
||
25 | |||
26 | require_once __DIR__ . '/header.php'; |
||
27 | //require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
28 | xoops_load('XoopsLocal'); |
||
29 | $tempXoopsLocal = new \XoopsLocal(); |
||
30 | $myts = \MyTextSanitizer::getInstance(); |
||
31 | $module_id = $xoopsModule->getVar('mid'); |
||
32 | |||
33 | if (is_object($GLOBALS['xoopsUser'])) { |
||
34 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
35 | } else { |
||
36 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
37 | } |
||
38 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
39 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
40 | |||
41 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
42 | |||
43 | if (!$grouppermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
||
44 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
45 | } |
||
46 | if (!$grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||
47 | $prem_perm = '0'; |
||
48 | } else { |
||
49 | $prem_perm = '1'; |
||
50 | } |
||
51 | |||
52 | $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
53 | |||
54 | # function view (categories) |
||
55 | ##################################################### |
||
56 | /** |
||
57 | * @param int $cid |
||
58 | * @param int $min |
||
59 | * @param $orderby |
||
60 | * @param int $show |
||
61 | */ |
||
62 | function adsView($cid, $min, $orderby, $show = 0) |
||
63 | { |
||
64 | global $xoopsDB, $xoopsTpl, $xoopsConfig, $myts, $mytree, $imagecat, $meta, $mid, $prem_perm, $xoopsModule; |
||
65 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||
66 | |||
67 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_category.tpl'; |
||
68 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
69 | |||
70 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||
71 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
72 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
73 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
74 | $GLOBALS['xoopsTpl']->assign('only_pix', _ADSLIGHT_ONLYPIX); |
||
75 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
76 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||
77 | |||
78 | $GLOBALS['xoopsTpl']->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >'); |
||
79 | |||
80 | // $adslight_use_catscode = $GLOBALS['xoopsModuleConfig']['adslight_use_catscode']; |
||
81 | // $adslight_cats_code = $GLOBALS['xoopsModuleConfig']['adslight_cats_code']; |
||
82 | |||
83 | $GLOBALS['xoopsTpl']->assign('adslight_use_catscode', $GLOBALS['xoopsModuleConfig']['adslight_use_catscode']); |
||
84 | $GLOBALS['xoopsTpl']->assign('adslight_cats_code', $GLOBALS['xoopsModuleConfig']['adslight_cats_code']); |
||
85 | |||
86 | $banner = xoops_getbanner(); |
||
87 | $GLOBALS['xoopsTpl']->assign('banner', $banner); |
||
88 | // $index_code_place = $GLOBALS['xoopsModuleConfig']['adslight_index_code_place']; |
||
89 | // $use_extra_code = $GLOBALS['xoopsModuleConfig']['adslight_use_index_code']; |
||
90 | // $adslight_use_banner = $GLOBALS['xoopsModuleConfig']['adslight_use_banner']; |
||
91 | // $index_extra_code = $GLOBALS['xoopsModuleConfig']['adslight_index_code']; |
||
92 | |||
93 | $GLOBALS['xoopsTpl']->assign('use_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_use_index_code']); |
||
94 | $GLOBALS['xoopsTpl']->assign('adslight_use_banner', $GLOBALS['xoopsModuleConfig']['adslight_use_banner']); |
||
95 | $GLOBALS['xoopsTpl']->assign('index_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_index_code']); |
||
96 | $GLOBALS['xoopsTpl']->assign('index_code_place', $GLOBALS['xoopsModuleConfig']['adslight_index_code_place']); |
||
97 | |||
98 | // adslight 2 |
||
99 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||
100 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||
101 | |||
102 | /// No Adds in this Cat /// |
||
103 | $submit_perms = Adslight\Utility::getMyItemIds('adslight_submit'); |
||
104 | |||
105 | if (is_array($submit_perms) && $GLOBALS['xoopsUser'] |
||
106 | && count($submit_perms) > 0) { |
||
107 | $GLOBALS['xoopsTpl']->assign('not_adds_in_this_cat', '' . _ADSLIGHT_ADD_LISTING_NOTADDSINTHISCAT . '<a href="addlisting.php?cid=' . addslashes($cid) . '">' . _ADSLIGHT_ADD_LISTING_NOTADDSSUBMIT . '</a>'); |
||
108 | } else { |
||
109 | $GLOBALS['xoopsTpl']->assign('not_adds_in_this_cat', '' . _ADSLIGHT_ADD_LISTING_NOTADDSINTHISCAT . '<br>' . _ADSLIGHT_ADD_LISTING_BULL . '<a href="' . XOOPS_URL . '/register.php">' . _ADSLIGHT_ADD_LISTING_SUB . '</a>.'); |
||
110 | } |
||
111 | |||
112 | $GLOBALS['xoopsTpl']->assign('Feed_RSS_cat', ' <a href="rss.php?cid=' . addslashes($cid) . '"><img border="0" alt="Feed RSS" src="assets/images/rssfeed_buttons.png" ></a>'); |
||
113 | |||
114 | if ($GLOBALS['xoopsUser']) { |
||
115 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
116 | if ($usid = $member_usid) { |
||
117 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||
118 | |||
119 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $member_usid . ' ')); |
||
120 | |||
121 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||
122 | $GLOBALS['xoopsTpl']->assign('show_user_link', 'members.php?usid=' . $member_usid); |
||
123 | } |
||
124 | } |
||
125 | |||
126 | $default_sort = $GLOBALS['xoopsModuleConfig']['adslight_lsort_order']; |
||
127 | |||
128 | $cid = ((int)$cid > 0) ? (int)$cid : 0; |
||
129 | $min = ((int)$min > 0) ? (int)$min : 0; |
||
130 | $show = ((int)$show > 0) ? (int)$show : $GLOBALS['xoopsModuleConfig']['adslight_perpage']; |
||
131 | $max = $min + $show; |
||
132 | $orderby = isset($orderby) ? Adslight\Utility::convertOrderByIn($orderby) : $default_sort; |
||
133 | |||
134 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
135 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
136 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
137 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
138 | $GLOBALS['xoopsTpl']->assign('subcat_title2', _ADSLIGHT_ANNONCES); |
||
139 | |||
140 | $categories = Adslight\Utility::getMyItemIds('adslight_view'); |
||
141 | |||
142 | //TO DO - check on permissions here |
||
143 | // if ($categories && is_array($categories)) { |
||
144 | // if (!in_array($cid, $categories)) { |
||
145 | // redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM); |
||
146 | // } |
||
147 | // } else { // User can't see any category |
||
148 | // redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
149 | // } |
||
150 | |||
151 | $arrow = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="»" >'; |
||
152 | |||
153 | $pathstring = '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'; |
||
154 | $pathstring .= $mytree->getNicePathFromId($cid, 'title', 'viewcats.php?'); |
||
155 | $GLOBALS['xoopsTpl']->assign('module_name', $xoopsModule->getVar('name')); |
||
156 | $GLOBALS['xoopsTpl']->assign('category_path', $pathstring); |
||
157 | $GLOBALS['xoopsTpl']->assign('category_id', $cid); |
||
158 | |||
159 | $countresult = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE cid=' . $xoopsDB->escape($cid) . ' AND valid="Yes" AND status!="1"'); |
||
160 | list($trow) = $xoopsDB->fetchRow($countresult); |
||
161 | $trows = $trow; |
||
162 | |||
163 | $cat_perms = ''; |
||
164 | if (is_array($categories) && count($categories) > 0) { |
||
165 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
166 | } |
||
167 | |||
168 | $result = $xoopsDB->query('SELECT cid, pid, title, cat_desc, cat_keywords FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid) . ' ' . $cat_perms); |
||
169 | list($cid, $pid, $title, $cat_desc, $cat_keywords) = $xoopsDB->fetchRow($result); |
||
170 | |||
171 | $GLOBALS['xoopsTpl']->assign('cat_desc', $cat_desc); |
||
172 | $GLOBALS['xoopsTpl']->assign('cat_title', _ADSLIGHT_ANNONCES . ' ' . $title); |
||
173 | $GLOBALS['xoopsTpl']->assign('cat_keywords', $cat_keywords); |
||
174 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
||
175 | |||
176 | if ($cat_desc > '0') { |
||
177 | // meta description & keywords tags for categories |
||
178 | $cat_desc_clean = strip_tags($cat_desc, '<span><img><strong><i><u>'); |
||
179 | $cat_keywords_clean = strip_tags($cat_keywords, '<span><img><strong><i><u><br><li>'); |
||
180 | |||
181 | $GLOBALS['xoTheme']->addMeta('meta', 'description', '' . mb_substr($cat_desc_clean, 0, 200)); |
||
182 | $GLOBALS['xoTheme']->addMeta('meta', 'keywords', '' . mb_substr($cat_keywords_clean, 0, 1000)); |
||
183 | } |
||
184 | |||
185 | $submit_perms = Adslight\Utility::getMyItemIds('adslight_submit'); |
||
186 | if (is_array($submit_perms) && $GLOBALS['xoopsUser'] |
||
187 | && count($submit_perms) > 0) { |
||
188 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULLCATS . '<a href="addlisting.php?cid=' . addslashes($cid) . '">' . _ADSLIGHT_ADD_LISTING_SUBOK . '</a>'; |
||
189 | } else { // User can't see any category |
||
190 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULLCATSOK . '<a href="' . XOOPS_URL . '/register.php">' . _ADSLIGHT_ADD_LISTING_SUB . '</a>.'; |
||
191 | } |
||
192 | |||
193 | if (0 != $pid || 1 == $GLOBALS['xoopsModuleConfig']['adslight_main_cat']) { |
||
194 | $GLOBALS['xoopsTpl']->assign('bullinfotext', $add_listing); |
||
195 | } |
||
196 | |||
197 | $arr = []; |
||
198 | $arr = $mytree->getFirstChild($cid, 'title'); |
||
199 | |||
200 | if (count($arr) > 0) { |
||
201 | $scount = 1; |
||
202 | foreach ($arr as $ele) { |
||
203 | if (in_array($ele['cid'], $categories)) { |
||
204 | $sub_arr = []; |
||
205 | $sub_arr = $mytree->getFirstChild($ele['cid'], 'title'); |
||
206 | $space = 0; |
||
207 | $chcount = 0; |
||
208 | $infercategories = ''; |
||
209 | $totallisting = Adslight\Utility::getTotalItems($ele['cid'], 1); |
||
210 | foreach ($sub_arr as $sub_ele) { |
||
211 | if (in_array($sub_ele['cid'], $categories)) { |
||
212 | $chtitle = $myts->htmlSpecialChars($sub_ele['title']); |
||
213 | |||
214 | if ($chcount > 5) { |
||
215 | $infercategories .= '...'; |
||
216 | break; |
||
217 | } |
||
218 | if ($space > 0) { |
||
219 | $infercategories .= ', '; |
||
220 | } |
||
221 | $infercategories .= '<a href="' . XOOPS_URL . '/modules/adslight/viewcats.php?cid=' . $sub_ele['cid'] . '">' . $chtitle . '</a>'; |
||
222 | |||
223 | $infercategories .= ' (' . Adslight\Utility::getTotalItems($sub_ele['cid']) . ')'; |
||
224 | $infercategories .= ' ' . categorynewgraphic($sub_ele['cid']) . ''; |
||
0 ignored issues
–
show
|
|||
225 | ++$space; |
||
226 | ++$chcount; |
||
227 | } |
||
228 | } |
||
229 | |||
230 | $GLOBALS['xoopsTpl']->append('subcategories', [ |
||
231 | 'title' => $myts->htmlSpecialChars($ele['title']), |
||
232 | 'id' => $ele['cid'], |
||
233 | 'infercategories' => $infercategories, |
||
234 | 'totallisting' => $totallisting, |
||
235 | '', |
||
236 | ]); |
||
237 | |||
238 | ++$scount; |
||
239 | $GLOBALS['xoopsTpl']->assign('lang_subcat', _ADSLIGHT_AVAILAB); |
||
240 | } |
||
241 | } |
||
242 | } |
||
243 | |||
244 | $pagenav = ''; |
||
245 | if ($trows > '0') { |
||
246 | $GLOBALS['xoopsTpl']->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD); |
||
247 | $GLOBALS['xoopsTpl']->assign('last_head_title', _ADSLIGHT_TITLE); |
||
248 | $GLOBALS['xoopsTpl']->assign('last_head_price', _ADSLIGHT_PRICE); |
||
249 | $GLOBALS['xoopsTpl']->assign('last_head_date', _ADSLIGHT_DATE); |
||
250 | $GLOBALS['xoopsTpl']->assign('last_head_local', _ADSLIGHT_LOCAL2); |
||
251 | $GLOBALS['xoopsTpl']->assign('last_head_hits', _ADSLIGHT_VIEW); |
||
252 | $GLOBALS['xoopsTpl']->assign('last_head_photo', _ADSLIGHT_PHOTO); |
||
253 | $GLOBALS['xoopsTpl']->assign('cat', $cid); |
||
254 | $GLOBALS['xoopsTpl']->assign('min', $min); |
||
255 | $rank = 1; |
||
256 | |||
257 | $cat_perms = ''; |
||
258 | if (is_array($categories) && count($categories) > 0) { |
||
259 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
260 | } |
||
261 | |||
262 | $sql = 'SELECT lid, title, status, type, price, typeprice, date, town, country, contactby, usid, premium, valid, photo, hits FROM ' |
||
263 | . $xoopsDB->prefix('adslight_listing') |
||
264 | . ' WHERE valid="Yes" AND cid=' |
||
265 | . $xoopsDB->escape($cid) |
||
266 | . ' AND status!="1" ' |
||
267 | . $cat_perms |
||
268 | . ' ORDER BY ' |
||
269 | . $orderby |
||
270 | . ''; |
||
271 | $result1 = $xoopsDB->query($sql, $show, $min); |
||
272 | if ($trows > '1') { |
||
273 | $GLOBALS['xoopsTpl']->assign('show_nav', true); |
||
274 | $orderbyTrans = Adslight\Utility::convertOrderByTrans($orderby); |
||
275 | $GLOBALS['xoopsTpl']->assign('lang_sortby', _ADSLIGHT_SORTBY); |
||
276 | $GLOBALS['xoopsTpl']->assign('lang_title', _ADSLIGHT_TITLE); |
||
277 | $GLOBALS['xoopsTpl']->assign('lang_titleatoz', _ADSLIGHT_TITLEATOZ); |
||
278 | $GLOBALS['xoopsTpl']->assign('lang_titleztoa', _ADSLIGHT_TITLEZTOA); |
||
279 | $GLOBALS['xoopsTpl']->assign('lang_date', _ADSLIGHT_DATE); |
||
280 | $GLOBALS['xoopsTpl']->assign('lang_dateold', _ADSLIGHT_DATEOLD); |
||
281 | $GLOBALS['xoopsTpl']->assign('lang_datenew', _ADSLIGHT_DATENEW); |
||
282 | $GLOBALS['xoopsTpl']->assign('lang_price', _ADSLIGHT_PRICE); |
||
283 | $GLOBALS['xoopsTpl']->assign('lang_priceltoh', _ADSLIGHT_PRICELTOH); |
||
284 | $GLOBALS['xoopsTpl']->assign('lang_pricehtol', _ADSLIGHT_PRICEHTOL); |
||
285 | $GLOBALS['xoopsTpl']->assign('lang_popularity', _ADSLIGHT_POPULARITY); |
||
286 | $GLOBALS['xoopsTpl']->assign('lang_popularityleast', _ADSLIGHT_POPULARITYLTOM); |
||
287 | $GLOBALS['xoopsTpl']->assign('lang_popularitymost', _ADSLIGHT_POPULARITYMTOL); |
||
288 | $GLOBALS['xoopsTpl']->assign('lang_cursortedby', sprintf(_ADSLIGHT_CURSORTEDBY, Adslight\Utility::convertOrderByTrans($orderby))); |
||
289 | } |
||
290 | |||
291 | while (false !== (list($lid, $title, $status, $type, $price, $typeprice, $date, $town, $country, $contactby, $usid, $premium, $valid, $photo, $hits) = $xoopsDB->fetchRow($result1))) { |
||
292 | $a_item = []; |
||
293 | $title = $myts->htmlSpecialChars($title); |
||
294 | $type = $myts->htmlSpecialChars($type); |
||
295 | // $price = number_format($price, 2, ',', ' '); |
||
296 | $town = $myts->htmlSpecialChars($town); |
||
297 | $country = $myts->htmlSpecialChars($country); |
||
298 | $contactby = $myts->htmlSpecialChars($contactby); |
||
299 | $useroffset = ''; |
||
300 | |||
301 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||
302 | $startdate = (time() - (86400 * $newcount)); |
||
303 | if ($startdate < $date) { |
||
304 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" >'; |
||
305 | $a_item['new'] = $newitem; |
||
306 | } |
||
307 | if ($GLOBALS['xoopsUser']) { |
||
308 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
309 | if (isset($timezone)) { |
||
310 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||
311 | } else { |
||
312 | $useroffset = $xoopsConfig['default_TZ']; |
||
313 | } |
||
314 | } |
||
315 | $date = ($useroffset * 3600) + $date; |
||
316 | $date = formatTimestamp($date, 's'); |
||
317 | if ($GLOBALS['xoopsUser']) { |
||
318 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
319 | $a_item['admin'] = '<a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php?op=modifyAds&lid=' . $lid . '"><img src="' . $pathIcon16 . '/edit.png' . '" border=0 alt="' . _ADSLIGHT_MODADMIN . '" title="' . _ADSLIGHT_MODADMIN . '"></a>'; |
||
320 | } |
||
321 | } |
||
322 | |||
323 | $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"); |
||
324 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||
325 | |||
326 | $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"); |
||
327 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||
328 | |||
329 | $a_item['type'] = $myts->htmlSpecialChars($nom_type); |
||
330 | $a_item['title'] = '<a href="viewads.php?lid=' . $lid . '"><strong>' . $title . '</strong></a>'; |
||
331 | $a_item['status'] = $status; |
||
332 | if ($price > 0) { |
||
333 | // $a_item['price'] = $price. ' '. $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'].''; |
||
334 | $a_item['price'] = Adslight\Utility::getMoneyFormat('%.2n', $price); |
||
335 | $a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
||
336 | } |
||
337 | $a_item['date'] = $date; |
||
338 | $a_item['local'] = ''; |
||
339 | if ($town) { |
||
340 | $a_item['local'] .= $town; |
||
341 | } |
||
342 | $a_item['country'] = ''; |
||
343 | if ($country) { |
||
344 | $a_item['country'] = $country; |
||
345 | } |
||
346 | |||
347 | $cat = addslashes($cid); |
||
348 | if (2 == $status) { |
||
349 | $a_item['sold'] = _ADSLIGHT_RESERVEDMEMBER; |
||
350 | } |
||
351 | |||
352 | if ($GLOBALS['xoopsModuleConfig']['active_thumbscats'] > 0) { |
||
353 | $a_item['no_photo'] = '<a href="' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '"><img class="thumb" src="' . XOOPS_URL . '/modules/adslight/assets/images/nophoto.jpg" align="left" width="100px" alt="' . $title . '" ></a>'; |
||
354 | |||
355 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
356 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE uid_owner=' . $xoopsDB->escape($usid) . ' AND lid=' . $xoopsDB->escape($lid) . ' ORDER BY date_added ASC LIMIT 1'; |
||
357 | $resultp = $xoopsDB->query($sql); |
||
358 | |||
359 | while (false !== (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp))) { |
||
360 | if ($photo) { |
||
361 | $a_item['photo'] = '<a href="' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '"><img class="thumb" src="' . $updir . '/thumbs/thumb_' . $url . '" align="left" width="100px" alt="' . $title . '" ></a>'; |
||
362 | } |
||
363 | } |
||
364 | } else { |
||
365 | $a_item['no_photo'] = '<p><img src="' . XOOPS_URL . '/modules/adslight/assets/images/camera_nophoto.png" align="left" width="24" alt="' . $title . '" ></p>'; |
||
366 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
367 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE uid_owner=' . $xoopsDB->escape($usid) . ' AND lid=' . $xoopsDB->escape($lid) . ' ORDER BY date_added ASC LIMIT 1'; |
||
368 | $resultp = $xoopsDB->query($sql); |
||
369 | while (false !== (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp))) { |
||
370 | if ($photo) { |
||
371 | $a_item['photo'] = '<p><img src="' . XOOPS_URL . '/modules/adslight/assets/images/camera_photo.png" align="left" width="24" alt="' . $title . '" ></p>'; |
||
372 | } |
||
373 | } |
||
374 | } |
||
375 | |||
376 | $a_item['hits'] = $hits; |
||
377 | ++$rank; |
||
378 | $GLOBALS['xoopsTpl']->append('items', $a_item); |
||
379 | } |
||
380 | |||
381 | $cid = ((int)$cid > 0) ? (int)$cid : 0; |
||
382 | |||
383 | $orderby = Adslight\Utility::convertOrderByOut($orderby); |
||
384 | $linkpages = ceil($trows / $show); |
||
385 | |||
386 | //Page Numbering |
||
387 | if (1 != $linkpages && 0 != $linkpages) { |
||
388 | $prev = $min - $show; |
||
389 | if ($prev >= 0) { |
||
390 | $pagenav .= "<a href='viewcats.php?cid=$cid&min=$prev&orderby=$orderby&show=$show'><strong><u>«</u></strong></a> "; |
||
391 | } |
||
392 | $counter = 1; |
||
393 | $currentpage = ($max / $show); |
||
394 | while ($counter <= $linkpages) { |
||
395 | $mintemp = ($show * $counter) - $show; |
||
396 | if ($counter == $currentpage) { |
||
397 | $pagenav .= "<strong>($counter)</strong> "; |
||
398 | } else { |
||
399 | $pagenav .= "<a href='viewcats.php?cid=$cid&min=$mintemp&orderby=$orderby&show=$show'>$counter</a> "; |
||
400 | } |
||
401 | ++$counter; |
||
402 | } |
||
403 | if ($trows > $max) { |
||
404 | $pagenav .= "<a href='viewcats.php?cid=$cid&min=$max&orderby=$orderby&show=$show'>"; |
||
405 | $pagenav .= '<strong><u>»</u></strong></a>'; |
||
406 | } |
||
407 | } |
||
408 | } |
||
409 | |||
410 | $GLOBALS['xoopsTpl']->assign('nav_page', $pagenav); |
||
411 | |||
412 | if (!$GLOBALS['xoopsUser']) { |
||
413 | global $xoopsDB; |
||
414 | |||
415 | $xoopsTree = new \XoopsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
416 | $jump = XOOPS_URL . '/modules/adslight/viewcats.php?cid='; |
||
417 | ob_start(); |
||
418 | $xoopsTree->makeMySelBox('title', 'title', $cid, 1, 'pid', 'location="' . $jump . '"+this.options[this.selectedIndex].value'); |
||
419 | $select_go_cats = ob_get_clean(); |
||
420 | $GLOBALS['xoopsTpl']->assign('select_go_cats', $select_go_cats); |
||
421 | } |
||
422 | } |
||
423 | |||
424 | # function categorynewgraphic |
||
425 | ##################################################### |
||
426 | /** |
||
427 | * @param $cid |
||
428 | */ |
||
429 | function categorynewgraphic($cid) |
||
430 | { |
||
431 | //global $xoopsDB; |
||
432 | } |
||
433 | |||
434 | ###################################################### |
||
435 | |||
436 | $pa = Request::getInt('pa', null, 'GET'); |
||
437 | $lid = Request::getInt('lid', null, 'GET'); |
||
438 | $cid = Request::getInt('cid', null, 'GET'); |
||
439 | $usid = Request::getString('usid', '', 'GET'); |
||
440 | $min = Request::getInt('min', null, 'GET'); |
||
441 | $show = Request::getInt('show', null, 'GET'); |
||
442 | $orderby = Request::getInt('orderby', null, 'GET'); |
||
443 | |||
444 | switch ($pa) { |
||
445 | default: |
||
446 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_category.tpl'; |
||
447 | adsView($cid, $min, $orderby, $show); |
||
448 | break; |
||
449 | } |
||
450 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
451 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.