This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | /** @var Admin $adminObject */ |
||||||
30 | /** @var Helper $helper */ |
||||||
31 | require_once __DIR__ . '/admin_header.php'; |
||||||
32 | $op = Request::getString('op', 'list'); |
||||||
33 | global $moduleDirName; |
||||||
34 | $moduleDirName = \basename(\dirname(__DIR__)); |
||||||
35 | # function Index |
||||||
36 | ##################################################### |
||||||
37 | function index(): void |
||||||
38 | { |
||||||
39 | global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; |
||||||
40 | $helper = Helper::getInstance(); |
||||||
41 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||||
42 | $photo3 = ''; |
||||||
43 | // require_once __DIR__ . '/admin_header.php'; |
||||||
44 | xoops_cp_header(); |
||||||
45 | // loadModuleAdminMenu(0, ""); |
||||||
46 | // photo dir setting checker |
||||||
47 | $photo_dir = $helper->getConfig('adslight_path_upload', ''); |
||||||
48 | $photo_thumb_dir = $helper->getConfig('adslight_path_upload') . '/thumbs'; |
||||||
49 | $photo_resized_dir = $helper->getConfig('adslight_path_upload') . '/midsize'; |
||||||
50 | if (!is_dir($photo_dir) && (!mkdir($photo_dir) && !is_dir($photo_dir))) { |
||||||
51 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_dir)); |
||||||
52 | } |
||||||
53 | if (!is_dir($photo_thumb_dir) && (!mkdir($photo_thumb_dir) && !is_dir($photo_thumb_dir))) { |
||||||
54 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_thumb_dir)); |
||||||
55 | } |
||||||
56 | if (!is_dir($photo_resized_dir) && (!mkdir($photo_resized_dir) && !is_dir($photo_resized_dir))) { |
||||||
57 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_resized_dir)); |
||||||
58 | } |
||||||
59 | if (!is_writable($photo_dir) || !is_readable($photo_dir)) { |
||||||
60 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
||||||
61 | echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . $photo_dir . '</b></span><br><br>'; |
||||||
62 | echo '</fieldset><br>'; |
||||||
63 | } |
||||||
64 | if (!is_writable($photo_thumb_dir) || !is_readable($photo_thumb_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_thumb_dir . '</b></span><br><br>'; |
||||||
67 | echo '</fieldset><br>'; |
||||||
68 | } |
||||||
69 | if (!is_writable($photo_resized_dir) || !is_readable($photo_resized_dir)) { |
||||||
70 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
||||||
71 | echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . $photo_resized_dir . '</b></span><br><br>'; |
||||||
72 | echo '</fieldset><br>'; |
||||||
73 | } |
||||||
74 | |||||||
75 | $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='no' ORDER BY lid"; |
||||||
76 | $result = $xoopsDB->query($sql); |
||||||
77 | if (!$xoopsDB->isResultSet($result)) { |
||||||
78 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
79 | } |
||||||
80 | $numrows = $xoopsDB->getRowsNum($result); |
||||||
81 | if ($numrows > 0) { |
||||||
82 | ///////// There are [..] Ads waiting to be approved////// |
||||||
83 | echo "<table class='outer bnone' cellspacing=5 cellpadding=0><tr><td class='width40'>"; |
||||||
84 | echo "<img src='../assets/images/admin/error_button.png' border=0 ></td><td>"; |
||||||
85 | echo "<span style='color:#00B4C4;'><b>" . _AM_ADSLIGHT_THEREIS . "</b></span> <b>{$numrows}</b> <span style='color:#00B4C4;'>" . _AM_ADSLIGHT_WAIT . '</b></span>'; |
||||||
86 | echo '</td></tr></table><br>'; |
||||||
87 | ///// Liste des ID ///// Soumis par ///// Titre ///// Description ///// Date d'ajout |
||||||
88 | echo "<table width='100%' border='0' class='outer'>"; |
||||||
89 | $rank = 1; |
||||||
90 | while ([$lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typecondition, $date_created, $email, $submitter, $town, $country, $contactby, $premium, $photo, $usid] = $xoopsDB->fetchRow( |
||||||
91 | $result |
||||||
92 | )) { |
||||||
93 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||||
94 | // $desctext = $myts->displayTarea($desctext, 1, 0, 1, 1, 1); |
||||||
95 | // if (mb_strlen($desctext) >= 200) { |
||||||
96 | // $desctext = mb_substr($desctext, 0, 199) . '...'; |
||||||
97 | // } else { |
||||||
98 | // $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
99 | // } |
||||||
100 | |||||||
101 | $date2 = formatTimestamp($date_created, 's'); |
||||||
102 | |||||||
103 | $color = is_int($rank / 2) ? '#ffffff' : 'head'; |
||||||
0 ignored issues
–
show
|
|||||||
104 | |||||||
105 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||||||
106 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||||
107 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||||
108 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||||
109 | // $price = number_format($price, 2, ',', ' '); |
||||||
110 | xoops_load('XoopsLocal'); |
||||||
111 | $tempXoopsLocal = new \XoopsLocal(); |
||||||
112 | // For US currency with 2 numbers after the decimal comment out if you don't want 2 numbers after decimal |
||||||
113 | $price = $tempXoopsLocal->number_format($price); |
||||||
114 | // For other countries uncomment the below line and comment out the above line |
||||||
115 | // $price = $tempXoopsLocal->number_format($price); |
||||||
116 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||||
117 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||||
118 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||||
119 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||||
120 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||||
121 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||||
122 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||||
123 | $updir = $helper->getConfig('adslight_link_upload'); |
||||||
124 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE uid_owner=' . (int)$usid . ' AND lid=' . (int)$lid . ' ORDER BY date_created ASC LIMIT 1'; |
||||||
125 | $resultp = $xoopsDB->query($sql); |
||||||
126 | if (!$xoopsDB->isResultSet($resultp)) { |
||||||
127 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
128 | } |
||||||
129 | while ([$cod_img, $pic_lid, $uid_owner, $url] = $xoopsDB->fetchRow($resultp)) { |
||||||
130 | if ($photo) { |
||||||
131 | $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>"; |
||||||
132 | } |
||||||
133 | } |
||||||
134 | if ($photo <= 0) { |
||||||
135 | $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>"; |
||||||
136 | } |
||||||
137 | $photo4 = $photo > 0 ? (string)$photo : '0'; |
||||||
138 | $sql = 'SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' WHERE id_type=' . (int)$type; |
||||||
139 | $result7 = $xoopsDB->query($sql); |
||||||
140 | if (!$xoopsDB->isResultSet($result7)) { |
||||||
141 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
142 | } |
||||||
143 | [$nom_type] = $xoopsDB->fetchRow($result7); |
||||||
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 | /* $sql = "select nom_condition from ".$xoopsDB->prefix('adslight_condition')." where id_condition=".(int)$typecondition.""; |
||||||
151 | $result9 = $xoopsDB->query($sql); |
||||||
152 | list($nom_condition) = $xoopsDB->fetchRow($result9); */ |
||||||
153 | echo '<form action="validate_ads.php" method="post">'; |
||||||
154 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||||
155 | echo "<tr><th class='left'>" . _AM_ADSLIGHT_LID . ": {$lid}</th><th class='left'>{$photo4} " . _AM_ADSLIGHT_NBR_PHOTO . "</th><th align='left'>" . _AM_ADSLIGHT_TITLE . ":</th><th align='left'>" . _AM_ADSLIGHT_DESC . "</th><th align='left'></th></tr>"; |
||||||
156 | echo "<tr><td class='even' width='3%'></td>"; |
||||||
157 | echo "<td class='odd width10'>{$photo3}</td>"; |
||||||
158 | echo "<td class='even width20'><b>{$title}</b><br><br>{$nom_type}<br>{$price} {$helper->getConfig('adslight_currency_symbol') } {$nom_price}<br>"; |
||||||
159 | echo "{$town} - {$country}<br>"; |
||||||
160 | echo '<b>' . _AM_ADSLIGHT_SUBMITTER . ":</b> {$submitter}<br>"; |
||||||
161 | echo '<b>' . _AM_ADSLIGHT_DATE . ":</b> {$date2}</td>"; |
||||||
162 | echo "<td class='even width35'>{$desctext}</td><td class='even right' width='2%'></td>"; |
||||||
163 | echo "</tr><tr><td width='5%'></td><td>"; |
||||||
164 | echo '<select name="op"> |
||||||
165 | <option value="ListingValid"> ' . _AM_ADSLIGHT_OK . ' |
||||||
166 | <option value="IndexView"> ' . _AM_ADSLIGHT_MODIF . ' |
||||||
167 | <option value="ListingDel"> ' . _AM_ADSLIGHT_DEL . ' |
||||||
168 | </select><input type="submit" value="' . _AM_ADSLIGHT_GO . '">'; |
||||||
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 | echo '</td></tr></table> |
||||||
193 | <br><br>'; |
||||||
194 | } else { |
||||||
195 | echo "<table class='outer' width='50%' border='0'><tr><td width=40>"; |
||||||
196 | echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" ></td><td>"; |
||||||
197 | echo "<span style='color: #00B4C4;'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></span>'; |
||||||
198 | echo '</td></tr></table><br>'; |
||||||
199 | } |
||||||
200 | // Modify Annonces |
||||||
201 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' '; |
||||||
202 | $result = $xoopsDB->query($sql); |
||||||
203 | if (!$xoopsDB->isResultSet($result)) { |
||||||
204 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
205 | } |
||||||
206 | [$numrows] = $xoopsDB->fetchRow($result); |
||||||
207 | if ($numrows > 0) { |
||||||
208 | echo "<table class='outer width100 bnone'><tr class='bg4'><td class='top'>"; |
||||||
209 | echo '<form method="post" action="validate_ads.php">' |
||||||
210 | . '<b>' |
||||||
211 | . _AM_ADSLIGHT_MODANN |
||||||
212 | . '</b><br><br>' |
||||||
213 | . _AM_ADSLIGHT_NUMANN |
||||||
214 | . ' <input type="text" name="lid" size="12" maxlength="11"> ' |
||||||
215 | . '<input type="hidden" name="op" value="modifyAds">' |
||||||
216 | . '<input type="submit" value="' |
||||||
217 | . _AM_ADSLIGHT_MODIF |
||||||
218 | . '">' |
||||||
219 | . '</form><br>'; |
||||||
220 | echo '</td></tr></table><br>'; |
||||||
221 | } |
||||||
222 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td class='top'>"; |
||||||
223 | echo '<a href="map.php">' . _AM_ADSLIGHT_GESTCAT . '</a> | <a href="../index.php">' . _AM_ADSLIGHT_ACCESMYANN . '</a>'; |
||||||
224 | echo '</td></tr></table><br>'; |
||||||
225 | xoops_cp_footer(); |
||||||
226 | } |
||||||
227 | |||||||
228 | # function IndexView |
||||||
229 | ##################################################### |
||||||
230 | /** |
||||||
231 | * @param $lid |
||||||
232 | */ |
||||||
233 | function indexView($lid): void |
||||||
234 | { |
||||||
235 | global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; |
||||||
236 | $helper = Helper::getInstance(); |
||||||
237 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||||
238 | // require_once __DIR__ . '/admin_header.php'; |
||||||
239 | xoops_cp_header(); |
||||||
240 | // loadModuleAdminMenu(0, ""); |
||||||
241 | $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='" . (int)$lid . "'"; |
||||||
242 | $result = $xoopsDB->query($sql); |
||||||
243 | if (!$xoopsDB->isResultSet($result)) { |
||||||
244 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
245 | } |
||||||
246 | $numrows = $xoopsDB->getRowsNum($result); |
||||||
247 | if ($numrows > 0) { |
||||||
248 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>"; |
||||||
249 | echo '<b>' . _AM_ADSLIGHT_WAIT . '</b><br><br>'; |
||||||
250 | [$lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typecondition, $date_created, $email, $submitter, $town, $country, $contactby, $premium, $photo] = $xoopsDB->fetchRow($result); |
||||||
251 | $date2 = formatTimestamp($date_created, 's'); |
||||||
252 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||||
253 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||||||
254 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||||
255 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||||
256 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
257 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||||
258 | // $price = number_format($price, 2, ',', ' '); |
||||||
259 | xoops_load('XoopsLocal'); |
||||||
260 | $tempXoopsLocal = new \XoopsLocal(); |
||||||
261 | // For US currency with 2 numbers after the decimal comment out if you don't want 2 numbers after decimal |
||||||
262 | $price = $tempXoopsLocal->number_format($price); |
||||||
263 | // For other countries uncomment the below line and comment out the above line |
||||||
264 | // $price = $tempXoopsLocal->number_format($price); |
||||||
265 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||||
266 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||||
267 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||||
268 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||||
269 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||||
270 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||||
271 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||||
272 | echo '<form action="validate_ads.php" method="post">'; |
||||||
273 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||||
274 | echo "<table><tr class='head' border='1'> |
||||||
275 | <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>{$lid} " . _AM_ADSLIGHT_ADDED_ON . " {$date2}</td> |
||||||
276 | </tr><tr class='odd' border='1'> |
||||||
277 | <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>{$submitter}</td> |
||||||
278 | </tr><tr class='head' border='1'> |
||||||
279 | <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"{$email}\"></td> |
||||||
280 | </tr><tr class='head' border='1'> |
||||||
281 | <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"{$tel}\"></td> |
||||||
282 | </tr><tr class='head' border='1'> |
||||||
283 | <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"{$town}\"></td> |
||||||
284 | </tr><tr class='head' border='1'> |
||||||
285 | <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"{$country}\"></td> |
||||||
286 | </tr><tr class='head' border='1'> |
||||||
287 | <td>" . _AM_ADSLIGHT_CONTACTBY . " </td><td><input type=\"text\" name=\"contactby\" size=\"40\" value=\"{$contactby}\"></td> |
||||||
288 | </tr>"; |
||||||
289 | echo "<tr> |
||||||
290 | <td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||||||
291 | if (0 === (int)$status) { |
||||||
292 | echo 'checked'; |
||||||
293 | } |
||||||
294 | echo '>' . _AM_ADSLIGHT_ACTIVE . ' <input type="radio" name="status" value="1"'; |
||||||
295 | if (1 === (int)$status) { |
||||||
296 | echo 'checked'; |
||||||
297 | } |
||||||
298 | echo '>' . _AM_ADSLIGHT_INACTIVE . ' <input type="radio" name="status" value="2"'; |
||||||
299 | if (2 === (int)$status) { |
||||||
300 | echo 'checked'; |
||||||
301 | } |
||||||
302 | echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
||||||
303 | echo "<tr class='head' border='1'> |
||||||
304 | <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"{$title}\"></td> |
||||||
305 | </tr><tr class='head' border='1'> |
||||||
306 | <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"{$premium}\"></td> |
||||||
307 | </tr><tr class='head' border='1'> |
||||||
308 | <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"{$expire}\"></td> |
||||||
309 | </tr><tr class='head' border='1'> |
||||||
310 | <td>" . _AM_ADSLIGHT_TYPE . ' </td><td><select name="type">'; |
||||||
311 | $sql = 'SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'; |
||||||
312 | $result5 = $xoopsDB->query($sql); |
||||||
313 | if (!$xoopsDB->isResultSet($result5)) { |
||||||
314 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
315 | } |
||||||
316 | while ([$nom_type] = $xoopsDB->fetchRow($result5)) { |
||||||
317 | $sel = ''; |
||||||
318 | if ($nom_type === $type) { |
||||||
319 | $sel = 'selected'; |
||||||
320 | } |
||||||
321 | echo "<option value=\"{$nom_type}\"{$sel}>{$nom_type}</option>"; |
||||||
322 | } |
||||||
323 | echo '</select></td></tr>'; |
||||||
324 | |||||||
325 | ////// Etat d'condition |
||||||
326 | echo "<tr class='head' border='1'> |
||||||
327 | <td>" . _AM_ADSLIGHT_TYPE_CONDITION . ' </td><td><select name="typecondition">'; |
||||||
328 | $sql = 'SELECT nom_condition FROM ' . $xoopsDB->prefix('adslight_condition') . ' ORDER BY nom_condition'; |
||||||
329 | $result6 = $xoopsDB->query($sql); |
||||||
330 | if (!$xoopsDB->isResultSet($result6)) { |
||||||
331 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
332 | } |
||||||
333 | while ([$nom_condition] = $xoopsDB->fetchRow($result6)) { |
||||||
334 | $sel = ''; |
||||||
335 | if ($nom_condition === $typecondition) { |
||||||
336 | $sel = 'selected'; |
||||||
337 | } |
||||||
338 | echo "<option value=\"{$nom_condition}\"{$sel}>{$nom_condition}</option>"; |
||||||
339 | } |
||||||
340 | echo '</select></td></tr>'; |
||||||
341 | 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'); |
||||||
342 | $sql = 'SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price'; |
||||||
343 | $result3 = $xoopsDB->query($sql); |
||||||
344 | if (!$xoopsDB->isResultSet($result3)) { |
||||||
345 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
346 | } |
||||||
347 | echo " <select name=\"typeprice\"><option value=\"{$typeprice}\">{$typeprice}</option>"; |
||||||
348 | while ([$nom_price] = $xoopsDB->fetchRow($result3)) { |
||||||
349 | echo "<option value=\"{$nom_price}\">{$nom_price}</option>"; |
||||||
350 | } |
||||||
351 | echo '</select></td></tr>'; |
||||||
352 | echo "<tr class='head' border='1'> |
||||||
353 | <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"40\" value=\"{$photo}\"></td> |
||||||
354 | </tr>"; |
||||||
355 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_DESC . '</td><td>'; |
||||||
356 | $wysiwyg_text_area = Utility::getEditor( |
||||||
357 | _AM_ADSLIGHT_DESC |
||||||
0 ignored issues
–
show
_AM_ADSLIGHT_DESC of type string is incompatible with the type Xmf\Module\Helper|null expected by parameter $helper of XoopsModules\Adslight\Co...SysUtility::getEditor() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
358 | ); |
||||||
359 | echo $wysiwyg_text_area->render(); |
||||||
360 | echo '</td></tr>'; |
||||||
361 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_CAT . ' </td><td>'; |
||||||
362 | $mytree->makeMySelBox('title', 'title', $cid); |
||||||
363 | echo "</td> |
||||||
364 | </tr><tr class='head' border='1'> |
||||||
365 | <td> </td><td><select name=\"op\"> |
||||||
366 | <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . ' |
||||||
367 | <option value="ListingDel"> ' . _AM_ADSLIGHT_DEL . ' |
||||||
368 | </select><input type="submit" value="' . _AM_ADSLIGHT_GO . '"></td> |
||||||
369 | </tr></table>'; |
||||||
370 | echo '<input type="hidden" name="valid" value="Yes">'; |
||||||
371 | echo "<input type=\"hidden\" name=\"lid\" value=\"{$lid}\">"; |
||||||
372 | echo "<input type=\"hidden\" name=\"date_created\" value=\"{$date_created}\">"; |
||||||
373 | echo "<input type=\"hidden\" name=\"submitter\" value=\"{$submitter}\"> |
||||||
374 | </form>"; |
||||||
375 | echo '</td></tr></table>'; |
||||||
376 | echo '<br>'; |
||||||
377 | } |
||||||
378 | xoops_cp_footer(); |
||||||
379 | } |
||||||
380 | |||||||
381 | # function modifyAds |
||||||
382 | ##################################################### |
||||||
383 | /** |
||||||
384 | * @param $lid |
||||||
385 | */ |
||||||
386 | function modifyAds($lid): void |
||||||
387 | { |
||||||
388 | global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; |
||||||
389 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||||
390 | $helper = Helper::getInstance(); |
||||||
391 | $id_price = ''; |
||||||
392 | $nom_price = ''; |
||||||
393 | $lid = (int)$lid; |
||||||
394 | $contactselect = ''; |
||||||
395 | // require_once __DIR__ . '/admin_header.php'; |
||||||
396 | xoops_cp_header(); |
||||||
397 | // loadModuleAdminMenu(0, ""); |
||||||
398 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>'; |
||||||
399 | |||||||
400 | $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}"; |
||||||
401 | $result = $xoopsDB->query($sql); |
||||||
402 | if (!$xoopsDB->isResultSet($result)) { |
||||||
403 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
404 | } |
||||||
405 | while ([$lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typecondition, $date_created, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo] = $xoopsDB->fetchRow( |
||||||
406 | $result |
||||||
407 | )) { |
||||||
408 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||||
409 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||||||
410 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||||
411 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||||
412 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
413 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||||
414 | // $price = number_format($price, 2, ',', ' '); |
||||||
415 | xoops_load('XoopsLocal'); |
||||||
416 | $tempXoopsLocal = new \XoopsLocal(); |
||||||
417 | // For US currency with 2 numbers after the decimal comment out if you don't want 2 numbers after decimal |
||||||
418 | $price = $tempXoopsLocal->number_format($price); |
||||||
419 | // For other countries uncomment the below line and comment out the above line |
||||||
420 | // $price = $tempXoopsLocal->number_format($price); |
||||||
421 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||||
422 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||||
423 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||||
424 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||||
425 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||||
426 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||||
427 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||||
428 | $date2 = formatTimestamp($date_created, 's'); |
||||||
429 | echo '<form action="validate_ads.php" method=post>'; |
||||||
430 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||||
431 | echo "<table class='bnone'><tr class='head' border='1'> |
||||||
432 | <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>{$lid} " . _AM_ADSLIGHT_ADDED_ON . " {$date2}</td> |
||||||
433 | </tr><tr class='head' border='1'> |
||||||
434 | <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>{$submitter}</td> |
||||||
435 | </tr><tr class='head' border='1'> |
||||||
436 | <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"{$email}\"></td> |
||||||
437 | </tr><tr class='head' border='1'> |
||||||
438 | <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"{$tel}\"></td> |
||||||
439 | </tr><tr class='head' border='1'> |
||||||
440 | <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"{$town}\"></td> |
||||||
441 | </tr><tr class='head' border='1'> |
||||||
442 | <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"{$country}\"></td> |
||||||
443 | </tr> |
||||||
444 | <tr class='head' border='1'>"; |
||||||
445 | if (1 === $contactby) { |
||||||
446 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_EMAIL; |
||||||
447 | } |
||||||
448 | if (2 === $contactby) { |
||||||
449 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_PM; |
||||||
450 | } |
||||||
451 | if (3 === $contactby) { |
||||||
452 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_BOTH; |
||||||
453 | } |
||||||
454 | if (4 === $contactby) { |
||||||
455 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_PHONE; |
||||||
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 | echo "<tr><td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||||||
464 | if (0 === (int)$status) { |
||||||
465 | echo 'checked'; |
||||||
466 | } |
||||||
467 | echo '>' . _AM_ADSLIGHT_ACTIVE . ' <input type="radio" name="status" value="1"'; |
||||||
468 | if (1 === (int)$status) { |
||||||
469 | echo 'checked'; |
||||||
470 | } |
||||||
471 | echo '>' . _AM_ADSLIGHT_INACTIVE . ' <input type="radio" name="status" value="2"'; |
||||||
472 | if (2 === (int)$status) { |
||||||
473 | echo 'checked'; |
||||||
474 | } |
||||||
475 | echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
||||||
476 | echo "<tr class='head' border='1'> |
||||||
477 | <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"{$title}\"></td> |
||||||
478 | </tr><tr class='head' border='1'> |
||||||
479 | <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"{$premium}\"></td> |
||||||
480 | </tr><tr class='head' border='1'> |
||||||
481 | <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"{$expire}\"></td> |
||||||
482 | </tr>"; |
||||||
483 | ////// Type d'annonce |
||||||
484 | echo "<tr class='head' border='1'> |
||||||
485 | <td>" . _AM_ADSLIGHT_TYPE . ' </td><td><select name="type">'; |
||||||
486 | $sql = 'SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'; |
||||||
487 | $result5 = $xoopsDB->query($sql); |
||||||
488 | if (!$xoopsDB->isResultSet($result5)) { |
||||||
489 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
490 | } |
||||||
491 | while ([$nom_type, $id_type] = $xoopsDB->fetchRow($result5)) { |
||||||
492 | $sel = ''; |
||||||
493 | if ($id_type === $type) { |
||||||
494 | $sel = 'selected'; |
||||||
495 | } |
||||||
496 | echo "<option value=\"{$id_type}\"{$sel}>{$nom_type}</option>"; |
||||||
497 | } |
||||||
498 | echo '</select></td></tr>'; |
||||||
499 | |||||||
500 | ////// Condition |
||||||
501 | echo "<tr class='head' border='1'> |
||||||
502 | <td>" . _AM_ADSLIGHT_TYPE_CONDITION . ' </td><td><select name="typecondition">'; |
||||||
503 | $sql = 'SELECT nom_condition, id_condition FROM ' . $xoopsDB->prefix('adslight_condition') . ' ORDER BY nom_condition'; |
||||||
504 | $result6 = $xoopsDB->query($sql); |
||||||
505 | if (!$xoopsDB->isResultSet($result6)) { |
||||||
506 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
507 | } |
||||||
508 | while ([$nom_condition, $id_condition] = $xoopsDB->fetchRow($result6)) { |
||||||
509 | $sel = ''; |
||||||
510 | if ($id_condition === $typecondition) { |
||||||
511 | $sel = 'selected'; |
||||||
512 | } |
||||||
513 | echo "<option value=\"{$id_condition}\"{$sel}>{$nom_condition}</option>"; |
||||||
514 | } |
||||||
515 | echo '</select></td></tr>'; |
||||||
516 | //////// Price |
||||||
517 | 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'); |
||||||
518 | //////// Price type |
||||||
519 | $sql = 'SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY nom_price'; |
||||||
520 | $resultx = $xoopsDB->query($sql); |
||||||
521 | if (!$xoopsDB->isResultSet($resultx)) { |
||||||
522 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
523 | } |
||||||
524 | echo " <select name=\"typeprice\"><option value=\"{$id_price}\">{$nom_price}</option>"; |
||||||
525 | while ([$nom_price, $id_price] = $xoopsDB->fetchRow($resultx)) { |
||||||
526 | $sel = ''; |
||||||
527 | if ($id_price === $typeprice) { |
||||||
528 | $sel = 'selected'; |
||||||
529 | } |
||||||
530 | echo "<option value=\"{$id_price}\"{$sel}>{$nom_price}</option>"; |
||||||
531 | } |
||||||
532 | echo '</select></td>'; |
||||||
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 | // $wysiwyg_text_area = Utility::getEditor('', 'desctext', $desctext, '100%', '200px', 'small'); |
||||||
541 | $wysiwyg_text_area = Utility::getEditor($helper); |
||||||
542 | echo $wysiwyg_text_area->render(); |
||||||
543 | echo '</td></tr>'; |
||||||
544 | |||||||
545 | echo "<tr class='head' border='1'> |
||||||
546 | <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"50\" value=\"{$photo}\"></td> |
||||||
547 | </tr><tr>"; |
||||||
548 | $time = time(); |
||||||
549 | echo "</tr><tr class='head' border='1'> |
||||||
550 | <td> </td><td><select name=\"op\"> |
||||||
551 | <option value=\"modifyAdsS\"> " . _AM_ADSLIGHT_MODIF . ' |
||||||
552 | <option value="ListingDel"> ' . _AM_ADSLIGHT_DEL . ' |
||||||
553 | </select><input type="submit" value="' . _AM_ADSLIGHT_GO . '"></td> |
||||||
554 | </tr></table>'; |
||||||
555 | echo '<input type="hidden" name="valid" value="Yes">'; |
||||||
556 | echo "<input type=\"hidden\" name=\"lid\" value=\"{$lid}\">"; |
||||||
557 | echo "<input type=\"hidden\" name=\"date_created\" value=\"{$time}\">"; |
||||||
558 | echo "<input type=\"hidden\" name=\"submitter\" value=\"{$submitter}\"> |
||||||
559 | </form><br>"; |
||||||
560 | echo '</fieldset><br>'; |
||||||
561 | xoops_cp_footer(); |
||||||
562 | } |
||||||
563 | } |
||||||
564 | |||||||
565 | # function modifyAdsS |
||||||
566 | ##################################################### |
||||||
567 | /** |
||||||
568 | * @param $lid |
||||||
569 | * @param $cat |
||||||
570 | * @param $title |
||||||
571 | * @param $status |
||||||
572 | * @param $expire |
||||||
573 | * @param $type |
||||||
574 | * @param $desctext |
||||||
575 | * @param $tel |
||||||
576 | * @param $price |
||||||
577 | * @param $typeprice |
||||||
578 | * @param $typecondition |
||||||
579 | * @param $date_created |
||||||
580 | * @param $email |
||||||
581 | * @param $submitter |
||||||
582 | * @param $town |
||||||
583 | * @param $country |
||||||
584 | * @param $contactby |
||||||
585 | * @param $premium |
||||||
586 | * @param $valid |
||||||
587 | * @param $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 | $helper = Helper::getInstance(); |
||||||
613 | // $lid = (int)$lid; |
||||||
614 | // $cat = (int)$cat; |
||||||
615 | // $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||||
616 | // $status = \htmlspecialchars($status); |
||||||
617 | // $status = (int)$status; |
||||||
618 | // $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||||
619 | // $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||||
620 | // $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
621 | // $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||||
622 | // $price = str_replace([' '], '', $price); |
||||||
623 | // $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||||
624 | // $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||||
625 | // $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||||
626 | // $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||||
627 | // $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||||
628 | // $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||||
629 | // $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||||
630 | |||||||
631 | // $xoopsDB->query('UPDATE ' |
||||||
632 | // . $xoopsDB->prefix('adslight_listing') |
||||||
633 | // . " 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}"); |
||||||
634 | $sql = 'UPDATE ' |
||||||
635 | . $xoopsDB->prefix('adslight_listing') |
||||||
636 | . " 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}"; |
||||||
637 | $result = $xoopsDB->query($sql); |
||||||
638 | if ($result) { |
||||||
639 | $helper->redirect('admin/validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD); |
||||||
640 | } else { |
||||||
641 | $helper->redirect('admin/validate_ads.php', 1, _AM_ADSLIGHT_UPGRADEFAILED); |
||||||
642 | } |
||||||
643 | } |
||||||
644 | |||||||
645 | # function listingDel |
||||||
646 | ##################################################### |
||||||
647 | /** |
||||||
648 | * @param $lid |
||||||
649 | * @param $photo |
||||||
650 | */ |
||||||
651 | function listingDel($lid, $photo): void |
||||||
0 ignored issues
–
show
The parameter
$photo is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
652 | { |
||||||
653 | global $xoopsDB, $admin_lang; |
||||||
654 | $helper = Helper::getInstance(); |
||||||
655 | $lid = (int)$lid; |
||||||
656 | $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}"; |
||||||
657 | $result2 = $xoopsDB->query($sql); |
||||||
658 | if (!$xoopsDB->isResultSet($result2)) { |
||||||
659 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
660 | } |
||||||
661 | while ([$purl] = $xoopsDB->fetchRow($result2)) { |
||||||
662 | if ($purl) { |
||||||
663 | $destination = XOOPS_ROOT_PATH . '/uploads/adslight'; |
||||||
664 | if (is_file("{$destination}/{$purl}")) { |
||||||
665 | unlink("{$destination}/{$purl}"); |
||||||
666 | } |
||||||
667 | $destination2 = XOOPS_ROOT_PATH . '/uploads/adslight/thumbs'; |
||||||
668 | if (is_file("{$destination2}/thumb_{$purl}")) { |
||||||
669 | unlink("{$destination2}/thumb_{$purl}"); |
||||||
670 | } |
||||||
671 | $destination3 = XOOPS_ROOT_PATH . '/uploads/adslight/midsize'; |
||||||
672 | if (is_file("{$destination3}/resized_{$purl}")) { |
||||||
673 | unlink("{$destination3}/resized_{$purl}"); |
||||||
674 | } |
||||||
675 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid={$lid}"; |
||||||
676 | $xoopsDB->query($sql); |
||||||
677 | } |
||||||
678 | } |
||||||
679 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}"; |
||||||
680 | $xoopsDB->query($sql); |
||||||
681 | $helper->redirect('admin/validate_ads.php', 1, _AM_ADSLIGHT_ANNDEL); |
||||||
682 | } |
||||||
683 | |||||||
684 | # function listingValid |
||||||
685 | ##################################################### |
||||||
686 | /** |
||||||
687 | * @param $lid |
||||||
688 | * @param $cat |
||||||
689 | * @param $title |
||||||
690 | * @param $status |
||||||
691 | * @param $expire |
||||||
692 | * @param $type |
||||||
693 | * @param $desctext |
||||||
694 | * @param $tel |
||||||
695 | * @param $price |
||||||
696 | * @param $typeprice |
||||||
697 | * @param $typecondition |
||||||
698 | * @param $date_created |
||||||
699 | * @param $email |
||||||
700 | * @param $submitter |
||||||
701 | * @param $town |
||||||
702 | * @param $country |
||||||
703 | * @param $contactby |
||||||
704 | * @param $premium |
||||||
705 | * @param $valid |
||||||
706 | * @param $photo |
||||||
707 | */ |
||||||
708 | function listingValid( |
||||||
709 | $lid, |
||||||
710 | $cat, |
||||||
711 | $title, |
||||||
712 | $status, |
||||||
713 | $expire, |
||||||
714 | $type, |
||||||
715 | $desctext, |
||||||
716 | $tel, |
||||||
717 | $price, |
||||||
718 | $typeprice, |
||||||
719 | $typecondition, |
||||||
720 | $date_created, |
||||||
0 ignored issues
–
show
The parameter
$date_created is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
721 | $email, |
||||||
722 | $submitter, |
||||||
723 | $town, |
||||||
724 | $country, |
||||||
725 | $contactby, |
||||||
726 | $premium, |
||||||
727 | $valid, |
||||||
728 | $photo |
||||||
729 | ): void { |
||||||
730 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $admin_lang; |
||||||
731 | $helper = Helper::getInstance(); |
||||||
732 | $lid = (int)$lid; |
||||||
733 | $cat = (int)$cat; |
||||||
734 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||||
735 | // $status = \htmlspecialchars($status); |
||||||
736 | $status = (int)$status; |
||||||
737 | $expire = (int)$expire; |
||||||
738 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||||
739 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
740 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||||
741 | $price = (float)$price; |
||||||
742 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||||
743 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||||
744 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||||
745 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||||
746 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||||
747 | $contactby = (int)$contactby; |
||||||
748 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||||
749 | $now = time(); |
||||||
750 | $sql = 'UPDATE ' |
||||||
751 | . $xoopsDB->prefix('adslight_listing') |
||||||
752 | . " SET cid='{$cat}', 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 | $result = $xoopsDB->query($sql); |
||||||
754 | if ($result) { |
||||||
755 | $helper->redirect('admin/validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD); |
||||||
756 | } else { |
||||||
757 | $helper->redirect('admin/validate_ads.php', 1, _AM_ADSLIGHT_UPGRADEFAILED); |
||||||
758 | } |
||||||
759 | if ('' !== $email) { |
||||||
760 | $tags = []; |
||||||
761 | $tags['TITLE'] = $title; |
||||||
762 | $tags['TYPE'] = Utility::getNameType($type); |
||||||
763 | $tags['SUBMITTER'] = $submitter; |
||||||
764 | $tags['DESCTEXT'] = stripslashes($desctext); |
||||||
765 | $tags['EMAIL'] = _AM_ADSLIGHT_EMAIL; |
||||||
766 | $tags['TEL'] = _AM_ADSLIGHT_TEL; |
||||||
767 | $tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
||||||
768 | $tags['VEDIT_AD'] = _AM_ADSLIGHT_VEDIT_AD; |
||||||
769 | $tags['ANNACCEPT'] = _AM_ADSLIGHT_ANNACCEPT; |
||||||
770 | $tags['CONSULTTO'] = _AM_ADSLIGHT_CONSULTTO; |
||||||
771 | $tags['THANKS'] = _ADSLIGHT_THANKS; |
||||||
772 | $tags['TEAMOF'] = _AM_ADSLIGHT_TEAMOF; |
||||||
773 | $tags['META_TITLE'] = $meta['title']; |
||||||
774 | $tags['LINK_URL'] = $helper->path("/viewads.php?lid={$lid}"); |
||||||
775 | $tags['YOUR_AD'] = _AM_ADSLIGHT_YOUR_AD; |
||||||
776 | $tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
||||||
777 | $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON; |
||||||
778 | $tags['APPROVED'] = _AM_ADSLIGHT_APPROVED; |
||||||
779 | $subject = _AM_ADSLIGHT_ANNACCEPT; |
||||||
780 | $mail = getMailer(); |
||||||
781 | $mail->setTemplateDir($helper->path("/language/{$xoopsConfig['language']}/mail_template/")); |
||||||
782 | $mail->setTemplate('listing_approve.tpl'); |
||||||
783 | $mail->useMail(); |
||||||
784 | $mail->multimailer->isHTML(true); |
||||||
785 | $mail->setFromName($meta['title']); |
||||||
786 | $mail->setFromEmail($xoopsConfig['adminmail']); |
||||||
787 | $mail->setToEmails($email); |
||||||
788 | $mail->setSubject($subject); |
||||||
789 | $mail->assign($tags); |
||||||
790 | $mail->send(); |
||||||
791 | echo $mail->getErrors(); |
||||||
792 | } |
||||||
793 | $tags = []; |
||||||
794 | $tags['TITLE'] = $title; |
||||||
795 | $tags['ADDED_TO_CAT'] = _AM_ADSLIGHT_ADDED_TO_CAT; |
||||||
796 | $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF; |
||||||
797 | $tags['ERROR_NOTIF'] = _AM_ADSLIGHT_ERROR_NOTIF; |
||||||
798 | $tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
||||||
799 | $tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
||||||
800 | $tags['FOLLOW_LINK'] = _AM_ADSLIGHT_FOLLOW_LINK; |
||||||
801 | $tags['TYPE'] = Utility::getNameType($type); |
||||||
802 | $tags['LINK_URL'] = XOOPS_URL . "/modules/adslight/viewads.php?&lid={$lid}"; |
||||||
803 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . " WHERE cid={$cat}"; |
||||||
804 | $result = $xoopsDB->query($sql); |
||||||
805 | if (!$xoopsDB->isResultSet($result)) { |
||||||
806 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||||
807 | } |
||||||
808 | $row = $xoopsDB->fetchArray($result); |
||||||
809 | $tags['CATEGORY_TITLE'] = $row['title']; |
||||||
810 | $tags['CATEGORY_URL'] = XOOPS_URL . "/modules/adslight/viewcats.php?cid={$cat}"; |
||||||
811 | /** @var \XoopsNotificationHandler $notificationHandler */ |
||||||
812 | $notificationHandler = xoops_getHandler('notification'); |
||||||
813 | $notificationHandler->triggerEvent('global', 0, 'new_listing', $tags); |
||||||
814 | $notificationHandler->triggerEvent('category', $cat, 'new_listing', $tags); |
||||||
815 | $notificationHandler->triggerEvent('listing', $lid, 'new_listing', $tags); |
||||||
816 | $helper->redirect('admin/validate_ads.php', 3, _AM_ADSLIGHT_ANNVALID); |
||||||
817 | } |
||||||
818 | |||||||
819 | ##################################################### |
||||||
820 | ##################################################### |
||||||
821 | //@todo REMOVE THIS ASAP. This code is extremely unsafe |
||||||
822 | //foreach ($_POST as $k => $v) { |
||||||
823 | // ${$k} = $v; |
||||||
824 | //} |
||||||
825 | |||||||
826 | $cid = Request::getInt('cid', 0, 'POST'); |
||||||
827 | $contactby = Request::getInt('contactby', 0, 'POST'); |
||||||
828 | $country = Request::getString('country', '', 'POST'); |
||||||
829 | $date_created = Request::getInt('date_created', 0, 'POST'); |
||||||
830 | $desctext = Request::getText('desctext', '', 'POST'); |
||||||
831 | $email = Request::getEmail('email', '', 'POST'); |
||||||
832 | $expire = Request::getInt('expire', 0, 'POST'); |
||||||
833 | $lid = Request::getInt('lid', 0, 'POST'); |
||||||
834 | $photo = Request::getString('photo', '', 'POST'); |
||||||
835 | $premium = Request::getString('premium', '', 'POST'); |
||||||
836 | $price = Request::getFloat('price', 0.00, 'POST'); |
||||||
837 | $status = Request::getInt('status', 0, 'POST'); |
||||||
838 | $submitter = Request::getString('submitter', '', 'POST'); |
||||||
839 | $tel = Request::getString('tel', '', 'POST'); |
||||||
840 | $title = Request::getString('title', '', 'POST'); |
||||||
841 | $town = Request::getString('town', '', 'POST'); |
||||||
842 | $type = Request::getString('type', '', 'POST'); |
||||||
843 | $typeprice = Request::getString('typeprice', '', 'POST'); |
||||||
844 | $typecondition = Request::getString('typecondition', '', 'POST'); |
||||||
845 | $valid = Request::getString('valid', '', 'POST'); |
||||||
846 | |||||||
847 | $pa = Request::getInt('pa', '', 'GET'); |
||||||
0 ignored issues
–
show
'' of type string is incompatible with the type integer expected by parameter $default of Xmf\Request::getInt() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
848 | if (!Request::hasVar('lid', 'POST') && Request::hasVar('lid', 'GET')) { |
||||||
849 | $lid = Request::getInt('lid', 0, 'GET'); |
||||||
850 | } |
||||||
851 | if (!Request::hasVar('op', 'POST') && Request::hasVar('op', 'GET')) { |
||||||
852 | $op = Request::getString('op', '', 'GET'); |
||||||
853 | } |
||||||
854 | if (!isset($op)) { |
||||||
855 | $op = ''; |
||||||
856 | } |
||||||
857 | switch ($op) { |
||||||
858 | case 'IndexView': |
||||||
859 | indexView($lid); |
||||||
860 | break; |
||||||
861 | case 'ListingDel': |
||||||
862 | listingDel($lid, $photo); |
||||||
863 | break; |
||||||
864 | case 'ListingValid': |
||||||
865 | listingValid( |
||||||
866 | $lid, |
||||||
867 | $cid, |
||||||
868 | $title, |
||||||
869 | $status, |
||||||
870 | $expire, |
||||||
871 | $type, |
||||||
872 | $desctext, |
||||||
873 | $tel, |
||||||
874 | $price, |
||||||
875 | $typeprice, |
||||||
876 | $typecondition, |
||||||
877 | $date_created, |
||||||
878 | $email, |
||||||
879 | $submitter, |
||||||
880 | $town, |
||||||
881 | $country, |
||||||
882 | $contactby, |
||||||
883 | $premium, |
||||||
884 | $valid, |
||||||
885 | $photo |
||||||
886 | ); |
||||||
887 | break; |
||||||
888 | case 'modifyAds': |
||||||
889 | modifyAds($lid); |
||||||
0 ignored issues
–
show
The call to
modifyAds() has too few arguments starting with cat .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
890 | break; |
||||||
891 | case 'modifyAdsS': |
||||||
892 | modifyAdsS( |
||||||
893 | $lid, |
||||||
894 | $cid, |
||||||
895 | $title, |
||||||
896 | $status, |
||||||
897 | $expire, |
||||||
898 | $type, |
||||||
899 | $desctext, |
||||||
900 | $tel, |
||||||
901 | $price, |
||||||
902 | $typeprice, |
||||||
903 | $typecondition, |
||||||
904 | $date_created, |
||||||
905 | $email, |
||||||
906 | $submitter, |
||||||
907 | $town, |
||||||
908 | $country, |
||||||
909 | $contactby, |
||||||
910 | $premium, |
||||||
911 | $valid, |
||||||
912 | $photo |
||||||
913 | ); |
||||||
914 | break; |
||||||
915 | default: |
||||||
916 | index(); |
||||||
917 | break; |
||||||
918 | } |
||||||
919 |