mambax7 /
adslight
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 | |||||
| 30 | /** @var Helper $helper */ |
||||
| 31 | require_once __DIR__ . '/header.php'; |
||||
| 32 | |||||
| 33 | global $xoopsModule, $xoopsDB, $xoopsConfig, $xoTheme; |
||||
| 34 | |||||
| 35 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 36 | $moduleId = $xoopsModule->getVar('mid'); |
||||
| 37 | $groups = $GLOBALS['xoopsUser'] instanceof \XoopsUser ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||||
| 38 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 39 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 40 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||||
| 41 | |||||
| 42 | //If no access |
||||
| 43 | if (!$grouppermHandler->checkRight('adslight_submit', $perm_itemid, $groups, $moduleId)) { |
||||
| 44 | $helper->redirect('index.php', 3, _NOPERM); |
||||
| 45 | } |
||||
| 46 | |||||
| 47 | /** |
||||
| 48 | * @param $lid |
||||
| 49 | * @param $ok |
||||
| 50 | */ |
||||
| 51 | function listingDel($lid, $ok): void |
||||
| 52 | { |
||||
| 53 | global $xoopsDB; |
||||
| 54 | $helper = Helper::getInstance(); |
||||
| 55 | $sql = 'SELECT usid FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid); |
||||
| 56 | $result = $xoopsDB->query($sql); |
||||
| 57 | if (!$xoopsDB->isResultSet($result)) { |
||||
| 58 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 59 | } |
||||
| 60 | [$usid] = $xoopsDB->fetchRow($result); |
||||
| 61 | $sql ='SELECT url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE lid=' . $xoopsDB->escape($lid); |
||||
| 62 | $result1 = $xoopsDB->query($sql); |
||||
| 63 | if (!$xoopsDB->isResultSet($result1)) { |
||||
| 64 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 65 | } |
||||
| 66 | if ($GLOBALS['xoopsUser']) { |
||||
| 67 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||
| 68 | if ($usid === $currentid) { |
||||
| 69 | if (1 === $ok) { |
||||
| 70 | while ([$purl] = $xoopsDB->fetchRow($result1)) { |
||||
| 71 | if ($purl) { |
||||
| 72 | $destination = XOOPS_ROOT_PATH . '/uploads/adslight'; |
||||
| 73 | if (is_file("{$destination}/{$purl}")) { |
||||
| 74 | unlink("{$destination}/{$purl}"); |
||||
| 75 | } |
||||
| 76 | $destination2 = XOOPS_ROOT_PATH . '/uploads/adslight/thumbs'; |
||||
| 77 | if (is_file("{$destination2}/thumb_{$purl}")) { |
||||
| 78 | unlink("{$destination2}/thumb_{$purl}"); |
||||
| 79 | } |
||||
| 80 | $destination3 = XOOPS_ROOT_PATH . '/uploads/adslight/midsize'; |
||||
| 81 | if (is_file("{$destination3}/resized_{$purl}")) { |
||||
| 82 | unlink("{$destination3}/resized_{$purl}"); |
||||
| 83 | } |
||||
| 84 | $xoopsDB->queryF( |
||||
| 85 | 'DELETE FROM ' . $xoopsDB->prefix( |
||||
| 86 | 'adslight_pictures' |
||||
| 87 | ) . ' WHERE lid=' . $xoopsDB->escape($lid) |
||||
| 88 | ); |
||||
| 89 | } |
||||
| 90 | } |
||||
| 91 | $xoopsDB->queryF( |
||||
| 92 | 'DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid) |
||||
| 93 | ); |
||||
| 94 | $helper->redirect('index.php', 1, _ADSLIGHT_ANNDEL); |
||||
| 95 | } else { |
||||
| 96 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||||
| 97 | echo '<br><div style="text-align:center">'; |
||||
| 98 | echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>'; |
||||
| 99 | } |
||||
| 100 | echo '[ <a href="modify.php?op=ListingDel&lid=' . $lid . '&ok=1">' . _YES . '</a> | <a href="index.php">' . _NO . '</a> ]<br><br>'; |
||||
| 101 | echo '</td></tr></table>'; |
||||
| 102 | } |
||||
| 103 | } |
||||
| 104 | } |
||||
| 105 | |||||
| 106 | /** |
||||
| 107 | * @param $r_lid |
||||
| 108 | * @param $ok |
||||
| 109 | */ |
||||
| 110 | function delReply($r_lid, $ok): void |
||||
| 111 | { |
||||
| 112 | global $xoopsDB; |
||||
| 113 | $helper = Helper::getInstance(); |
||||
| 114 | $sql = 'SELECT l.usid, r.r_lid, r.lid, r.title, r.date_created, r.submitter, r.message, r.tele, r.email, r.r_usid FROM ' . $xoopsDB->prefix( |
||||
| 115 | 'adslight_listing' |
||||
| 116 | ) . ' l LEFT JOIN ' . $xoopsDB->prefix( |
||||
| 117 | 'adslight_replies' |
||||
| 118 | ) . ' r ON l.lid=r.lid WHERE r.r_lid=' . $xoopsDB->escape($r_lid); |
||||
| 119 | $result = $xoopsDB->query($sql); |
||||
| 120 | if (!$xoopsDB->isResultSet($result)) { |
||||
| 121 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 122 | } |
||||
| 123 | [$usid, $r_lid, $rlid, $title, $date_created, $submitter, $message, $tele, $email, $r_usid] = $xoopsDB->fetchRow( |
||||
| 124 | $result |
||||
| 125 | ); |
||||
| 126 | if ($GLOBALS['xoopsUser']) { |
||||
| 127 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||
| 128 | if ($usid === $currentid) { |
||||
| 129 | if (1 === $ok) { |
||||
| 130 | $xoopsDB->queryF( |
||||
| 131 | 'DELETE FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE r_lid=' . $xoopsDB->escape($r_lid) |
||||
| 132 | ); |
||||
| 133 | $helper->redirect('members.php?usid=' . addslashes($usid), 1, _ADSLIGHT_ANNDEL); |
||||
| 134 | } else { |
||||
| 135 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||||
| 136 | echo '<br><div style="text-align:center">'; |
||||
| 137 | echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>'; |
||||
| 138 | } |
||||
| 139 | echo '[ <a href="modify.php?op=DelReply&r_lid=' . addslashes( |
||||
| 140 | $r_lid |
||||
| 141 | ) . '&ok=1">' . _YES . '</a> | <a href="members.php?usid=' . addslashes( |
||||
| 142 | $usid |
||||
| 143 | ) . '">' . _NO . '</a> ]<br><br>'; |
||||
| 144 | echo '</td></tr></table>'; |
||||
| 145 | } |
||||
| 146 | } |
||||
| 147 | } |
||||
| 148 | |||||
| 149 | /** |
||||
| 150 | * @param $lid |
||||
| 151 | */ |
||||
| 152 | function modifyAd($lid): void |
||||
| 153 | { |
||||
| 154 | global $xoopsDB, $xoopsModule, $xoopsConfig, $myts; |
||||
| 155 | $contactselect = ''; |
||||
| 156 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
| 157 | $helper = Helper::getInstance(); |
||||
| 158 | $options = []; |
||||
| 159 | $options['name'] = 'Editor'; |
||||
| 160 | $options['value'] = _ADSLIGHT_DESC; |
||||
| 161 | $options['rows'] = 10; |
||||
| 162 | $options['cols'] = '100%'; |
||||
| 163 | $options['width'] = '100%'; |
||||
| 164 | $options['height'] = '200px'; |
||||
| 165 | echo "<script language=\"javascript\">\nfunction CLA(CLA) { var MainWindow = window.open (CLA, \"_blank\",\"width=500,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no\");}\n</script>"; |
||||
| 166 | |||||
| 167 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||
| 168 | $sql = 'SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typecondition, date_created, email, submitter, usid, town, country, contactby, premium, valid FROM ' . $xoopsDB->prefix( |
||||
| 169 | 'adslight_listing' |
||||
| 170 | ) . ' WHERE lid=' . $xoopsDB->escape( |
||||
| 171 | $lid |
||||
| 172 | ); |
||||
| 173 | $result = $xoopsDB->query($sql); |
||||
| 174 | if (!$xoopsDB->isResultSet($result)) { |
||||
| 175 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 176 | } |
||||
| 177 | [$lid, $cide, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typecondition, $date_created, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid] = $xoopsDB->fetchRow( |
||||
| 178 | $result |
||||
| 179 | ); |
||||
| 180 | $categories = Utility::getMyItemIds('adslight_submit'); |
||||
| 181 | if (is_array($categories) && count($categories) > 0) { |
||||
| 182 | if (!\in_array((int)$cide, $categories, true)) { |
||||
| 183 | $helper->redirect('index.php', 3, _NOPERM); |
||||
| 184 | } |
||||
| 185 | } else { // User can't see any category |
||||
| 186 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||||
| 187 | } |
||||
| 188 | |||||
| 189 | if ($GLOBALS['xoopsUser']) { |
||||
| 190 | $calusern = $GLOBALS['xoopsUser']->uid(); |
||||
| 191 | if ((int)$usid === $calusern) { |
||||
| 192 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADSLIGHT_MODIFANN . '</legend><br><br>'; |
||||
| 193 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||||
| 194 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||||
| 195 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||||
| 196 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||||
| 197 | $desctext = $myts->displayTarea($desctext, 1); |
||||
| 198 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||||
| 199 | |||||
| 200 | // $price = number_format($price, 2, ',', ' '); |
||||
| 201 | |||||
| 202 | xoops_load('XoopsLocal'); |
||||
| 203 | $tempXoopsLocal = new \XoopsLocal(); |
||||
| 204 | // For US currency with 2 numbers after the decimal comment out if you don't want 2 numbers after decimal |
||||
| 205 | $price = $tempXoopsLocal->number_format($price); |
||||
| 206 | // For other countries uncomment the below line and comment out the above line |
||||
| 207 | // $price = $tempXoopsLocal->number_format($price); |
||||
| 208 | |||||
| 209 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||||
| 210 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||||
| 211 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||||
| 212 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||||
| 213 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||||
| 214 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||||
| 215 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||||
| 216 | $useroffset = ''; |
||||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||||
| 217 | if ($GLOBALS['xoopsUser']) { |
||||
| 218 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||||
| 219 | $useroffset = empty($timezone) ? $xoopsConfig['default_TZ'] : $GLOBALS['xoopsUser']->timezone(); |
||||
| 220 | } |
||||
| 221 | $dates = formatTimestamp($date_created, 's'); |
||||
| 222 | |||||
| 223 | echo '<form action="modify.php" method=post enctype="multipart/form-data">'; |
||||
| 224 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||
| 225 | echo '<table><tr class="head" border="2"> |
||||
| 226 | <td class="head">' . _ADSLIGHT_NUMANNN . " </td><td class=\"head\" border=\"1\">{$lid} " . _ADSLIGHT_DU . " {$dates}</td> |
||||
| 227 | </tr><tr>"; |
||||
| 228 | if ('1' === $helper->getConfig('adslight_diff_name')) { |
||||
| 229 | echo '<td class="head">' . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"text\" name=\"submitter\" size=\"50\" value=\"{$submitter}\" ></td>"; |
||||
| 230 | } else { |
||||
| 231 | echo '<td class="head">' . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"hidden\" name=\"submitter\" value=\"{$submitter}\">{$submitter}</td>"; |
||||
| 232 | } |
||||
| 233 | echo '</tr><tr>'; |
||||
| 234 | if (1 === $contactby) { |
||||
| 235 | $contactselect = _ADSLIGHT_CONTACT_BY_EMAIL; |
||||
| 236 | } |
||||
| 237 | if (2 === $contactby) { |
||||
| 238 | $contactselect = _ADSLIGHT_CONTACT_BY_PM; |
||||
| 239 | } |
||||
| 240 | if (3 === $contactby) { |
||||
| 241 | $contactselect = _ADSLIGHT_CONTACT_BY_BOTH; |
||||
| 242 | } |
||||
| 243 | if (4 === $contactby) { |
||||
| 244 | $contactselect = _ADSLIGHT_CONTACT_BY_PHONE; |
||||
| 245 | } |
||||
| 246 | |||||
| 247 | echo " <td class='head'>" . _ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\"> |
||||
| 248 | <option value=\"" . $contactby . '">' . $contactselect . '</option> |
||||
| 249 | <option value="1">' . _ADSLIGHT_CONTACT_BY_EMAIL . '</option> |
||||
| 250 | <option value="2">' . _ADSLIGHT_CONTACT_BY_PM . '</option> |
||||
| 251 | <option value="3">' . _ADSLIGHT_CONTACT_BY_BOTH . '</option> |
||||
| 252 | <option value="4">' . _ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>'; |
||||
| 253 | if ('1' === $helper->getConfig('adslight_diff_email')) { |
||||
| 254 | echo '<tr><td class="head">' . _ADSLIGHT_EMAIL . " </td><td class=\"head\"><input type=\"text\" name=\"email\" size=\"50\" value=\"{$email}\" ></td>"; |
||||
| 255 | } else { |
||||
| 256 | echo '<tr><td class="head">' . _ADSLIGHT_EMAIL . " </td><td class=\"head\">{$email}<input type=\"hidden\" name=\"email\" value=\"{$email}\" ></td>"; |
||||
| 257 | } |
||||
| 258 | echo '</tr><tr> |
||||
| 259 | <td class="head">' . _ADSLIGHT_TEL . " </td><td class=\"head\"><input type=\"text\" name=\"tel\" size=\"50\" value=\"{$tel}\" ></td> |
||||
| 260 | </tr>"; |
||||
| 261 | echo '<tr> |
||||
| 262 | <td class="head">' . _ADSLIGHT_TOWN . " </td><td class=\"head\"><input type=\"text\" name=\"town\" size=\"50\" value=\"{$town}\" ></td> |
||||
| 263 | </tr>"; |
||||
| 264 | if ('1' === $helper->getConfig('adslight_use_country')) { |
||||
| 265 | echo '<tr> |
||||
| 266 | <td class="head">' . _ADSLIGHT_COUNTRY . " </td><td class=\"head\"><input type=\"text\" name=\"country\" size=\"50\" value=\"{$country}\" ></td> |
||||
| 267 | </tr>"; |
||||
| 268 | } else { |
||||
| 269 | echo '<input type="hidden" name="country" value="">'; |
||||
| 270 | } |
||||
| 271 | |||||
| 272 | echo "<tr><td class='head'>" . _ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||||
| 273 | if (0 === (int)$status) { |
||||
| 274 | echo 'checked'; |
||||
| 275 | } |
||||
| 276 | echo '>' . _ADSLIGHT_ACTIVE . ' <input type="radio" name="status" value="1"'; |
||||
| 277 | if (1 === (int)$status) { |
||||
| 278 | echo 'checked'; |
||||
| 279 | } |
||||
| 280 | echo '>' . _ADSLIGHT_INACTIVE . ' <input type="radio" name="status" value="2"'; |
||||
| 281 | if (2 === (int)$status) { |
||||
| 282 | echo 'checked'; |
||||
| 283 | } |
||||
| 284 | echo '>' . _ADSLIGHT_SOLD . '</td></tr>'; |
||||
| 285 | echo '<tr> |
||||
| 286 | <td class="head">' . _ADSLIGHT_TITLE2 . " </td><td class=\"head\"><input type=\"text\" name=\"title\" size=\"50\" value=\"{$title}\" ></td> |
||||
| 287 | </tr>"; |
||||
| 288 | echo '<tr><td class="head">' . _ADSLIGHT_PRICE2 . " </td><td class=\"head\"><input type=\"text\" name=\"price\" size=\"20\" value=\"{$price}\" > " . $helper->getConfig('adslight_currency_symbol'); |
||||
| 289 | |||||
| 290 | $sql = 'SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price'; |
||||
| 291 | $result3 = $xoopsDB->query($sql); |
||||
| 292 | if (!$xoopsDB->isResultSet($result3)) { |
||||
| 293 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 294 | } |
||||
| 295 | echo ' <select name="typeprice">'; |
||||
| 296 | while ([$nom_price, $id_price] = $xoopsDB->fetchRow($result3)) { |
||||
| 297 | $sel = ''; |
||||
| 298 | if ($id_price === $typeprice) { |
||||
| 299 | $sel = 'selected'; |
||||
| 300 | } |
||||
| 301 | echo "<option value=\"{$id_price}\" {$sel}>{$nom_price}</option>"; |
||||
| 302 | } |
||||
| 303 | echo '</select></td></tr>'; |
||||
| 304 | $moduleId = $xoopsModule->getVar('mid'); |
||||
| 305 | $groups = $GLOBALS['xoopsUser'] instanceof \XoopsUser ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||||
| 306 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 307 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 308 | $perm_itemid = Request::getInt('item_id', 0, 'GET'); |
||||
| 309 | |||||
| 310 | //If no access |
||||
| 311 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $moduleId)) { |
||||
| 312 | echo "<tr> |
||||
| 313 | <td width='30%' class='head'>" . _ADSLIGHT_HOW_LONG . " </td><td class='head'><input type=\"text\" name=\"expire\" size=\"3\" maxlength=\"3\" value=\"{$expire}\" > " . _ADSLIGHT_DAY . '</td> |
||||
| 314 | </tr>'; |
||||
| 315 | } else { |
||||
| 316 | echo "<tr> |
||||
| 317 | <td width='30%' class='head'>" . _ADSLIGHT_WILL_LAST . " </td><td class='head'>{$expire} " . _ADSLIGHT_DAY . '</td> |
||||
| 318 | </tr>'; |
||||
| 319 | echo "<input type=\"hidden\" name=\"expire\" value=\"{$expire}\" >"; |
||||
| 320 | } |
||||
| 321 | |||||
| 322 | /// Type d'annonce |
||||
| 323 | echo '<tr> |
||||
| 324 | <td class="head">' . _ADSLIGHT_TYPE . ' </td><td class="head"><select name="type">'; |
||||
| 325 | |||||
| 326 | $sql = 'SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'; |
||||
| 327 | $result5 = $xoopsDB->query($sql); |
||||
| 328 | if (!$xoopsDB->isResultSet($result5)) { |
||||
| 329 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 330 | } |
||||
| 331 | while ([$nom_type, $id_type] = $xoopsDB->fetchRow($result5)) { |
||||
| 332 | $sel = ''; |
||||
| 333 | if ($id_type === $type) { |
||||
| 334 | $sel = 'selected'; |
||||
| 335 | } |
||||
| 336 | echo "<option value=\"{$id_type}\" {$sel}>{$nom_type}</option>"; |
||||
| 337 | } |
||||
| 338 | echo '</select></td></tr>'; |
||||
| 339 | |||||
| 340 | /// Etat de l'objet |
||||
| 341 | echo '<tr> |
||||
| 342 | <td class="head">' . _ADSLIGHT_TYPE_CONDITION . ' </td><td class="head"><select name="typecondition">'; |
||||
| 343 | |||||
| 344 | $sql = 'SELECT nom_condition, id_condition FROM ' . $xoopsDB->prefix('adslight_condition') . ' ORDER BY nom_condition'; |
||||
| 345 | $result6 = $xoopsDB->query($sql); |
||||
| 346 | if (!$xoopsDB->isResultSet($result6)) { |
||||
| 347 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||||
| 348 | } |
||||
| 349 | while ([$nom_condition, $id_condition] = $xoopsDB->fetchRow($result6)) { |
||||
| 350 | $sel = ''; |
||||
| 351 | if ($id_condition === $typecondition) { |
||||
| 352 | $sel = 'selected'; |
||||
| 353 | } |
||||
| 354 | echo "<option value=\"{$id_condition}\" {$sel}>{$nom_condition}</option>"; |
||||
| 355 | } |
||||
| 356 | echo '</select></td></tr>'; |
||||
| 357 | |||||
| 358 | echo '<tr> |
||||
| 359 | <td class="head">' . _ADSLIGHT_CAT . ' </td><td class="head">'; |
||||
| 360 | $mytree->makeMySelBox('title', 'title', $cide, 0, 'cid'); |
||||
| 361 | echo '</td> |
||||
| 362 | </tr><tr> |
||||
| 363 | <td class="head">' . _ADSLIGHT_DESC . ' </td><td class="head">'; |
||||
| 364 | // $wysiwyg_text_area = Utility::getEditor(_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px'); |
||||
| 365 | |||||
| 366 | // $desctext = $myts->displayTarea($desctext, 1); |
||||
| 367 | |||||
| 368 | $options = []; |
||||
| 369 | $options['name'] = _ADSLIGHT_DESC; |
||||
| 370 | $options['value'] = $desctext; |
||||
| 371 | $options['rows'] = 10; |
||||
| 372 | $options['cols'] = '100%'; |
||||
| 373 | $options['width'] = '100%'; |
||||
| 374 | $options['height'] = '400px'; |
||||
| 375 | |||||
| 376 | $wysiwyg_text_area = Utility::getEditor($helper, $options); |
||||
| 377 | echo $wysiwyg_text_area->render(); |
||||
| 378 | echo '</td></tr> |
||||
| 379 | <td colspan=2><br><input type="submit" value="' . _ADSLIGHT_MODIFANN . '" ></td> |
||||
| 380 | </tr></table>'; |
||||
| 381 | echo '<input type="hidden" name="op" value="modads" >'; |
||||
| 382 | |||||
| 383 | $moduleId = $xoopsModule->getVar('mid'); |
||||
| 384 | if (is_object($GLOBALS['xoopsUser'])) { |
||||
| 385 | $groups = &$GLOBALS['xoopsUser']->getGroups(); |
||||
| 386 | } else { |
||||
| 387 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||
| 388 | } |
||||
| 389 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 390 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 391 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||||
| 392 | //If no access |
||||
| 393 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $moduleId)) { |
||||
| 394 | echo '<input type="hidden" name="valid" value="Yes" >'; |
||||
| 395 | } elseif ('1' === $helper->getConfig('adslight_moderated')) { |
||||
| 396 | echo '<input type="hidden" name="valid" value="No" >'; |
||||
| 397 | echo '<br>' . _ADSLIGHT_MODIFBEFORE . '<br>'; |
||||
| 398 | } else { |
||||
| 399 | echo '<input type="hidden" name="valid" value="Yes" >'; |
||||
| 400 | } |
||||
| 401 | echo "<input type=\"hidden\" name=\"lid\" value=\"{$lid}\" >"; |
||||
| 402 | echo "<input type=\"hidden\" name=\"premium\" value=\"{$premium}\" >"; |
||||
| 403 | echo "<input type=\"hidden\" name=\"date_created\" value=\"{$date_created}\" > |
||||
| 404 | " . $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||
| 405 | echo '</form><br></fieldset><br>'; |
||||
| 406 | } |
||||
| 407 | } |
||||
| 408 | } |
||||
| 409 | |||||
| 410 | /** |
||||
| 411 | * @param $lid |
||||
| 412 | * @param $cat |
||||
| 413 | * @param $title |
||||
| 414 | * @param $status |
||||
| 415 | * @param $expire |
||||
| 416 | * @param $type |
||||
| 417 | * @param $desctext |
||||
| 418 | * @param $tel |
||||
| 419 | * @param $price |
||||
| 420 | * @param $typeprice |
||||
| 421 | * @param $typecondition |
||||
| 422 | * @param $date_created |
||||
| 423 | * @param $email |
||||
| 424 | * @param $submitter |
||||
| 425 | * @param $town |
||||
| 426 | * @param $country |
||||
| 427 | * @param $contactby |
||||
| 428 | * @param $premium |
||||
| 429 | * @param $valid |
||||
| 430 | */ |
||||
| 431 | function modifyAds( |
||||
| 432 | $lid, |
||||
| 433 | $cat, |
||||
| 434 | $title, |
||||
| 435 | $status, |
||||
| 436 | $expire, |
||||
| 437 | $type, |
||||
| 438 | $desctext, |
||||
| 439 | $tel, |
||||
| 440 | $price, |
||||
| 441 | $typeprice, |
||||
| 442 | $typecondition, |
||||
| 443 | $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. Loading history...
|
|||||
| 444 | $email, |
||||
| 445 | $submitter, |
||||
| 446 | $town, |
||||
| 447 | $country, |
||||
| 448 | $contactby, |
||||
| 449 | $premium, |
||||
| 450 | $valid |
||||
| 451 | ): void { |
||||
| 452 | global $xoopsDB, $myts; |
||||
| 453 | $helper = Helper::getInstance(); |
||||
| 454 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
| 455 | $helper->redirect('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
||||
| 456 | } |
||||
| 457 | |||||
| 458 | $sql = 'UPDATE ' |
||||
| 459 | . $xoopsDB->prefix('adslight_listing') |
||||
| 460 | . " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typecondition='{$typecondition}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}' WHERE lid={$lid}"; |
||||
| 461 | $result = $xoopsDB->query($sql); |
||||
|
0 ignored issues
–
show
|
|||||
| 462 | |||||
| 463 | $helper->redirect('index.php', 1, _ADSLIGHT_ANNMOD2); |
||||
| 464 | } |
||||
| 465 | |||||
| 466 | #################################################### |
||||
| 467 | //foreach ($_POST as $k => $v) { |
||||
| 468 | // ${$k} = $v; |
||||
| 469 | //} |
||||
| 470 | |||||
| 471 | $cid = Request::getInt('cid', 0, 'POST'); |
||||
| 472 | $contactby = Request::getInt('contactby', 0, 'POST'); |
||||
| 473 | $country = Request::getString('country', '', 'POST'); |
||||
| 474 | $date_created = Request::getInt('date_created', time(), 'POST'); |
||||
| 475 | $desctext = Request::getText('Description', '', 'POST'); |
||||
| 476 | $email = Request::getString('email', '', 'POST'); |
||||
| 477 | $expire = Request::getInt('expire', 14, 'POST'); |
||||
| 478 | $lid = Request::getInt('lid', 0, 'POST'); |
||||
| 479 | $op = Request::getCmd('op', '', 'POST'); |
||||
| 480 | $premium = Request::getInt('premium', 0, 'POST'); |
||||
| 481 | $price = Request::getFloat('price', 0.00, 'POST'); |
||||
| 482 | $status = Request::getInt('status', 0, 'POST'); |
||||
| 483 | $submitter = Request::getInt('submitter', 0, 'POST'); |
||||
| 484 | $tel = Request::getString('tel', '', 'POST'); |
||||
| 485 | $title = Request::getString('title', '', 'POST'); |
||||
| 486 | $town = Request::getString('town', '', 'POST'); |
||||
| 487 | $type = Request::getInt('type', 0, 'POST'); |
||||
| 488 | $typecondition = Request::getInt('typecondition', 0, 'POST'); |
||||
| 489 | $typeprice = Request::getInt('typeprice', 0, 'POST'); |
||||
| 490 | $valid = Request::getString('valid', '', 'POST'); |
||||
| 491 | |||||
| 492 | $ok = Request::getString('ok', '', 'GET'); |
||||
| 493 | |||||
| 494 | if (!Request::hasVar('lid', 'POST') && Request::hasVar('lid', 'GET')) { |
||||
| 495 | $lid = Request::getInt('lid', 0, 'GET'); |
||||
| 496 | } |
||||
| 497 | if (!Request::hasVar('r_lid', 'POST') && Request::hasVar('r_lid', 'GET')) { |
||||
| 498 | $r_lid = Request::getInt('r_lid', 0, 'GET'); |
||||
| 499 | } |
||||
| 500 | if (!Request::hasVar('op', 'POST') && Request::hasVar('op', 'GET')) { |
||||
| 501 | $op = Request::getCmd('op', '', 'GET'); |
||||
| 502 | } |
||||
| 503 | switch ($op) { |
||||
| 504 | case 'modad': |
||||
| 505 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
| 506 | modifyAd($lid); |
||||
| 507 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 508 | break; |
||||
| 509 | case 'modads': |
||||
| 510 | modifyAds( |
||||
| 511 | $lid, |
||||
| 512 | $cid, |
||||
| 513 | $title, |
||||
| 514 | $status, |
||||
| 515 | $expire, |
||||
| 516 | $type, |
||||
| 517 | $desctext, |
||||
| 518 | $tel, |
||||
| 519 | $price, |
||||
| 520 | $typeprice, |
||||
| 521 | $typecondition, |
||||
| 522 | $date_created, |
||||
| 523 | $email, |
||||
| 524 | $submitter, |
||||
| 525 | $town, |
||||
| 526 | $country, |
||||
| 527 | $contactby, |
||||
| 528 | $premium, |
||||
| 529 | $valid |
||||
| 530 | ); |
||||
| 531 | break; |
||||
| 532 | case 'ListingDel': |
||||
| 533 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
| 534 | listingDel($lid, $ok); |
||||
| 535 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 536 | break; |
||||
| 537 | case 'DelReply': |
||||
| 538 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
| 539 | delReply($r_lid, $ok); |
||||
| 540 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 541 | break; |
||||
| 542 | default: |
||||
| 543 | $helper->redirect('index.php', 1, _RETURNANN); |
||||
| 544 | break; |
||||
| 545 | } |
||||
| 546 |