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
|
|
|
include_once __DIR__ . '/admin_header.php'; |
24
|
|
|
|
25
|
|
|
$op = XoopsRequest::getCmd('op', 'liste'); |
26
|
|
|
|
27
|
|
|
# function Index |
28
|
|
|
##################################################### |
29
|
|
|
function index() |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $moduleDirName, $admin_lang; |
|
|
|
|
32
|
|
|
|
33
|
|
|
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
|
|
|
|
34
|
|
|
|
35
|
|
|
include_once __DIR__ . '/header.php'; |
36
|
|
|
xoops_cp_header(); |
37
|
|
|
// loadModuleAdminMenu(0, ""); |
|
|
|
|
38
|
|
|
|
39
|
|
|
// photo dir setting checker |
40
|
|
|
$photo_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload']; |
41
|
|
|
$photo_thumb_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/thumbs'; |
42
|
|
|
$photo_resized_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/midsize'; |
43
|
|
|
if (!is_dir($photo_dir)) { |
44
|
|
|
mkdir($photo_dir); |
45
|
|
|
} |
46
|
|
|
if (!is_dir($photo_thumb_dir)) { |
47
|
|
|
mkdir($photo_thumb_dir); |
48
|
|
|
} |
49
|
|
|
if (!is_dir($photo_resized_dir)) { |
50
|
|
|
mkdir($photo_resized_dir); |
51
|
|
|
} |
52
|
|
View Code Duplication |
if (!is_writable($photo_dir) || !is_readable($photo_dir)) { |
|
|
|
|
53
|
|
|
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
54
|
|
|
echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_dir . '</b></span><br><br>'; |
55
|
|
|
echo '</fieldset><br>'; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
View Code Duplication |
if (!is_writable($photo_thumb_dir) || !is_readable($photo_thumb_dir)) { |
|
|
|
|
59
|
|
|
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
60
|
|
|
echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_thumb_dir . '</b></span><br><br>'; |
61
|
|
|
echo '</fieldset><br>'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
View Code Duplication |
if (!is_writable($photo_resized_dir) || !is_readable($photo_resized_dir)) { |
|
|
|
|
65
|
|
|
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
66
|
|
|
echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_resized_dir . '</b></span><br><br>'; |
67
|
|
|
echo '</fieldset><br>'; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
$result = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo, usid FROM ' |
71
|
|
|
. $xoopsDB->prefix('adslight_listing') |
72
|
|
|
. " WHERE valid='no' ORDER BY lid"); |
73
|
|
|
$numrows = $xoopsDB->getRowsNum($result); |
74
|
|
|
if ($numrows > 0) { |
75
|
|
|
|
76
|
|
|
///////// Il y a [..] Annonces en attente d'être approuvées ////// |
77
|
|
|
echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>"; |
78
|
|
|
echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>"; |
79
|
|
|
echo "<span style='color:#00B4C4'><b>" . _AM_ADSLIGHT_THEREIS . "</b></span> <b>$numrows</b> <span style='color:#00B4C4'>" . _AM_ADSLIGHT_WAIT . '</b></span>'; |
80
|
|
|
echo '</td></tr></table><br>'; |
81
|
|
|
|
82
|
|
|
///// Liste des ID ///// Soumis par ///// Titre ///// Description ///// Date d'ajout |
83
|
|
|
echo "<table width='100%' border='0' class='outer'>"; |
84
|
|
|
$rank = 1; |
85
|
|
|
|
86
|
|
|
while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo, $usid) = $xoopsDB->fetchRow($result)) { |
87
|
|
|
$title = $myts->htmlSpecialChars($title); |
88
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 0, 1, 1, 1); |
89
|
|
|
|
90
|
|
View Code Duplication |
if (strlen($desctext) >= 200) { |
|
|
|
|
91
|
|
|
$desctext = substr($desctext, 0, 199) . '...'; |
92
|
|
|
} else { |
93
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 1, 1); |
94
|
|
|
} |
95
|
|
|
$date2 = formatTimestamp($date, 's'); |
96
|
|
|
|
97
|
|
|
if (is_int($rank / 2)) { |
98
|
|
|
$color = '#ffffff'; |
|
|
|
|
99
|
|
|
} else { |
100
|
|
|
$color = 'head'; |
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
$status = $myts->htmlSpecialChars($status); |
104
|
|
|
$expire = $myts->htmlSpecialChars($expire); |
105
|
|
|
$type = $myts->htmlSpecialChars($type); |
106
|
|
|
$tel = $myts->htmlSpecialChars($tel); |
107
|
|
|
$price = number_format($price, 2, ',', ' '); |
108
|
|
|
$typeprice = $myts->htmlSpecialChars($typeprice); |
109
|
|
|
$typeusure = $myts->htmlSpecialChars($typeusure); |
110
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
111
|
|
|
$town = $myts->htmlSpecialChars($town); |
112
|
|
|
$country = $myts->htmlSpecialChars($country); |
113
|
|
|
$contactby = $myts->htmlSpecialChars($contactby); |
114
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
115
|
|
|
|
116
|
|
|
$updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
117
|
|
|
$sql = 'SELECT cod_img, lid, uid_owner, url FROM ' |
118
|
|
|
. $xoopsDB->prefix('adslight_pictures') |
119
|
|
|
. ' WHERE uid_owner=' |
120
|
|
|
. $xoopsDB->escape($usid) |
121
|
|
|
. ' AND lid=' |
122
|
|
|
. $xoopsDB->escape($lid) |
123
|
|
|
. ' ORDER BY date_added ASC limit 1'; |
124
|
|
|
$resultp = $xoopsDB->query($sql); |
125
|
|
View Code Duplication |
while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
|
|
|
|
126
|
|
|
if ($photo) { |
127
|
|
|
$photo3 = "<a href='" |
128
|
|
|
. XOOPS_URL |
129
|
|
|
. '/modules/adslight/viewads.php?lid=' |
130
|
|
|
. $lid |
131
|
|
|
. "'><img class=\"thumb\" src=\"$updir/thumbs/thumb_$url\" align=\"left\" width=\"100px\" alt=\"$title\"></a>"; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
if ($photo > 0) { |
|
|
|
|
135
|
|
|
} else { |
136
|
|
|
$photo3 = "<a href=\"index.php?op=IndexView&lid=$lid\"><img class=\"thumb\" src=\"" |
137
|
|
|
. XOOPS_URL |
138
|
|
|
. "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"$title\"></a>"; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
if ($photo > 0) { |
142
|
|
|
$photo4 = "$photo"; |
143
|
|
|
} else { |
144
|
|
|
$photo4 = '0'; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
$result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' WHERE id_type=' . $xoopsDB->escape($type) . ''); |
148
|
|
|
list($nom_type) = $xoopsDB->fetchRow($result7); |
149
|
|
|
|
150
|
|
|
$result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' WHERE id_price=' . $xoopsDB->escape($typeprice) . ''); |
151
|
|
|
list($nom_price) = $xoopsDB->fetchRow($result8); |
152
|
|
|
|
153
|
|
|
/* $result9=$xoopsDB->query("select nom_usure from ".$xoopsDB->prefix("adslight_usure")." WHERE id_usure=".$xoopsDB->escape($typeusure).""); |
|
|
|
|
154
|
|
|
list($nom_usure) = $xoopsDB->fetchRow($result9); */ |
155
|
|
|
|
156
|
|
|
echo "<form action=\"validate_ads.php\" method=\"post\">"; |
157
|
|
|
echo "<tr><th align='left'>" |
158
|
|
|
. _AM_ADSLIGHT_LID |
159
|
|
|
. ": $lid</th><th align='left'>$photo4 " |
160
|
|
|
. _AM_ADSLIGHT_NBR_PHOTO |
161
|
|
|
. "</th><th align='left'>" |
162
|
|
|
. _AM_ADSLIGHT_TITLE |
163
|
|
|
. ":</th><th align='left'>" |
164
|
|
|
. _AM_ADSLIGHT_DESC |
165
|
|
|
. "</th><th align='left'></th></tr>"; |
166
|
|
|
|
167
|
|
|
echo "<tr><td class='even' width='3%'></td>"; |
168
|
|
|
echo "<td class='odd' width='10%' >$photo3</td>"; |
|
|
|
|
169
|
|
|
|
170
|
|
|
echo "<td class='even' width='20%'><b>$title</b><br><br>$nom_type<br>$price " . $GLOBALS['xoopsModuleConfig']['adslight_money'] . " $nom_price<br>"; |
171
|
|
|
echo "$town - $country<br>"; |
172
|
|
|
echo '<b>' . _AM_ADSLIGHT_SUBMITTER . ":</b> $submitter<br>"; |
173
|
|
|
echo '<b>' . _AM_ADSLIGHT_DATE . ":</b> $date2</td>"; |
174
|
|
|
echo "<td class='even' width='35%'>$desctext</td><td class='even' width='2%' align=right></td>"; |
175
|
|
|
echo "</tr><tr><td width='5%'></td><td>"; |
176
|
|
|
|
177
|
|
|
echo "<select name=\"op\"> |
178
|
|
|
<option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . " |
179
|
|
|
<option value=\"IndexView\"> " . _AM_ADSLIGHT_MODIF . " |
180
|
|
|
<option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
181
|
|
|
</select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\">"; |
182
|
|
|
|
183
|
|
|
echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
184
|
|
|
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
185
|
|
|
echo "<input type=\"hidden\" name=\"cid\" value=\"$cid\">"; |
186
|
|
|
echo "<input type=\"hidden\" name=\"title\" value=\"$title\">"; |
187
|
|
|
echo "<input type=\"hidden\" name=\"status\" value=\"$status\">"; |
188
|
|
|
echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\">"; |
189
|
|
|
echo "<input type=\"hidden\" name=\"type\" value=\"$type\">"; |
190
|
|
|
echo "<input type=\"hidden\" name=\"desctext\" value=\"$desctext\">"; |
191
|
|
|
echo "<input type=\"hidden\" name=\"tel\" value=\"$tel\">"; |
192
|
|
|
echo "<input type=\"hidden\" name=\"price\" value=\"$price\">"; |
193
|
|
|
echo "<input type=\"hidden\" name=\"typeprice\" value=\"$typeprice\">"; |
194
|
|
|
echo "<input type=\"hidden\" name=\"typeusure\" value=\"$typeusure\">"; |
195
|
|
|
echo "<input type=\"hidden\" name=\"date\" value=\"$date\">"; |
196
|
|
|
echo "<input type=\"hidden\" name=\"email\" value=\"$email\">"; |
197
|
|
|
echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">"; |
198
|
|
|
echo "<input type=\"hidden\" name=\"town\" value=\"$town\">"; |
199
|
|
|
echo "<input type=\"hidden\" name=\"country\" value=\"$country\">"; |
200
|
|
|
echo "<input type=\"hidden\" name=\"contactby\" value=\"$contactby\">"; |
201
|
|
|
echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\">"; |
202
|
|
|
echo "<input type=\"hidden\" name=\"photo\" value=\"$photo\">"; |
203
|
|
|
echo '</form><br></td></tr>'; |
204
|
|
|
++$rank; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
echo '</td></tr></table> |
208
|
|
|
<br><br>'; |
209
|
|
|
} else { |
210
|
|
|
echo "<table class='outer' width='50%' border='0'><tr><td width=40>"; |
211
|
|
|
echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>"; |
212
|
|
|
echo "<span style='color: #00B4C4;'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></span>'; |
213
|
|
|
echo '</td></tr></table><br>'; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
// Modify Annonces |
217
|
|
|
list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . '')); |
218
|
|
View Code Duplication |
if ($numrows > 0) { |
|
|
|
|
219
|
|
|
echo "<table width='100%' border='0' class='outer'><tr class='bg4'><td valign='top'>"; |
220
|
|
|
echo "<form method=\"post\" action=\"validate_ads.php\">" |
221
|
|
|
. '<b>' |
222
|
|
|
. _AM_ADSLIGHT_MODANN |
223
|
|
|
. '</b><br><br>' |
224
|
|
|
. '' |
225
|
|
|
. _AM_ADSLIGHT_NUMANN |
226
|
|
|
. " <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\"> " |
227
|
|
|
. "<input type=\"hidden\" name=\"op\" value=\"ModifyAds\">" |
228
|
|
|
. "<input type=\"submit\" value=\"" |
229
|
|
|
. _AM_ADSLIGHT_MODIF |
230
|
|
|
. "\">" |
231
|
|
|
. '</form><br>'; |
232
|
|
|
echo '</td></tr></table><br>'; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>"; |
236
|
|
|
echo "<a href=\"map.php\">" . _AM_ADSLIGHT_GESTCAT . "</a> | <a href=\"../index.php\">" . _AM_ADSLIGHT_ACCESMYANN . '</a>'; |
237
|
|
|
echo '</td></tr></table><br>'; |
238
|
|
|
|
239
|
|
|
xoops_cp_footer(); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
# function IndexView |
243
|
|
|
##################################################### |
244
|
|
|
/** |
245
|
|
|
* @param $lid |
246
|
|
|
*/ |
247
|
|
|
function indexView($lid) |
|
|
|
|
248
|
|
|
{ |
249
|
|
|
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang; |
|
|
|
|
250
|
|
|
|
251
|
|
|
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
252
|
|
|
|
253
|
|
|
include_once __DIR__ . '/header.php'; |
254
|
|
|
xoops_cp_header(); |
255
|
|
|
// loadModuleAdminMenu(0, ""); |
|
|
|
|
256
|
|
|
|
257
|
|
|
$result = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo FROM ' |
258
|
|
|
. $xoopsDB->prefix('adslight_listing') |
259
|
|
|
. " WHERE valid='No' AND lid='$lid'"); |
260
|
|
|
$numrows = $xoopsDB->getRowsNum($result); |
261
|
|
|
if ($numrows > 0) { |
262
|
|
|
echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>"; |
263
|
|
|
echo '<b>' . _AM_ADSLIGHT_WAIT . '</b><br><br>'; |
264
|
|
|
|
265
|
|
|
list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo) = $xoopsDB->fetchRow($result); |
266
|
|
|
|
267
|
|
|
$date2 = formatTimestamp($date, 's'); |
268
|
|
|
$title = $myts->htmlSpecialChars($title); |
269
|
|
|
$status = $myts->htmlSpecialChars($status); |
270
|
|
|
$expire = $myts->htmlSpecialChars($expire); |
271
|
|
|
$type = $myts->htmlSpecialChars($type); |
272
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 1, 1); |
273
|
|
|
$tel = $myts->htmlSpecialChars($tel); |
274
|
|
|
$price = number_format($price, 2, ',', ' '); |
275
|
|
|
$typeprice = $myts->htmlSpecialChars($typeprice); |
276
|
|
|
$typeusure = $myts->htmlSpecialChars($typeusure); |
277
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
278
|
|
|
$town = $myts->htmlSpecialChars($town); |
279
|
|
|
$country = $myts->htmlSpecialChars($country); |
280
|
|
|
$contactby = $myts->htmlSpecialChars($contactby); |
281
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
282
|
|
|
|
283
|
|
|
echo "<form action=\"validate_ads.php\" method=\"post\"> |
284
|
|
|
<table><tr class='head' border='1'> |
285
|
|
|
<td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid " . _AM_ADSLIGHT_ADDED_ON . " $date2</td> |
286
|
|
|
</tr><tr class='odd' border='1'> |
287
|
|
|
<td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td> |
288
|
|
|
</tr><tr class='head' border='1'> |
289
|
|
|
<td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td> |
290
|
|
|
</tr><tr class='head' border='1'> |
291
|
|
|
<td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td> |
292
|
|
|
</tr><tr class='head' border='1'> |
293
|
|
|
<td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td> |
294
|
|
|
</tr><tr class='head' border='1'> |
295
|
|
|
<td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td> |
296
|
|
|
</tr><tr class='head' border='1'> |
297
|
|
|
<td>" . _AM_ADSLIGHT_CONTACTBY . " </td><td><input type=\"text\" name=\"contactby\" size=\"40\" value=\"$contactby\"></td> |
298
|
|
|
</tr>"; |
299
|
|
|
|
300
|
|
|
echo "<tr> |
301
|
|
|
<td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
302
|
|
|
if ($status == '0') { |
303
|
|
|
echo 'checked'; |
304
|
|
|
} |
305
|
|
|
echo '>' . _AM_ADSLIGHT_ACTIVE . " <input type=\"radio\" name=\"status\" value=\"1\""; |
306
|
|
|
if ($status == '1') { |
307
|
|
|
echo 'checked'; |
308
|
|
|
} |
309
|
|
|
echo '>' . _AM_ADSLIGHT_INACTIVE . " <input type=\"radio\" name=\"status\" value=\"2\""; |
310
|
|
|
if ($status == '2') { |
311
|
|
|
echo 'checked'; |
312
|
|
|
} |
313
|
|
|
echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
314
|
|
|
|
315
|
|
|
echo "<tr class='head' border='1'> |
316
|
|
|
<td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td> |
317
|
|
|
</tr><tr class='head' border='1'> |
318
|
|
|
<td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td> |
319
|
|
|
</tr><tr class='head' border='1'> |
320
|
|
|
<td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td> |
321
|
|
|
</tr><tr class='head' border='1'> |
322
|
|
|
<td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">"; |
323
|
|
|
|
324
|
|
|
$result5 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'); |
325
|
|
|
while (list($nom_type) = $xoopsDB->fetchRow($result5)) { |
326
|
|
|
$sel = ''; |
327
|
|
|
if ($nom_type == $type) { |
328
|
|
|
$sel = 'selected'; |
329
|
|
|
} |
330
|
|
|
echo "<option value=\"$nom_type\" $sel>$nom_type</option>"; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
echo '</select></td></tr>'; |
334
|
|
|
|
335
|
|
|
////// Etat d'usure |
336
|
|
|
echo "<tr class='head' border='1'> |
337
|
|
|
<td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">"; |
338
|
|
|
|
339
|
|
|
$result6 = $xoopsDB->query('SELECT nom_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY nom_usure'); |
340
|
|
|
while (list($nom_usure) = $xoopsDB->fetchRow($result6)) { |
341
|
|
|
$sel = ''; |
342
|
|
|
if ($nom_usure == $typeusure) { |
343
|
|
|
$sel = 'selected'; |
344
|
|
|
} |
345
|
|
|
echo "<option value=\"$nom_usure\" $sel>$nom_usure</option>"; |
346
|
|
|
} |
347
|
|
|
echo '</select></td></tr>'; |
348
|
|
|
|
349
|
|
|
echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $GLOBALS['xoopsModuleConfig']['adslight_money'] . ''; |
350
|
|
|
$result3 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price'); |
351
|
|
|
echo " <select name=\"typeprice\"><option value=\"$typeprice\">$typeprice</option>"; |
352
|
|
|
while (list($nom_price) = $xoopsDB->fetchRow($result3)) { |
353
|
|
|
echo "<option value=\"$nom_price\">$nom_price</option>"; |
354
|
|
|
} |
355
|
|
|
echo '</select></td></tr>'; |
356
|
|
|
|
357
|
|
|
echo "<tr class='head' border='1'> |
358
|
|
|
<td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"40\" value=\"$photo\"></td> |
359
|
|
|
</tr>"; |
360
|
|
|
echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_DESC . '</td><td>'; |
361
|
|
|
$wysiwyg_text_area = AdslightUtilities::getEditor(_AM_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px', 'small'); |
362
|
|
|
echo $wysiwyg_text_area->render(); |
363
|
|
|
echo '</td></tr>'; |
364
|
|
|
echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_CAT . ' </td><td>'; |
365
|
|
|
$mytree->makeMySelBox('title', 'title', $cid); |
366
|
|
|
echo "</td> |
367
|
|
|
</tr><tr class='head' border='1'> |
368
|
|
|
<td> </td><td><select name=\"op\"> |
369
|
|
|
<option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . " |
370
|
|
|
<option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
371
|
|
|
</select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td> |
372
|
|
|
</tr></table>"; |
373
|
|
|
echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
374
|
|
|
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
375
|
|
|
echo "<input type=\"hidden\" name=\"date\" value=\"$date\">"; |
376
|
|
|
echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\"> |
377
|
|
|
</form>"; |
378
|
|
|
|
379
|
|
|
echo '</td></tr></table>'; |
380
|
|
|
echo '<br>'; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
xoops_cp_footer(); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
# function modifyAds |
387
|
|
|
##################################################### |
388
|
|
|
/** |
389
|
|
|
* @param $lid |
390
|
|
|
*/ |
391
|
|
View Code Duplication |
function modifyAds($lid) |
|
|
|
|
392
|
|
|
{ |
393
|
|
|
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang; |
|
|
|
|
394
|
|
|
|
395
|
|
|
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
396
|
|
|
|
397
|
|
|
$id_price = ''; |
398
|
|
|
$nom_price = ''; |
399
|
|
|
|
400
|
|
|
include_once __DIR__ . '/header.php'; |
401
|
|
|
xoops_cp_header(); |
402
|
|
|
// loadModuleAdminMenu(0, ""); |
|
|
|
|
403
|
|
|
|
404
|
|
|
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>'; |
405
|
|
|
|
406
|
|
|
$result = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, valid, photo FROM ' |
407
|
|
|
. $xoopsDB->prefix('adslight_listing') |
408
|
|
|
. " WHERE lid=$lid"); |
409
|
|
|
|
410
|
|
|
while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) = $xoopsDB->fetchRow($result)) { |
|
|
|
|
411
|
|
|
$title = $myts->htmlSpecialChars($title); |
412
|
|
|
$status = $myts->htmlSpecialChars($status); |
413
|
|
|
$expire = $myts->htmlSpecialChars($expire); |
414
|
|
|
$type = $myts->htmlSpecialChars($type); |
415
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 1, 1); |
416
|
|
|
$tel = $myts->htmlSpecialChars($tel); |
417
|
|
|
$price = number_format($price, 2, ',', ' '); |
418
|
|
|
$typeprice = $myts->htmlSpecialChars($typeprice); |
419
|
|
|
$typeusure = $myts->htmlSpecialChars($typeusure); |
420
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
421
|
|
|
$town = $myts->htmlSpecialChars($town); |
422
|
|
|
$country = $myts->htmlSpecialChars($country); |
423
|
|
|
$contactby = $myts->htmlSpecialChars($contactby); |
424
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
425
|
|
|
|
426
|
|
|
$date2 = formatTimestamp($date, 's'); |
427
|
|
|
|
428
|
|
|
echo "<form action=\"validate_ads.php\" method=post> |
429
|
|
|
<table border=0><tr class='head' border='1'> |
430
|
|
|
<td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid " . _AM_ADSLIGHT_ADDED_ON . " $date2</td> |
431
|
|
|
</tr><tr class='head' border='1'> |
432
|
|
|
<td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td> |
433
|
|
|
</tr><tr class='head' border='1'> |
434
|
|
|
<td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td> |
435
|
|
|
</tr><tr class='head' border='1'> |
436
|
|
|
<td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td> |
437
|
|
|
</tr><tr class='head' border='1'> |
438
|
|
|
<td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td> |
439
|
|
|
</tr><tr class='head' border='1'> |
440
|
|
|
<td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td> |
441
|
|
|
</tr> |
442
|
|
|
<tr class='head' border='1'>"; |
443
|
|
|
|
444
|
|
|
if ($contactby == 1) { |
445
|
|
|
$contactselect = _AM_ADSLIGHT_CONTACT_BY_EMAIL; |
446
|
|
|
} |
447
|
|
|
if ($contactby == 2) { |
448
|
|
|
$contactselect = _AM_ADSLIGHT_CONTACT_BY_PM; |
449
|
|
|
} |
450
|
|
|
if ($contactby == 3) { |
451
|
|
|
$contactselect = _AM_ADSLIGHT_CONTACT_BY_BOTH; |
452
|
|
|
} |
453
|
|
|
if ($contactby == 4) { |
454
|
|
|
$contactselect = _AM_ADSLIGHT_CONTACT_BY_PHONE; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
echo " <td class='head'>" . _AM_ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\"> |
458
|
|
|
<option value=\"" . $contactby . "\">" . $contactselect . "</option> |
|
|
|
|
459
|
|
|
<option value=\"1\">" . _AM_ADSLIGHT_CONTACT_BY_EMAIL . "</option> |
460
|
|
|
<option value=\"2\">" . _AM_ADSLIGHT_CONTACT_BY_PM . "</option> |
461
|
|
|
<option value=\"3\">" . _AM_ADSLIGHT_CONTACT_BY_BOTH . "</option> |
462
|
|
|
<option value=\"4\">" . _AM_ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>'; |
463
|
|
|
|
464
|
|
|
echo "<tr><td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
465
|
|
|
if ($status == '0') { |
466
|
|
|
echo 'checked'; |
467
|
|
|
} |
468
|
|
|
echo '>' . _AM_ADSLIGHT_ACTIVE . " <input type=\"radio\" name=\"status\" value=\"1\""; |
469
|
|
|
if ($status == '1') { |
470
|
|
|
echo 'checked'; |
471
|
|
|
} |
472
|
|
|
echo '>' . _AM_ADSLIGHT_INACTIVE . " <input type=\"radio\" name=\"status\" value=\"2\""; |
473
|
|
|
if ($status == '2') { |
474
|
|
|
echo 'checked'; |
475
|
|
|
} |
476
|
|
|
echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
477
|
|
|
|
478
|
|
|
echo "<tr class='head' border='1'> |
479
|
|
|
<td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td> |
480
|
|
|
</tr><tr class='head' border='1'> |
481
|
|
|
<td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td> |
482
|
|
|
</tr><tr class='head' border='1'> |
483
|
|
|
<td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td> |
484
|
|
|
</tr>"; |
485
|
|
|
////// Type d'annonce |
486
|
|
|
echo "<tr class='head' border='1'> |
487
|
|
|
<td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">"; |
488
|
|
|
|
489
|
|
|
$result5 = $xoopsDB->query('SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'); |
490
|
|
|
while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) { |
491
|
|
|
$sel = ''; |
492
|
|
|
if ($id_type == $type) { |
493
|
|
|
$sel = 'selected'; |
494
|
|
|
} |
495
|
|
|
echo "<option value=\"$id_type\" $sel>$nom_type</option>"; |
496
|
|
|
} |
497
|
|
|
echo '</select></td></tr>'; |
498
|
|
|
|
499
|
|
|
////// Etat d'usure |
500
|
|
|
|
501
|
|
|
echo "<tr class='head' border='1'> |
502
|
|
|
<td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">"; |
503
|
|
|
|
504
|
|
|
$result6 = $xoopsDB->query('SELECT nom_usure, id_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY nom_usure'); |
505
|
|
|
while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) { |
506
|
|
|
$sel = ''; |
507
|
|
|
if ($id_usure == $typeusure) { |
508
|
|
|
$sel = 'selected'; |
509
|
|
|
} |
510
|
|
|
echo "<option value=\"$id_usure\" $sel>$nom_usure</option>"; |
511
|
|
|
} |
512
|
|
|
echo '</select></td></tr>'; |
513
|
|
|
|
514
|
|
|
//////// Price |
515
|
|
|
|
516
|
|
|
echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $GLOBALS['xoopsModuleConfig']['adslight_money'] . ''; |
517
|
|
|
|
518
|
|
|
//////// Price type |
519
|
|
|
|
520
|
|
|
$resultx = $xoopsDB->query('SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY nom_price'); |
521
|
|
|
|
522
|
|
|
echo " <select name=\"typeprice\"><option value=\"$id_price\">$nom_price</option>"; |
523
|
|
|
while (list($nom_price, $id_price) = $xoopsDB->fetchRow($resultx)) { |
524
|
|
|
$sel = ''; |
525
|
|
|
if ($id_price == $typeprice) { |
526
|
|
|
$sel = 'selected'; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
echo "<option value=\"$id_price\" $sel>$nom_price</option>"; |
530
|
|
|
} |
531
|
|
|
echo '</select></td>'; |
532
|
|
|
|
533
|
|
|
/////// Category |
534
|
|
|
echo "<tr class='head' border='1'> |
535
|
|
|
<td>" . _AM_ADSLIGHT_CAT2 . ' </td><td>'; |
536
|
|
|
$mytree->makeMySelBox('title', 'title', $cid); |
537
|
|
|
echo "</td> |
538
|
|
|
</tr><tr class='head' border='1'> |
539
|
|
|
<td>" . _AM_ADSLIGHT_DESC . ' </td><td>'; |
540
|
|
|
|
541
|
|
|
$wysiwyg_text_area = AdslightUtilities::getEditor('', 'desctext', $desctext, '100%', '200px', 'small'); |
542
|
|
|
echo $wysiwyg_text_area->render(); |
543
|
|
|
|
544
|
|
|
echo '</td></tr>'; |
545
|
|
|
|
546
|
|
|
echo "<tr class='head' border='1'> |
547
|
|
|
<td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"50\" value=\"$photo\"></td> |
548
|
|
|
</tr><tr>"; |
549
|
|
|
$time = time(); |
550
|
|
|
echo "</tr><tr class='head' border='1'> |
551
|
|
|
<td> </td><td><select name=\"op\"> |
552
|
|
|
<option value=\"ModifyAdsS\"> " . _AM_ADSLIGHT_MODIF . " |
553
|
|
|
<option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
554
|
|
|
</select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td> |
555
|
|
|
</tr></table>"; |
556
|
|
|
echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
557
|
|
|
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
558
|
|
|
echo "<input type=\"hidden\" name=\"date\" value=\"$time\">"; |
559
|
|
|
echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\"> |
560
|
|
|
</form><br>"; |
561
|
|
|
echo '</fieldset><br>'; |
562
|
|
|
xoops_cp_footer(); |
563
|
|
|
} |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
# function modifyAdsS |
567
|
|
|
##################################################### |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* @param $lid |
571
|
|
|
* @param $cat |
572
|
|
|
* @param $title |
573
|
|
|
* @param $status |
574
|
|
|
* @param $expire |
575
|
|
|
* @param $type |
576
|
|
|
* @param $desctext |
577
|
|
|
* @param $tel |
578
|
|
|
* @param $price |
579
|
|
|
* @param $typeprice |
580
|
|
|
* @param $typeusure |
581
|
|
|
* @param $date |
582
|
|
|
* @param $email |
583
|
|
|
* @param $submitter |
584
|
|
|
* @param $town |
585
|
|
|
* @param $country |
586
|
|
|
* @param $contactby |
587
|
|
|
* @param $premium |
588
|
|
|
* @param $valid |
589
|
|
|
* @param $photo |
590
|
|
|
*/ |
591
|
|
View Code Duplication |
function modifyAdsS( |
|
|
|
|
592
|
|
|
$lid, |
593
|
|
|
$cat, |
594
|
|
|
$title, |
595
|
|
|
$status, |
596
|
|
|
$expire, |
597
|
|
|
$type, |
598
|
|
|
$desctext, |
599
|
|
|
$tel, |
600
|
|
|
$price, |
601
|
|
|
$typeprice, |
602
|
|
|
$typeusure, |
603
|
|
|
$date, |
604
|
|
|
$email, |
605
|
|
|
$submitter, |
606
|
|
|
$town, |
607
|
|
|
$country, |
608
|
|
|
$contactby, |
609
|
|
|
$premium, |
610
|
|
|
$valid, |
611
|
|
|
$photo |
612
|
|
|
) { |
613
|
|
|
global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
|
|
|
|
614
|
|
|
|
615
|
|
|
$title = $myts->htmlSpecialChars($title); |
616
|
|
|
$status = $myts->htmlSpecialChars($status); |
617
|
|
|
$expire = $myts->htmlSpecialChars($expire); |
618
|
|
|
$type = $myts->htmlSpecialChars($type); |
619
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 1, 1); |
620
|
|
|
$tel = $myts->htmlSpecialChars($tel); |
621
|
|
|
$price = str_replace(array(' '), '', $price); |
622
|
|
|
$typeprice = $myts->htmlSpecialChars($typeprice); |
623
|
|
|
$typeusure = $myts->htmlSpecialChars($typeusure); |
624
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
625
|
|
|
$town = $myts->htmlSpecialChars($town); |
626
|
|
|
$country = $myts->htmlSpecialChars($country); |
627
|
|
|
$contactby = $myts->htmlSpecialChars($contactby); |
628
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
629
|
|
|
|
630
|
|
|
$xoopsDB->query('UPDATE ' |
631
|
|
|
. $xoopsDB->prefix('adslight_listing') |
632
|
|
|
. " SET cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$date', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' WHERE lid=$lid"); |
633
|
|
|
|
634
|
|
|
redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD); |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
# function listingDel |
638
|
|
|
##################################################### |
639
|
|
|
/** |
640
|
|
|
* @param $lid |
641
|
|
|
* @param $photo |
642
|
|
|
*/ |
643
|
|
View Code Duplication |
function listingDel($lid, $photo) |
|
|
|
|
644
|
|
|
{ |
645
|
|
|
global $xoopsDB, $moduleDirName, $admin_lang; |
|
|
|
|
646
|
|
|
|
647
|
|
|
$result2 = $xoopsDB->query('SELECT p.url FROM ' |
648
|
|
|
. $xoopsDB->prefix('adslight_listing') |
649
|
|
|
. ' l LEFT JOIN ' |
650
|
|
|
. $xoopsDB->prefix('adslight_pictures') |
651
|
|
|
. ' p ON l.lid=p.lid WHERE l.lid=' |
652
|
|
|
. $xoopsDB->escape($lid) |
653
|
|
|
. ''); |
654
|
|
|
|
655
|
|
|
while (list($purl) = $xoopsDB->fetchRow($result2)) { |
656
|
|
|
if ($purl) { |
657
|
|
|
$destination = XOOPS_ROOT_PATH . '/uploads/AdsLight'; |
658
|
|
|
if (file_exists("$destination/$purl")) { |
659
|
|
|
unlink("$destination/$purl"); |
660
|
|
|
} |
661
|
|
|
$destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs'; |
662
|
|
|
if (file_exists("$destination2/thumb_$purl")) { |
663
|
|
|
unlink("$destination2/thumb_$purl"); |
664
|
|
|
} |
665
|
|
|
$destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize'; |
666
|
|
|
if (file_exists("$destination3/resized_$purl")) { |
667
|
|
|
unlink("$destination3/resized_$purl"); |
668
|
|
|
} |
669
|
|
|
$xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid=$lid"); |
670
|
|
|
} |
671
|
|
|
} |
672
|
|
|
|
673
|
|
|
$xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid=$lid"); |
674
|
|
|
|
675
|
|
|
redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNDEL); |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
# function listingValid |
679
|
|
|
##################################################### |
680
|
|
|
/** |
681
|
|
|
* @param $lid |
682
|
|
|
* @param $cat |
683
|
|
|
* @param $title |
684
|
|
|
* @param $status |
685
|
|
|
* @param $expire |
686
|
|
|
* @param $type |
687
|
|
|
* @param $desctext |
688
|
|
|
* @param $tel |
689
|
|
|
* @param $price |
690
|
|
|
* @param $typeprice |
691
|
|
|
* @param $typeusure |
692
|
|
|
* @param $date |
693
|
|
|
* @param $email |
694
|
|
|
* @param $submitter |
695
|
|
|
* @param $town |
696
|
|
|
* @param $country |
697
|
|
|
* @param $contactby |
698
|
|
|
* @param $premium |
699
|
|
|
* @param $valid |
700
|
|
|
* @param $photo |
701
|
|
|
*/ |
702
|
|
View Code Duplication |
function listingValid( |
|
|
|
|
703
|
|
|
$lid, |
704
|
|
|
$cat, |
705
|
|
|
$title, |
706
|
|
|
$status, |
707
|
|
|
$expire, |
708
|
|
|
$type, |
709
|
|
|
$desctext, |
710
|
|
|
$tel, |
711
|
|
|
$price, |
712
|
|
|
$typeprice, |
713
|
|
|
$typeusure, |
714
|
|
|
$date, |
715
|
|
|
$email, |
716
|
|
|
$submitter, |
717
|
|
|
$town, |
718
|
|
|
$country, |
719
|
|
|
$contactby, |
720
|
|
|
$premium, |
721
|
|
|
$valid, |
722
|
|
|
$photo |
723
|
|
|
) { |
724
|
|
|
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang; |
|
|
|
|
725
|
|
|
|
726
|
|
|
$title = $myts->htmlSpecialChars($title); |
727
|
|
|
$status = $myts->htmlSpecialChars($status); |
728
|
|
|
$expire = $myts->htmlSpecialChars($expire); |
729
|
|
|
$type = $myts->htmlSpecialChars($type); |
730
|
|
|
$desctext = $myts->displayTarea($desctext, 1, 1, 1); |
731
|
|
|
$tel = $myts->htmlSpecialChars($tel); |
732
|
|
|
$price = str_replace(array(' '), '', $price); |
733
|
|
|
$typeprice = $myts->htmlSpecialChars($typeprice); |
734
|
|
|
$typeusure = $myts->htmlSpecialChars($typeusure); |
735
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
736
|
|
|
$town = $myts->htmlSpecialChars($town); |
737
|
|
|
$country = $myts->htmlSpecialChars($country); |
738
|
|
|
$contactby = $myts->htmlSpecialChars($contactby); |
739
|
|
|
$premium = $myts->htmlSpecialChars($premium); |
740
|
|
|
$now = time(); |
741
|
|
|
$xoopsDB->query('UPDATE ' |
742
|
|
|
. $xoopsDB->prefix('adslight_listing') |
743
|
|
|
. " SET cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$now', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' WHERE lid=$lid"); |
744
|
|
|
|
745
|
|
|
if ($email == '') { |
|
|
|
|
746
|
|
|
} else { |
747
|
|
|
$tags = array(); |
748
|
|
|
$tags['TITLE'] = $title; |
749
|
|
|
$tags['TYPE'] = AdslightUtilities::getNameType($type); |
750
|
|
|
$tags['SUBMITTER'] = $submitter; |
751
|
|
|
$tags['DESCTEXT'] = stripslashes($desctext); |
752
|
|
|
$tags['EMAIL'] = _AM_ADSLIGHT_EMAIL; |
753
|
|
|
$tags['TEL'] = _AM_ADSLIGHT_TEL; |
754
|
|
|
$tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
755
|
|
|
$tags['VEDIT_AD'] = _AM_ADSLIGHT_VEDIT_AD; |
756
|
|
|
$tags['ANNACCEPT'] = _AM_ADSLIGHT_ANNACCEPT; |
757
|
|
|
$tags['CONSULTTO'] = _AM_ADSLIGHT_CONSULTTO; |
758
|
|
|
$tags['THANKS'] = _ADSLIGHT_THANKS; |
759
|
|
|
$tags['TEAMOF'] = _AM_ADSLIGHT_TEAMOF; |
760
|
|
|
$tags['META_TITLE'] = $meta['title']; |
761
|
|
|
$tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . ''; |
762
|
|
|
$tags['YOUR_AD'] = _AM_ADSLIGHT_YOUR_AD; |
763
|
|
|
$tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
764
|
|
|
$tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON; |
765
|
|
|
$tags['APPROVED'] = _AM_ADSLIGHT_APPROVED; |
766
|
|
|
|
767
|
|
|
$subject = '' . _AM_ADSLIGHT_ANNACCEPT . ''; |
768
|
|
|
$mail =& getMailer(); |
769
|
|
|
$mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
770
|
|
|
$mail->setTemplate('listing_approve.tpl'); |
771
|
|
|
$mail->useMail(); |
772
|
|
|
$mail->multimailer->isHTML(true); |
773
|
|
|
$mail->setFromName($meta['title']); |
774
|
|
|
$mail->setFromEmail($xoopsConfig['adminmail']); |
775
|
|
|
$mail->setToEmails($email); |
776
|
|
|
$mail->setSubject($subject); |
777
|
|
|
$mail->assign($tags); |
778
|
|
|
$mail->send(); |
779
|
|
|
echo $mail->getErrors(); |
780
|
|
|
} |
781
|
|
|
|
782
|
|
|
$tags = array(); |
783
|
|
|
$tags['TITLE'] = $title; |
784
|
|
|
$tags['ADDED_TO_CAT'] = _AM_ADSLIGHT_ADDED_TO_CAT; |
785
|
|
|
$tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF; |
786
|
|
|
$tags['ERROR_NOTIF'] = _AM_ADSLIGHT_ERROR_NOTIF; |
787
|
|
|
$tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
788
|
|
|
$tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
789
|
|
|
$tags['FOLLOW_LINK'] = _AM_ADSLIGHT_FOLLOW_LINK; |
790
|
|
|
$tags['TYPE'] = AdslightUtilities::getNameType($type); |
791
|
|
|
$tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid; |
792
|
|
|
$sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat); |
793
|
|
|
$result = $xoopsDB->query($sql); |
794
|
|
|
$row = $xoopsDB->fetchArray($result); |
795
|
|
|
$tags['CATEGORY_TITLE'] = $row['title']; |
796
|
|
|
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat); |
797
|
|
|
$notification_handler = xoops_getHandler('notification'); |
798
|
|
|
$notification_handler->triggerEvent('global', 0, 'new_listing', $tags); |
799
|
|
|
$notification_handler->triggerEvent('category', $cat, 'new_listing', $tags); |
800
|
|
|
$notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags); |
801
|
|
|
|
802
|
|
|
redirect_header('validate_ads.php', 3, _AM_ADSLIGHT_ANNVALID); |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
##################################################### |
806
|
|
|
##################################################### |
807
|
|
|
|
808
|
|
|
foreach ($_POST as $k => $v) { |
809
|
|
|
${$k} = $v; |
810
|
|
|
} |
811
|
|
|
|
812
|
|
|
$pa = isset($_GET['pa']) ? $_GET['pa'] : ''; |
813
|
|
|
|
814
|
|
|
if (!isset($_POST['lid']) && isset($_GET['lid'])) { |
815
|
|
|
$lid = $_GET['lid']; |
816
|
|
|
} |
817
|
|
|
if (!isset($_POST['op']) && isset($_GET['op'])) { |
818
|
|
|
$op = $_GET['op']; |
819
|
|
|
} |
820
|
|
|
if (!isset($op)) { |
821
|
|
|
$op = ''; |
822
|
|
|
} |
823
|
|
|
|
824
|
|
View Code Duplication |
switch ($op) { |
|
|
|
|
825
|
|
|
|
826
|
|
|
case 'IndexView': |
827
|
|
|
indexView($lid); |
828
|
|
|
break; |
829
|
|
|
|
830
|
|
|
case 'ListingDel': |
831
|
|
|
listingDel($lid, $photo); |
832
|
|
|
break; |
833
|
|
|
|
834
|
|
|
case 'ListingValid': |
835
|
|
|
listingValid($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo); |
836
|
|
|
break; |
837
|
|
|
|
838
|
|
|
case 'ModifyAds': |
839
|
|
|
modifyAds($lid); |
840
|
|
|
break; |
841
|
|
|
|
842
|
|
|
case 'ModifyAdsS': |
843
|
|
|
modifyAdsS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo); |
844
|
|
|
break; |
845
|
|
|
|
846
|
|
|
default: |
847
|
|
|
index(); |
848
|
|
|
break; |
849
|
|
|
|
850
|
|
|
} |
851
|
|
|
|
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.