mambax7 /
adslight
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * You may not change or alter any portion of this comment or credits |
||
| 7 | * of supporting developers from this source code or any supporting source code |
||
| 8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @copyright XOOPS Project (https://xoops.org) |
||
| 17 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 18 | * @author XOOPS Development Team |
||
| 19 | * @author Pascal Le Boustouller: original author ([email protected]) |
||
| 20 | * @author Luc Bizet (www.frxoops.org) |
||
| 21 | * @author jlm69 (www.jlmzone.com) |
||
| 22 | * @author mamba (www.xoops.org) |
||
| 23 | */ |
||
| 24 | |||
| 25 | use Xmf\Request; |
||
| 26 | use XoopsModules\Adslight\{ |
||
| 27 | Helper, |
||
| 28 | Tree, |
||
| 29 | Utility |
||
| 30 | }; |
||
| 31 | |||
| 32 | /** @var Helper $helper */ |
||
| 33 | |||
| 34 | require_once __DIR__ . '/header.php'; |
||
| 35 | $myts = \MyTextSanitizer::getInstance(); |
||
| 36 | $module_id = $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, $module_id)) { |
||
| 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 | $result = $xoopsDB->query( |
||
| 56 | 'SELECT usid FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid) |
||
| 57 | ); |
||
| 58 | [$usid] = $xoopsDB->fetchRow($result); |
||
| 59 | $result1 = $xoopsDB->query( |
||
| 60 | 'SELECT url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE lid=' . $xoopsDB->escape($lid) |
||
| 61 | ); |
||
| 62 | if ($GLOBALS['xoopsUser']) { |
||
| 63 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
| 64 | if ($usid === $currentid) { |
||
| 65 | if (1 === $ok) { |
||
| 66 | while ([$purl] = $xoopsDB->fetchRow($result1)) { |
||
| 67 | if ($purl) { |
||
| 68 | $destination = XOOPS_ROOT_PATH . '/uploads/adslight'; |
||
| 69 | if (is_file("${destination}/${purl}")) { |
||
| 70 | unlink("${destination}/${purl}"); |
||
| 71 | } |
||
| 72 | $destination2 = XOOPS_ROOT_PATH . '/uploads/adslight/thumbs'; |
||
| 73 | if (is_file("${destination2}/thumb_${purl}")) { |
||
| 74 | unlink("${destination2}/thumb_${purl}"); |
||
| 75 | } |
||
| 76 | $destination3 = XOOPS_ROOT_PATH . '/uploads/adslight/midsize'; |
||
| 77 | if (is_file("${destination3}/resized_${purl}")) { |
||
| 78 | unlink("${destination3}/resized_${purl}"); |
||
| 79 | } |
||
| 80 | $xoopsDB->queryF( |
||
| 81 | 'DELETE FROM ' . $xoopsDB->prefix( |
||
| 82 | 'adslight_pictures' |
||
| 83 | ) . ' WHERE lid=' . $xoopsDB->escape($lid) |
||
| 84 | ); |
||
| 85 | } |
||
| 86 | } |
||
| 87 | $xoopsDB->queryF( |
||
| 88 | 'DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid) |
||
| 89 | ); |
||
| 90 | $helper->redirect('index.php', 1, _ADSLIGHT_ANNDEL); |
||
| 91 | } else { |
||
| 92 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||
| 93 | echo '<br><div style="text-align:center">'; |
||
| 94 | echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>'; |
||
| 95 | } |
||
| 96 | echo '[ <a href="modify.php?op=ListingDel&lid=' . $lid . '&ok=1">' . _YES . '</a> | <a href="index.php">' . _NO . '</a> ]<br><br>'; |
||
| 97 | echo '</td></tr></table>'; |
||
| 98 | } |
||
| 99 | } |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @param $r_lid |
||
| 104 | * @param $ok |
||
| 105 | */ |
||
| 106 | function delReply($r_lid, $ok): void |
||
| 107 | { |
||
| 108 | global $xoopsDB; |
||
| 109 | $helper = Helper::getInstance(); |
||
| 110 | $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( |
||
| 111 | 'adslight_listing' |
||
| 112 | ) . ' l LEFT JOIN ' . $xoopsDB->prefix( |
||
| 113 | 'adslight_replies' |
||
| 114 | ) . ' r ON l.lid=r.lid WHERE r.r_lid=' . $xoopsDB->escape($r_lid); |
||
| 115 | $result = $xoopsDB->query($sql); |
||
| 116 | [$usid, $r_lid, $rlid, $title, $date_created, $submitter, $message, $tele, $email, $r_usid] = $xoopsDB->fetchRow( |
||
| 117 | $result |
||
| 118 | ); |
||
| 119 | if ($GLOBALS['xoopsUser']) { |
||
| 120 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
| 121 | if ($usid === $currentid) { |
||
| 122 | if (1 === $ok) { |
||
| 123 | $xoopsDB->queryF( |
||
| 124 | 'DELETE FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE r_lid=' . $xoopsDB->escape($r_lid) |
||
| 125 | ); |
||
| 126 | $helper->redirect('members.php?usid=' . addslashes($usid) . '', 1, _ADSLIGHT_ANNDEL); |
||
| 127 | } else { |
||
| 128 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||
| 129 | echo '<br><div style="text-align:center">'; |
||
| 130 | echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>'; |
||
| 131 | } |
||
| 132 | echo '[ <a href="modify.php?op=DelReply&r_lid=' . addslashes( |
||
| 133 | $r_lid |
||
| 134 | ) . '&ok=1">' . _YES . '</a> | <a href="members.php?usid=' . addslashes( |
||
| 135 | $usid |
||
| 136 | ) . '">' . _NO . '</a> ]<br><br>'; |
||
| 137 | echo '</td></tr></table>'; |
||
| 138 | } |
||
| 139 | } |
||
| 140 | } |
||
| 141 | |||
| 142 | /** |
||
| 143 | * @param $lid |
||
| 144 | */ |
||
| 145 | function modAd($lid): void |
||
| 146 | { |
||
| 147 | global $xoopsDB, $xoopsModule, $xoopsConfig, $myts; |
||
| 148 | $contactselect = ''; |
||
| 149 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 150 | $helper = Helper::getInstance(); |
||
| 151 | $options = []; |
||
| 152 | $options['name'] = 'Editor'; |
||
| 153 | $options['value'] = _ADSLIGHT_DESC; |
||
| 154 | $options['rows'] = 10; |
||
| 155 | $options['cols'] = '100%'; |
||
| 156 | $options['width'] = '100%'; |
||
| 157 | $options['height'] = '200px'; |
||
| 158 | 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>"; |
||
| 159 | |||
| 160 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 161 | $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( |
||
| 162 | 'adslight_listing' |
||
| 163 | ) . ' WHERE lid=' . $xoopsDB->escape( |
||
| 164 | $lid |
||
| 165 | ); |
||
| 166 | $result = $xoopsDB->query($sql); |
||
| 167 | [$lid, $cide, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typecondition, $date_created, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid] = $xoopsDB->fetchRow( |
||
| 168 | $result |
||
| 169 | ); |
||
| 170 | $categories = Utility::getMyItemIds('adslight_submit'); |
||
| 171 | if (is_iterable($categories) && count($categories) > 0) { |
||
| 172 | if (!in_array((int)$cide, $categories, true)) { |
||
| 173 | $helper->redirect('index.php', 3, _NOPERM); |
||
| 174 | } |
||
| 175 | } else { // User can't see any category |
||
| 176 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 177 | } |
||
| 178 | |||
| 179 | if ($GLOBALS['xoopsUser']) { |
||
| 180 | $calusern = $GLOBALS['xoopsUser']->uid(); |
||
| 181 | if ((int)$usid === $calusern) { |
||
| 182 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADSLIGHT_MODIFANN . '</legend><br><br>'; |
||
| 183 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||
| 184 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||
| 185 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||
| 186 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||
| 187 | $desctext = $myts->displayTarea($desctext, 1); |
||
| 188 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||
| 189 | |||
| 190 | // $price = number_format($price, 2, ',', ' '); |
||
| 191 | |||
| 192 | xoops_load('XoopsLocal'); |
||
| 193 | $tempXoopsLocal = new \XoopsLocal(); |
||
| 194 | // For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal |
||
| 195 | $price = $tempXoopsLocal->number_format($price, 2, ',', ' '); |
||
| 196 | // For other countries uncomment the below line and comment out the above line |
||
| 197 | // $price = $tempXoopsLocal->number_format($price); |
||
| 198 | |||
| 199 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||
| 200 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||
| 201 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||
| 202 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||
| 203 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||
| 204 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||
| 205 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||
| 206 | $useroffset = ''; |
||
| 207 | if ($GLOBALS['xoopsUser']) { |
||
| 208 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
| 209 | $useroffset = empty($timezone) ? $xoopsConfig['default_TZ'] : $GLOBALS['xoopsUser']->timezone(); |
||
| 210 | } |
||
| 211 | $dates = formatTimestamp($date_created, 's'); |
||
| 212 | |||
| 213 | echo '<form action="modify.php" method=post enctype="multipart/form-data">'; |
||
| 214 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
| 215 | echo '<table><tr class="head" border="2"> |
||
| 216 | <td class="head">' . _ADSLIGHT_NUMANNN . " </td><td class=\"head\" border=\"1\">${lid} " . _ADSLIGHT_DU . " ${dates}</td> |
||
| 217 | </tr><tr>"; |
||
| 218 | if ('1' === $GLOBALS['xoopsModuleConfig']['adslight_diff_name']) { |
||
| 219 | echo '<td class="head">' . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"text\" name=\"submitter\" size=\"50\" value=\"${submitter}\" ></td>"; |
||
| 220 | } else { |
||
| 221 | echo '<td class="head">' . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"hidden\" name=\"submitter\" value=\"${submitter}\">${submitter}</td>"; |
||
| 222 | } |
||
| 223 | echo '</tr><tr>'; |
||
| 224 | if (1 === $contactby) { |
||
| 225 | $contactselect = _ADSLIGHT_CONTACT_BY_EMAIL; |
||
| 226 | } |
||
| 227 | if (2 === $contactby) { |
||
| 228 | $contactselect = _ADSLIGHT_CONTACT_BY_PM; |
||
| 229 | } |
||
| 230 | if (3 === $contactby) { |
||
| 231 | $contactselect = _ADSLIGHT_CONTACT_BY_BOTH; |
||
| 232 | } |
||
| 233 | if (4 === $contactby) { |
||
| 234 | $contactselect = _ADSLIGHT_CONTACT_BY_PHONE; |
||
| 235 | } |
||
| 236 | |||
| 237 | echo " <td class='head'>" . _ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\"> |
||
| 238 | <option value=\"" . $contactby . '">' . $contactselect . '</option> |
||
| 239 | <option value="1">' . _ADSLIGHT_CONTACT_BY_EMAIL . '</option> |
||
| 240 | <option value="2">' . _ADSLIGHT_CONTACT_BY_PM . '</option> |
||
| 241 | <option value="3">' . _ADSLIGHT_CONTACT_BY_BOTH . '</option> |
||
| 242 | <option value="4">' . _ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>'; |
||
| 243 | if ('1' === $GLOBALS['xoopsModuleConfig']['adslight_diff_email']) { |
||
| 244 | echo '<tr><td class="head">' . _ADSLIGHT_EMAIL . " </td><td class=\"head\"><input type=\"text\" name=\"email\" size=\"50\" value=\"${email}\" ></td>"; |
||
| 245 | } else { |
||
| 246 | echo '<tr><td class="head">' . _ADSLIGHT_EMAIL . " </td><td class=\"head\">${email}<input type=\"hidden\" name=\"email\" value=\"${email}\" ></td>"; |
||
| 247 | } |
||
| 248 | echo '</tr><tr> |
||
| 249 | <td class="head">' . _ADSLIGHT_TEL . " </td><td class=\"head\"><input type=\"text\" name=\"tel\" size=\"50\" value=\"${tel}\" ></td> |
||
| 250 | </tr>"; |
||
| 251 | echo '<tr> |
||
| 252 | <td class="head">' . _ADSLIGHT_TOWN . " </td><td class=\"head\"><input type=\"text\" name=\"town\" size=\"50\" value=\"${town}\" ></td> |
||
| 253 | </tr>"; |
||
| 254 | if ('1' === $GLOBALS['xoopsModuleConfig']['adslight_use_country']) { |
||
| 255 | echo '<tr> |
||
| 256 | <td class="head">' . _ADSLIGHT_COUNTRY . " </td><td class=\"head\"><input type=\"text\" name=\"country\" size=\"50\" value=\"${country}\" ></td> |
||
| 257 | </tr>"; |
||
| 258 | } else { |
||
| 259 | echo '<input type="hidden" name="country" value="">'; |
||
| 260 | } |
||
| 261 | |||
| 262 | echo "<tr><td class='head'>" . _ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||
| 263 | if ('0' === $status) { |
||
| 264 | echo 'checked'; |
||
| 265 | } |
||
| 266 | echo '>' . _ADSLIGHT_ACTIVE . ' <input type="radio" name="status" value="1"'; |
||
| 267 | if ('1' === $status) { |
||
| 268 | echo 'checked'; |
||
| 269 | } |
||
| 270 | echo '>' . _ADSLIGHT_INACTIVE . ' <input type="radio" name="status" value="2"'; |
||
| 271 | if ('2' === $status) { |
||
| 272 | echo 'checked'; |
||
| 273 | } |
||
| 274 | echo '>' . _ADSLIGHT_SOLD . '</td></tr>'; |
||
| 275 | echo '<tr> |
||
| 276 | <td class="head">' . _ADSLIGHT_TITLE2 . " </td><td class=\"head\"><input type=\"text\" name=\"title\" size=\"50\" value=\"${title}\" ></td> |
||
| 277 | </tr>"; |
||
| 278 | echo '<tr><td class="head">' . _ADSLIGHT_PRICE2 . " </td><td class=\"head\"><input type=\"text\" name=\"price\" size=\"20\" value=\"${price}\" > " . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol']; |
||
| 279 | |||
| 280 | $result3 = $xoopsDB->query('SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price'); |
||
| 281 | echo ' <select name="typeprice">'; |
||
| 282 | while ([$nom_price, $id_price] = $xoopsDB->fetchRow($result3)) { |
||
| 283 | $sel = ''; |
||
| 284 | if ($id_price === $typeprice) { |
||
| 285 | $sel = 'selected'; |
||
| 286 | } |
||
| 287 | echo "<option value=\"${id_price}\" ${sel}>${nom_price}</option>"; |
||
| 288 | } |
||
| 289 | echo '</select></td></tr>'; |
||
| 290 | $module_id = $xoopsModule->getVar('mid'); |
||
| 291 | $groups = $GLOBALS['xoopsUser'] instanceof \XoopsUser ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 292 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
| 293 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 294 | $perm_itemid = Request::getInt('item_id', 0, 'GET'); |
||
| 295 | |||
| 296 | //If no access |
||
| 297 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||
| 298 | echo "<tr> |
||
| 299 | <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> |
||
| 300 | </tr>'; |
||
| 301 | } else { |
||
| 302 | echo "<tr> |
||
| 303 | <td width='30%' class='head'>" . _ADSLIGHT_WILL_LAST . " </td><td class='head'>${expire} " . _ADSLIGHT_DAY . '</td> |
||
| 304 | </tr>'; |
||
| 305 | echo "<input type=\"hidden\" name=\"expire\" value=\"${expire}\" >"; |
||
| 306 | } |
||
| 307 | |||
| 308 | /// Type d'annonce |
||
| 309 | echo '<tr> |
||
| 310 | <td class="head">' . _ADSLIGHT_TYPE . ' </td><td class="head"><select name="type">'; |
||
| 311 | |||
| 312 | $result5 = $xoopsDB->query('SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type'); |
||
| 313 | while ([$nom_type, $id_type] = $xoopsDB->fetchRow($result5)) { |
||
| 314 | $sel = ''; |
||
| 315 | if ($id_type === $type) { |
||
| 316 | $sel = 'selected'; |
||
| 317 | } |
||
| 318 | echo "<option value=\"${id_type}\" ${sel}>${nom_type}</option>"; |
||
| 319 | } |
||
| 320 | echo '</select></td></tr>'; |
||
| 321 | |||
| 322 | /// Etat de l'objet |
||
| 323 | echo '<tr> |
||
| 324 | <td class="head">' . _ADSLIGHT_TYPE_CONDITION . ' </td><td class="head"><select name="typecondition">'; |
||
| 325 | |||
| 326 | $result6 = $xoopsDB->query('SELECT nom_condition, id_condition FROM ' . $xoopsDB->prefix('adslight_condition') . ' ORDER BY nom_condition'); |
||
| 327 | while ([$nom_condition, $id_condition] = $xoopsDB->fetchRow($result6)) { |
||
| 328 | $sel = ''; |
||
| 329 | if ($id_condition === $typecondition) { |
||
| 330 | $sel = 'selected'; |
||
| 331 | } |
||
| 332 | echo "<option value=\"${id_condition}\" ${sel}>${nom_condition}</option>"; |
||
| 333 | } |
||
| 334 | echo '</select></td></tr>'; |
||
| 335 | |||
| 336 | echo '<tr> |
||
| 337 | <td class="head">' . _ADSLIGHT_CAT . ' </td><td class="head">'; |
||
| 338 | $mytree->makeMySelBox('title', 'title', $cide, '', 'cid'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 339 | echo '</td> |
||
| 340 | </tr><tr> |
||
| 341 | <td class="head">' . _ADSLIGHT_DESC . ' </td><td class="head">'; |
||
| 342 | // $wysiwyg_text_area = Utility::getEditor(_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px'); |
||
| 343 | $wysiwyg_text_area = Utility::getEditor( |
||
| 344 | $helper, |
||
| 345 | $options |
||
| 346 | ); |
||
| 347 | echo $wysiwyg_text_area->render(); |
||
| 348 | echo '</td></tr> |
||
| 349 | <td colspan=2><br><input type="submit" value="' . _ADSLIGHT_MODIFANN . '" ></td> |
||
| 350 | </tr></table>'; |
||
| 351 | echo '<input type="hidden" name="op" value="ModAdS" >'; |
||
| 352 | |||
| 353 | $module_id = $xoopsModule->getVar('mid'); |
||
| 354 | if (is_object($GLOBALS['xoopsUser'])) { |
||
| 355 | $groups = &$GLOBALS['xoopsUser']->getGroups(); |
||
| 356 | } else { |
||
| 357 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 358 | } |
||
| 359 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
| 360 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 361 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
| 362 | //If no access |
||
| 363 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||
| 364 | echo '<input type="hidden" name="valid" value="Yes" >'; |
||
| 365 | } elseif ('1' === $GLOBALS['xoopsModuleConfig']['adslight_moderated']) { |
||
| 366 | echo '<input type="hidden" name="valid" value="No" >'; |
||
| 367 | echo '<br>' . _ADSLIGHT_MODIFBEFORE . '<br>'; |
||
| 368 | } else { |
||
| 369 | echo '<input type="hidden" name="valid" value="Yes" >'; |
||
| 370 | } |
||
| 371 | echo "<input type=\"hidden\" name=\"lid\" value=\"${lid}\" >"; |
||
| 372 | echo "<input type=\"hidden\" name=\"premium\" value=\"${premium}\" >"; |
||
| 373 | echo "<input type=\"hidden\" name=\"date_created\" value=\"${date_created}\" > |
||
| 374 | " . $GLOBALS['xoopsSecurity']->getTokenHTML() . ''; |
||
| 375 | echo '</form><br></fieldset><br>'; |
||
| 376 | } |
||
| 377 | } |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * @param $lid |
||
| 382 | * @param $cat |
||
| 383 | * @param $title |
||
| 384 | * @param $status |
||
| 385 | * @param $expire |
||
| 386 | * @param $type |
||
| 387 | * @param $desctext |
||
| 388 | * @param $tel |
||
| 389 | * @param $price |
||
| 390 | * @param $typeprice |
||
| 391 | * @param $typecondition |
||
| 392 | * @param $date_created |
||
| 393 | * @param $email |
||
| 394 | * @param $submitter |
||
| 395 | * @param $town |
||
| 396 | * @param $country |
||
| 397 | * @param $contactby |
||
| 398 | * @param $premium |
||
| 399 | * @param $valid |
||
| 400 | */ |
||
| 401 | function modAdS( |
||
| 402 | $lid, |
||
| 403 | $cat, |
||
| 404 | $title, |
||
| 405 | $status, |
||
| 406 | $expire, |
||
| 407 | $type, |
||
| 408 | $desctext, |
||
| 409 | $tel, |
||
| 410 | $price, |
||
| 411 | $typeprice, |
||
| 412 | $typecondition, |
||
| 413 | $date_created, |
||
| 414 | $email, |
||
| 415 | $submitter, |
||
| 416 | $town, |
||
| 417 | $country, |
||
| 418 | $contactby, |
||
| 419 | $premium, |
||
| 420 | $valid |
||
| 421 | ): void { |
||
| 422 | global $xoopsDB, $myts; |
||
| 423 | $helper = Helper::getInstance(); |
||
| 424 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 425 | $helper->redirect('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
||
| 426 | } |
||
| 427 | $title = $myts->addSlashes($title); |
||
| 428 | $status = $myts->addSlashes($status); |
||
| 429 | $expire = $myts->addSlashes($expire); |
||
| 430 | $type = $myts->addSlashes($type); |
||
| 431 | $desctext = $myts->displayTarea($desctext, 1, 1, 1, 1, 1); |
||
| 432 | $tel = $myts->addSlashes($tel); |
||
| 433 | $price = str_replace([' '], '', $price); |
||
| 434 | $typeprice = $myts->addSlashes($typeprice); |
||
| 435 | $typecondition = $myts->addSlashes($typecondition); |
||
| 436 | $submitter = $myts->addSlashes($submitter); |
||
| 437 | $town = $myts->addSlashes($town); |
||
| 438 | $country = $myts->addSlashes($country); |
||
| 439 | $contactby = $myts->addSlashes($contactby); |
||
| 440 | $premium = $myts->addSlashes($premium); |
||
| 441 | |||
| 442 | $xoopsDB->query( |
||
| 443 | 'UPDATE ' |
||
| 444 | . $xoopsDB->prefix('adslight_listing') |
||
| 445 | . " 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}" |
||
| 446 | ); |
||
| 447 | |||
| 448 | $helper->redirect('index.php', 1, _ADSLIGHT_ANNMOD2); |
||
| 449 | } |
||
| 450 | |||
| 451 | #################################################### |
||
| 452 | foreach ($_POST as $k => $v) { |
||
| 453 | ${$k} = $v; |
||
| 454 | } |
||
| 455 | $ok = Request::getString('ok', '', 'GET'); |
||
| 456 | |||
| 457 | if (!Request::hasVar('lid', 'POST') && Request::hasVar('lid', 'GET')) { |
||
| 458 | $lid = Request::getInt('lid', 0, 'GET'); |
||
| 459 | } |
||
| 460 | if (!Request::hasVar('r_lid', 'POST') && Request::hasVar('r_lid', 'GET')) { |
||
| 461 | $r_lid = Request::getInt('r_lid', '', 'GET'); |
||
| 462 | } |
||
| 463 | if (!Request::hasVar('op', 'POST') && Request::hasVar('op', 'GET')) { |
||
| 464 | $op = Request::getString('op', '', 'GET'); |
||
| 465 | } |
||
| 466 | switch ($op) { |
||
| 467 | case 'ModAd': |
||
| 468 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 469 | modAd($lid); |
||
| 470 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 471 | break; |
||
| 472 | case 'ModAdS': |
||
| 473 | modAdS( |
||
| 474 | $lid, |
||
| 475 | $cid, |
||
| 476 | $title, |
||
| 477 | $status, |
||
| 478 | $expire, |
||
| 479 | $type, |
||
| 480 | $desctext, |
||
| 481 | $tel, |
||
| 482 | $price, |
||
| 483 | $typeprice, |
||
| 484 | $typecondition, |
||
| 485 | $date_created, |
||
| 486 | $email, |
||
| 487 | $submitter, |
||
| 488 | $town, |
||
| 489 | $country, |
||
| 490 | $contactby, |
||
| 491 | $premium, |
||
| 492 | $valid |
||
| 493 | ); |
||
| 494 | break; |
||
| 495 | case 'ListingDel': |
||
| 496 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 497 | listingDel($lid, $ok); |
||
| 498 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 499 | break; |
||
| 500 | case 'DelReply': |
||
| 501 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 502 | delReply($r_lid, $ok); |
||
| 503 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 504 | break; |
||
| 505 | default: |
||
| 506 | $helper->redirect('index.php', 1, '' . _RETURNANN); |
||
| 507 | break; |
||
| 508 | } |
||
| 509 |