|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/* |
|
3
|
|
|
------------------------------------------------------------------------- |
|
4
|
|
|
ADSLIGHT 2 : Module for Xoops |
|
5
|
|
|
|
|
6
|
|
|
Redesigned and ameliorate By iluc user at www.frxoops.org |
|
7
|
|
|
Started with the Classifieds module and made MANY changes |
|
8
|
|
|
Website : http://www.limonads.com |
|
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 XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
$myts = MyTextSanitizer::getInstance(); |
|
29
|
|
|
$module_id = $xoopsModule->getVar('mid'); |
|
30
|
|
|
|
|
31
|
|
|
$groups = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
/** @var XoopsGroupPermHandler $gpermHandler */ |
|
34
|
|
|
$gpermHandler = xoops_getHandler('groupperm'); |
|
35
|
|
|
|
|
36
|
|
|
$perm_itemid = Request::getInt('item_id', 0, 'POST'); |
|
37
|
|
|
|
|
38
|
|
View Code Duplication |
if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
39
|
|
|
redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
$prem_perm = (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) ? '0' : '1'; |
|
43
|
|
|
|
|
44
|
|
|
include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php'; |
|
45
|
|
|
//include XOOPS_ROOT_PATH . '/modules/adslight/class/utility.php'; |
|
|
|
|
|
|
46
|
|
|
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
|
47
|
|
|
|
|
48
|
|
|
# function index |
|
49
|
|
|
##################################################### |
|
50
|
|
|
function index() |
|
|
|
|
|
|
51
|
|
|
{ |
|
52
|
|
|
global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $mytree, $meta, $mid, $moduleDirName, $main_lang, $prem_perm, $xoopsModule; |
|
53
|
|
|
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
54
|
|
|
|
|
55
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
|
56
|
|
|
|
|
57
|
|
|
include XOOPS_ROOT_PATH . '/header.php'; |
|
58
|
|
|
|
|
59
|
|
|
$xoopsTpl->assign('xmid', $xoopsModule->getVar('mid')); |
|
60
|
|
|
$xoopsTpl->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
|
61
|
|
|
$xoopsTpl->assign('add_from_title', _ADSLIGHT_ADDFROM); |
|
62
|
|
|
$xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); |
|
63
|
|
|
$xoopsTpl->assign('only_pix', _ADSLIGHT_ONLYPIX); |
|
64
|
|
|
$xoopsTpl->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
|
65
|
|
|
$xoopsTpl->assign('permit', $prem_perm); |
|
66
|
|
|
|
|
67
|
|
|
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >'); |
|
68
|
|
|
|
|
69
|
|
|
$banner = xoops_getbanner(); |
|
70
|
|
|
$xoopsTpl->assign('banner', $banner); |
|
71
|
|
|
$xoopsTpl->assign('use_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_use_index_code']); |
|
72
|
|
|
$xoopsTpl->assign('adslight_use_banner', $GLOBALS['xoopsModuleConfig']['adslight_use_banner']); |
|
73
|
|
|
$xoopsTpl->assign('index_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_index_code']); |
|
74
|
|
|
$xoopsTpl->assign('index_code_place', $GLOBALS['xoopsModuleConfig']['adslight_index_code_place']); |
|
75
|
|
|
$xoopsTpl->assign('category_title2', _ADSLIGHT_ANNONCES); |
|
76
|
|
|
// adslight 2 |
|
77
|
|
|
$xoopsTpl->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
|
78
|
|
|
$xoopsTpl->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
|
79
|
|
|
|
|
80
|
|
|
// ExpireAd(); |
|
81
|
|
|
AdslightUtility::expireAd(); |
|
82
|
|
|
|
|
83
|
|
View Code Duplication |
if ($GLOBALS['xoopsUser']) { |
|
84
|
|
|
$member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
|
85
|
|
|
if ($usid = $member_usid) { |
|
86
|
|
|
$xoopsTpl->assign('istheirs', true); |
|
87
|
|
|
|
|
88
|
|
|
list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $member_usid . '')); |
|
89
|
|
|
|
|
90
|
|
|
$xoopsTpl->assign('show_user', $show_user); |
|
91
|
|
|
$xoopsTpl->assign('show_user_link', 'members.php?usid=' . $member_usid . ''); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$result = $xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="No"'); |
|
96
|
|
|
list($propo) = $xoopsDB->fetchRow($result); |
|
97
|
|
|
|
|
98
|
|
|
if ($propo > 0) { |
|
99
|
|
|
$xoopsTpl->assign('moderated', true); |
|
100
|
|
|
} |
|
101
|
|
|
if ($GLOBALS['xoopsUser'] instanceof XoopsUser) { |
|
|
|
|
|
|
102
|
|
|
if ($GLOBALS['xoopsUser']->isAdmin()) { |
|
103
|
|
|
$xoopsTpl->assign('admin_block', _ADSLIGHT_ADMINCADRE); |
|
104
|
|
|
if ($propo == 0) { |
|
105
|
|
|
$xoopsTpl->assign('confirm_ads', _ADSLIGHT_NO_CLA); |
|
106
|
|
|
} else { |
|
107
|
|
|
$xoopsTpl->assign('confirm_ads', |
|
108
|
|
|
_ADSLIGHT_THEREIS . ' ' . $propo . ' ' . _ADSLIGHT_WAIT . '<br><a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _ADSLIGHT_SEEIT . '</a>'); |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
$categories = AdslightUtility::getMyItemIds('adslight_submit'); |
|
113
|
|
|
$intro = (is_array($categories) |
|
114
|
|
|
&& (count($categories) > 0)) ? _ADSLIGHT_INTRO : ''; |
|
115
|
|
|
$xoopsTpl->assign('intro', $intro); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
$sql = 'SELECT SQL_CACHE cid, title, img FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE pid = 0 '; |
|
119
|
|
|
|
|
120
|
|
|
$categories = AdslightUtility::getMyItemIds('adslight_view'); |
|
121
|
|
|
if (is_array($categories) && count($categories) > 0) { |
|
122
|
|
|
$sql .= ' AND cid IN (' . implode(',', $categories) . ') '; |
|
123
|
|
|
} else { |
|
124
|
|
|
redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
$sql .= ('cat_order' == $GLOBALS['xoopsModuleConfig']['adslight_csortorder']) ? 'ORDER BY cat_order' : 'ORDER BY title'; |
|
128
|
|
|
|
|
129
|
|
|
$result = $xoopsDB->query($sql); |
|
130
|
|
|
|
|
131
|
|
|
$count = 1; |
|
132
|
|
|
$content = ''; |
|
133
|
|
|
while ($myrow = $xoopsDB->fetchArray($result)) { |
|
134
|
|
|
$title = $myts->htmlSpecialChars($myrow['title']); |
|
135
|
|
|
|
|
136
|
|
|
if ($myrow['img'] && $myrow['img'] !== 'http://') { |
|
137
|
|
|
$cat_img = $myts->htmlSpecialChars($myrow['img']); |
|
138
|
|
|
$img = "<a href=\"viewcats.php?cid={$myrow['cid']}\"><img src=\"" . XOOPS_URL . "/modules/adslight/assets/images/img_cat/{$cat_img}\" align=\"middle\" alt=\"{$title}\"></a>"; |
|
139
|
|
|
} else { |
|
140
|
|
|
$img = ''; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
$totallisting = AdslightUtility::getTotalItems($myrow['cid'], 1); |
|
144
|
|
|
$content .= $title . ' '; |
|
145
|
|
|
|
|
146
|
|
|
$arr = array(); |
|
|
|
|
|
|
147
|
|
|
if (in_array($myrow['cid'], $categories)) { |
|
148
|
|
|
$arr = $mytree->getFirstChild($myrow['cid'], 'title'); |
|
149
|
|
|
$space = 0; |
|
150
|
|
|
$chcount = 1; |
|
151
|
|
|
$subcategories = ''; |
|
152
|
|
|
if (1 == $GLOBALS['xoopsModuleConfig']['adslight_souscat']) { |
|
153
|
|
|
foreach ($arr as $ele) { |
|
154
|
|
|
if (in_array($ele['cid'], $categories)) { |
|
155
|
|
|
$chtitle = $myts->htmlSpecialChars($ele['title']); |
|
156
|
|
|
if ($chcount > $GLOBALS['xoopsModuleConfig']['adslight_nbsouscat']) { |
|
157
|
|
|
$subcategories .= "<a href=\"viewcats.php?cid={$myrow['cid']}\">" . _ADSLIGHT_CATPLUS . '</a>'; |
|
158
|
|
|
break; |
|
159
|
|
|
} |
|
160
|
|
|
if ($space > 0) { |
|
161
|
|
|
$subcategories .= '<br>'; |
|
162
|
|
|
} |
|
163
|
|
|
$subcategories .= "- <a href=\"" . XOOPS_URL . "/modules/adslight/viewcats.php?cid={$ele['cid']}\">{$chtitle}</a>"; |
|
164
|
|
|
++$space; |
|
165
|
|
|
++$chcount; |
|
166
|
|
|
$content .= $ele['title'] . ' '; |
|
167
|
|
|
} |
|
168
|
|
|
} |
|
169
|
|
|
} |
|
170
|
|
|
$xoopsTpl->append('categories', array( |
|
171
|
|
|
'image' => $img, |
|
172
|
|
|
'id' => $myrow['cid'], |
|
173
|
|
|
'title' => $myts->htmlSpecialChars($myrow['title']), |
|
174
|
|
|
'new' => categorynewgraphic($myrow['cid']), |
|
175
|
|
|
'subcategories' => $subcategories, |
|
176
|
|
|
'totallisting' => $totallisting, |
|
177
|
|
|
'count' => $count |
|
178
|
|
|
)); |
|
179
|
|
|
++$count; |
|
180
|
|
|
} |
|
181
|
|
|
} |
|
182
|
|
|
$cat_perms = ''; |
|
183
|
|
|
if (is_array($categories) && count($categories) > 0) { |
|
184
|
|
|
$cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
list($ads) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='Yes' AND status!='1' {$cat_perms}")); |
|
188
|
|
|
|
|
189
|
|
|
list($catt) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix("{$moduleDirName}_categories"))); |
|
|
|
|
|
|
190
|
|
|
|
|
191
|
|
|
$submit_perms = AdslightUtility::getMyItemIds('adslight_submit'); |
|
|
|
|
|
|
192
|
|
|
|
|
193
|
|
|
if ($GLOBALS['xoopsUser'] instanceof XoopsUser) { |
|
|
|
|
|
|
194
|
|
|
$add_listing = '' . _ADSLIGHT_ADD_LISTING_BULLOK . '<a href="add.php">' . _ADSLIGHT_ADD_LISTING_SUBOK . '</a>'; |
|
195
|
|
|
} else { |
|
196
|
|
|
$add_listing = '' . _ADSLIGHT_ADD_LISTING_BULL . '<a href="' . XOOPS_URL . '/register.php">' . _ADSLIGHT_ADD_LISTING_SUB . '</a>.'; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
$xoopsTpl->assign('bullinfotext', _ADSLIGHT_ACTUALY . ' ' . $ads . ' ' . _ADSLIGHT_ADVERTISEMENTS . '<br>' . $add_listing); |
|
200
|
|
|
$xoopsTpl->assign('total_confirm', _ADSLIGHT_AND . " $propo " . _ADSLIGHT_WAIT3); |
|
201
|
|
|
|
|
202
|
|
|
if (1 == $GLOBALS['xoopsModuleConfig']['adslight_newad']) { |
|
203
|
|
|
$cat_perms = ''; |
|
204
|
|
|
if (is_array($categories) && count($categories) > 0) { |
|
205
|
|
|
$cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
$result = $xoopsDB->query('SELECT SQL_CACHE lid, title, status, type, price, typeprice, date, town, country, usid, premium, valid, photo, hits FROM ' |
|
209
|
|
|
. $xoopsDB->prefix('adslight_listing') |
|
210
|
|
|
. " WHERE valid='Yes' and status!='1' {$cat_perms} ORDER BY date DESC LIMIT {$GLOBALS['xoopsModuleConfig']['adslight_newcount']}"); |
|
211
|
|
|
if ($result) { |
|
212
|
|
|
$xoopsTpl->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD); |
|
213
|
|
|
$xoopsTpl->assign('last_head_title', _ADSLIGHT_TITLE); |
|
214
|
|
|
$xoopsTpl->assign('last_head_price', _ADSLIGHT_PRICE); |
|
215
|
|
|
$xoopsTpl->assign('last_head_date', _ADSLIGHT_DATE); |
|
216
|
|
|
$xoopsTpl->assign('last_head_local', _ADSLIGHT_LOCAL2); |
|
217
|
|
|
$xoopsTpl->assign('last_head_hits', _ADSLIGHT_VIEW); |
|
218
|
|
|
$xoopsTpl->assign('last_head_photo', _ADSLIGHT_PHOTO); |
|
219
|
|
|
$rank = 1; |
|
220
|
|
|
|
|
221
|
|
|
while (list($lid, $title, $status, $type, $price, $typeprice, $date, $town, $country, $usid, $premium, $valid, $photo, $hits) = $xoopsDB->fetchRow($result)) { |
|
|
|
|
|
|
222
|
|
|
$title = $myts->htmlSpecialChars($title); |
|
223
|
|
|
$type = $myts->htmlSpecialChars($type); |
|
224
|
|
|
// $price = number_format($price, 2, ',', ' '); |
|
|
|
|
|
|
225
|
|
|
$town = $myts->htmlSpecialChars($town); |
|
226
|
|
|
$country = $myts->htmlSpecialChars($country); |
|
227
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
|
228
|
|
|
$a_item = array(); |
|
229
|
|
|
$newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
|
230
|
|
|
$startdate = (time() - (86400 * $newcount)); |
|
231
|
|
|
|
|
232
|
|
View Code Duplication |
if ($startdate < $date) { |
|
233
|
|
|
$newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
|
234
|
|
|
$a_item['new'] = $newitem; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
$useroffset = ''; |
|
238
|
|
|
if ($GLOBALS['xoopsUser'] instanceof XoopsUser) { |
|
|
|
|
|
|
239
|
|
|
$timezone = $GLOBALS['xoopsUser']->timezone(); |
|
240
|
|
|
$useroffset = (!empty($timezone)) ? $xoopsUser->timezone() : $xoopsConfig['default_TZ']; |
|
|
|
|
|
|
241
|
|
|
if ($xoopsUser->isAdmin()) { |
|
242
|
|
|
$a_item['admin'] = "<a href=\"" |
|
243
|
|
|
. XOOPS_URL |
|
244
|
|
|
. "/modules/adslight/admin/validate_ads.php?op=ModifyAds&lid={$lid}\"><img src=\"{$pathIcon16}/edit.png\" border=\"0\" alt=\"" |
|
245
|
|
|
. _ADSLIGHT_MODADMIN |
|
246
|
|
|
. "\"></a>"; |
|
247
|
|
|
} |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
$date = ($useroffset * 3600) + $date; |
|
251
|
|
|
$date = formatTimestamp($date, 's'); |
|
252
|
|
|
|
|
253
|
|
|
$result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' WHERE id_type=' . (int)$type); |
|
254
|
|
|
list($nom_type) = $xoopsDB->fetchRow($result7); |
|
255
|
|
|
|
|
256
|
|
|
$a_item['type'] = $myts->htmlSpecialChars($nom_type); |
|
257
|
|
|
$a_item['title'] = "<a href=\"" . XOOPS_URL . "/modules/adslight/viewads.php?lid={$lid}\"><strong>{$title}</strong></a>"; |
|
258
|
|
|
|
|
259
|
|
|
$result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' WHERE id_price=' . (int)$typeprice); |
|
260
|
|
|
list($nom_price) = $xoopsDB->fetchRow($result8); |
|
261
|
|
|
|
|
262
|
|
|
if ($price > 0) { |
|
263
|
|
|
$a_item['price'] = $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ''; |
|
264
|
|
|
$a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
|
265
|
|
|
} else { |
|
266
|
|
|
$a_item['price'] = ''; |
|
267
|
|
|
$a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
|
268
|
|
|
} |
|
269
|
|
|
$a_item['premium'] = $premium; |
|
270
|
|
|
$a_item['date'] = $date; |
|
271
|
|
|
$a_item['local'] .= $town ? $town : ''; |
|
272
|
|
|
$a_item['country'] = $country ? $country : ''; |
|
273
|
|
|
|
|
274
|
|
|
if (2 == $status) { |
|
275
|
|
|
$a_item['sold'] = _ADSLIGHT_RESERVEDMEMBER; |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
if ($xoopsModuleConfig['active_thumbsindex'] > 0) { |
|
|
|
|
|
|
279
|
|
|
$a_item['no_photo'] = "<a href=\"" |
|
280
|
|
|
. XOOPS_URL |
|
281
|
|
|
. "/modules/adslight/viewads.php?lid={$lid}\"><img class=\"thumb\" src=\"" |
|
282
|
|
|
. XOOPS_URL |
|
283
|
|
|
. "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"{$title}\"></a>"; |
|
284
|
|
|
|
|
285
|
|
|
$updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
|
286
|
|
|
$sql = 'SELECT cod_img, lid, uid_owner, url FROM ' |
|
287
|
|
|
. $xoopsDB->prefix('adslight_pictures') |
|
288
|
|
|
. ' WHERE uid_owner=' |
|
289
|
|
|
. (int)$usid |
|
290
|
|
|
. " AND lid={$lid} ORDER BY date_added ASC LIMIT 1"; |
|
291
|
|
|
|
|
292
|
|
|
$resultp = $xoopsDB->query($sql); |
|
293
|
|
|
|
|
294
|
|
|
while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
|
|
|
|
|
|
295
|
|
|
if ($photo) { |
|
296
|
|
|
$a_item['photo'] = "<a href=\"" |
|
297
|
|
|
. XOOPS_URL |
|
298
|
|
|
. "/modules/adslight/viewads.php?lid={$lid}\"><img class=\"thumb\" src=\"{$updir}/thumbs/thumb_{$url}\" align=\"left\" width=\"100px\" alt=\"{$title}\"></a>"; |
|
299
|
|
|
} |
|
300
|
|
|
} |
|
301
|
|
View Code Duplication |
} else { |
|
302
|
|
|
$a_item['no_photo'] = "<img src=\"" . XOOPS_URL . "/modules/adslight/assets/images/camera_nophoto.png\" align=\"left\" width=\"24px\" alt=\"{$title}\">"; |
|
303
|
|
|
$updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
|
|
|
|
|
|
304
|
|
|
$sql = 'SELECT cod_img, lid, uid_owner, url FROM ' |
|
305
|
|
|
. $xoopsDB->prefix('adslight_pictures') |
|
306
|
|
|
. ' WHERE uid_owner=' |
|
307
|
|
|
. (int)$usid |
|
308
|
|
|
. " AND lid={$lid} ORDER BY date_added ASC LIMIT 1"; |
|
309
|
|
|
$resultp = $xoopsDB->query($sql); |
|
310
|
|
|
|
|
311
|
|
|
while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
|
|
|
|
|
|
312
|
|
|
if ($photo) { |
|
313
|
|
|
$a_item['photo'] = "<img src=\"" . XOOPS_URL . "/modules/adslight/assets/images/camera_photo.png\" align=\"left\" width=\"24\" alt=\"{$title}\">"; |
|
314
|
|
|
} |
|
315
|
|
|
} |
|
316
|
|
|
} |
|
317
|
|
|
$a_item['hits'] = $hits; |
|
318
|
|
|
++$rank; |
|
319
|
|
|
$xoopsTpl->append('items', $a_item); |
|
320
|
|
|
} |
|
321
|
|
|
} |
|
322
|
|
|
} |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
# function categorynewgraphic |
|
326
|
|
|
##################################################### |
|
327
|
|
|
/** |
|
328
|
|
|
* @param $cid |
|
329
|
|
|
*/ |
|
330
|
|
|
function categorynewgraphic($cid) |
|
|
|
|
|
|
331
|
|
|
{ |
|
332
|
|
|
global $xoopsDB; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
###################################################### |
|
336
|
|
|
|
|
337
|
|
|
$pa = Request::getInt('pa', null, 'GET'); |
|
338
|
|
|
$lid = Request::getInt('lid', null, 'GET'); |
|
339
|
|
|
$cid = Request::getInt('cid', null, 'GET'); |
|
340
|
|
|
$usid = Request::getString('usid', '', 'GET'); |
|
341
|
|
|
$min = Request::getInt('min', null, 'GET'); |
|
342
|
|
|
$show = Request::getInt('show', null, 'GET'); |
|
343
|
|
|
$orderby = Request::getInt('orderby', null, 'GET'); |
|
344
|
|
|
|
|
345
|
|
|
switch ($pa) { |
|
346
|
|
|
case 'Adsview': |
|
347
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'adslight_category.tpl'; |
|
348
|
|
|
adsView($cid, $min, $orderby, $show); |
|
349
|
|
|
break; |
|
350
|
|
|
case 'viewads': |
|
351
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
|
352
|
|
|
viewAds($lid); |
|
353
|
|
|
break; |
|
354
|
|
|
default: |
|
355
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
|
356
|
|
|
index(); |
|
357
|
|
|
break; |
|
358
|
|
|
} |
|
359
|
|
|
include XOOPS_ROOT_PATH . '/footer.php'; |
|
360
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.