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