Completed
Push — master ( 5ea37d...ce95ba )
by Michael
02:32
created

modify.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
-------------------------------------------------------------------------
4
                     ADSLIGHT 2 : Module for Xoops
5
6
        Redesigned and ameliorate By Luc Bizet user at www.frxoops.org
7
        Started with the Classifieds module and made MANY changes
8
        Website : http://www.luc-bizet.fr
9
        Contact : [email protected]
10
-------------------------------------------------------------------------
11
             Original credits below Version History
12
##########################################################################
13
#                    Classified Module for Xoops                         #
14
#  By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com         #
15
#      Started with the MyAds module and made MANY changes               #
16
##########################################################################
17
 Original Author: Pascal Le Boustouller
18
 Author Website : [email protected]
19
 Licence Type   : GPL
20
-------------------------------------------------------------------------
21
*/
22
23
use Xmf\Request;
24
25
include_once __DIR__ . '/header.php';
26
$moduleDirName = basename(__DIR__);
27
$main_lang     = '_' . strtoupper($moduleDirName);
28
require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
29
$myts      = MyTextSanitizer::getInstance();
30
$module_id = $xoopsModule->getVar('mid');
31
32
$groups       = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
33
/** @var XoopsGroupPermHandler $gpermHandler */
34
$gpermHandler = xoops_getHandler('groupperm');
35
$perm_itemid  = Request::getInt('item_id', 0, 'POST');
36
37
//If no access
38 View Code Duplication
if (!$gpermHandler->checkRight('adslight_submit', $perm_itemid, $groups, $module_id)) {
39
    redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM);
40
}
41
42
/**
43
 * @param $lid
44
 * @param $ok
45
 */
46
function listingDel($lid, $ok)
47
{
48
    global $xoopsDB, $xoopsConfig, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang;
49
50
    $result = $xoopsDB->query('SELECT usid FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid));
51
    list($usid) = $xoopsDB->fetchRow($result);
52
53
    $result1 = $xoopsDB->query('SELECT url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE lid=' . $xoopsDB->escape($lid));
54
55
    if ($GLOBALS['xoopsUser']) {
56
        $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E');
57
        if ($usid == $currentid) {
58
            if ($ok == 1) {
59
                while (list($purl) = $xoopsDB->fetchRow($result1)) {
60
                    if ($purl) {
61
                        $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
62
                        if (file_exists("$destination/$purl")) {
63
                            unlink("$destination/$purl");
64
                        }
65
                        $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
66
                        if (file_exists("$destination2/thumb_$purl")) {
67
                            unlink("$destination2/thumb_$purl");
68
                        }
69
                        $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
70
                        if (file_exists("$destination3/resized_$purl")) {
71
                            unlink("$destination3/resized_$purl");
72
                        }
73
74
                        $xoopsDB->queryF('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE lid=' . $xoopsDB->escape($lid));
75
                    }
76
                }
77
                $xoopsDB->queryF('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid));
78
                redirect_header('index.php', 1, _ADSLIGHT_ANNDEL);
79
            } else {
80
                echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n";
81
                echo '<br><div style="text-align:center">';
82
                echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>';
83
            }
84
            echo "[ <a href=\"modify.php?op=ListingDel&amp;lid=" . $lid . "&amp;ok=1\">" . _ADSLIGHT_OUI . "</a> | <a href=\"index.php\">" . _ADSLIGHT_NON . '</a> ]<br><br>';
85
            echo '</td></tr></table>';
86
        }
87
    }
88
}
89
90
/**
91
 * @param $r_lid
92
 * @param $ok
93
 */
94
function delReply($r_lid, $ok)
95
{
96
    global $xoopsDB, $xoopsConfig, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang;
97
98
    $result = $xoopsDB->query('SELECT l.usid, r.r_lid, r.lid, r.title, r.date, r.submitter, r.message, r.tele, r.email, r.r_usid FROM '
99
                              . $xoopsDB->prefix('adslight_listing')
100
                              . ' l LEFT JOIN '
101
                              . $xoopsDB->prefix('adslight_replies')
102
                              . ' r ON l.lid=r.lid  WHERE r.r_lid='
103
                              . $xoopsDB->escape($r_lid));
104
    list($usid, $r_lid, $rlid, $title, $date, $submitter, $message, $tele, $email, $r_usid) = $xoopsDB->fetchRow($result);
105
106
    if ($GLOBALS['xoopsUser']) {
107
        $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E');
108
        if ($usid == $currentid) {
109
            if ($ok == 1) {
110
                $xoopsDB->queryF('DELETE FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE r_lid=' . $xoopsDB->escape($r_lid));
111
                redirect_header('members.php?usid=' . addslashes($usid) . '', 1, _ADSLIGHT_ANNDEL);
112
            } else {
113
                echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n";
114
                echo '<br><div style="text-align:center">';
115
                echo '<strong>' . _ADSLIGHT_SURDELANN . '</strong></div><br><br>';
116
            }
117
            echo "[ <a href=\"modify.php?op=DelReply&amp;r_lid="
118
                 . addslashes($r_lid)
119
                 . "&amp;ok=1\">"
120
                 . _ADSLIGHT_OUI
121
                 . "</a> | <a href=\"members.php?usid="
122
                 . addslashes($usid)
123
                 . "\">"
124
                 . _ADSLIGHT_NON
125
                 . '</a> ]<br><br>';
126
            echo '</td></tr></table>';
127
        }
128
    }
129
}
130
131
/**
132
 * @param $lid
133
 */
134
function modAd($lid)
135
{
136
    global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsTheme, $myts, $xoopsLogger, $moduleDirName, $main_lang;
137
    $contactselect = '';
138
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
139
    include_once XOOPS_ROOT_PATH . '/modules/adslight/class/utilities.php';
140
    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>";
141
142
    include_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
143
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
144
145
    $result = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, usid, town, country, contactby, premium, valid FROM '
146
                              . $xoopsDB->prefix('adslight_listing')
147
                              . ' WHERE lid='
148
                              . $xoopsDB->escape($lid));
149
    list($lid, $cide, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid) = $xoopsDB->fetchRow($result);
150
151
    $categories = AdslightUtilities::getMyItemIds('adslight_submit');
152 View Code Duplication
    if (is_array($categories) && count($categories) > 0) {
153
        if (!in_array($cide, $categories)) {
154
            redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM);
155
        }
156
    } else {    // User can't see any category
157
        redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
158
    }
159
160
161
    if ($GLOBALS['xoopsUser']) {
162
        $calusern = $GLOBALS['xoopsUser']->uid();
163
        if ($usid == $calusern) {
164
            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADSLIGHT_MODIFANN . '</legend><br><br>';
165
            $title      = $myts->htmlSpecialChars($title);
166
            $status     = $myts->htmlSpecialChars($status);
167
            $expire     = $myts->htmlSpecialChars($expire);
168
            $type       = $myts->htmlSpecialChars($type);
169
            $desctext   = $myts->displayTarea($desctext, 1);
170
            $tel        = $myts->htmlSpecialChars($tel);
171
172
//            $price      = number_format($price, 2, ',', ' ');
173
174
            xoops_load('XoopsLocal');
175
            $tempXoopsLocal = new XoopsLocal;
176
            //  For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
177
            $price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
178
            //  For other countries uncomment the below line and comment out the above line
179
            //      $price = $tempXoopsLocal->number_format($price);
180
181
182
            $typeprice  = $myts->htmlSpecialChars($typeprice);
183
            $typeusure  = $myts->htmlSpecialChars($typeusure);
184
            $submitter  = $myts->htmlSpecialChars($submitter);
185
            $town       = $myts->htmlSpecialChars($town);
186
            $country    = $myts->htmlSpecialChars($country);
187
            $contactby  = $myts->htmlSpecialChars($contactby);
188
            $premium    = $myts->htmlSpecialChars($premium);
189
            $useroffset = '';
190 View Code Duplication
            if ($GLOBALS['xoopsUser']) {
191
                $timezone   = $GLOBALS['xoopsUser']->timezone();
192
                $useroffset = (!empty($timezone)) ? $GLOBALS['xoopsUser']->timezone() : $xoopsConfig['default_TZ'];
193
            }
194
            $dates = ($useroffset * 3600) + $date;
195
            $dates = formatTimestamp($date, 's');
196
197
            echo "<form action=\"modify.php\" method=post enctype=\"multipart/form-data\">
198
    <table><tr class=\"head\" border=\"2\">
199
    <td class=\"head\">" . _ADSLIGHT_NUMANNN . " </td><td class=\"head\" border=\"1\">$lid " . _ADSLIGHT_DU . " $dates</td>
200
    </tr><tr>";
201
202
            if ($GLOBALS['xoopsModuleConfig']['adslight_diff_name'] == '1') {
203
                echo "<td class=\"head\">" . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"text\" name=\"submitter\" size=\"50\" value=\"$submitter\" /></td>";
204
            } else {
205
                echo "<td class=\"head\">" . _ADSLIGHT_SENDBY . " </td><td class=\"head\"><input type=\"hidden\" name=\"submitter\" value=\"$submitter\">$submitter</td>";
206
            }
207
            echo '</tr><tr>';
208
209
            if (1 == $contactby) {
210
                $contactselect = _ADSLIGHT_CONTACT_BY_EMAIL;
211
            }
212
            if (2 == $contactby) {
213
                $contactselect = _ADSLIGHT_CONTACT_BY_PM;
214
            }
215
            if (3 == $contactby) {
216
                $contactselect = _ADSLIGHT_CONTACT_BY_BOTH;
217
            }
218
            if (4 == $contactby) {
219
                $contactselect = _ADSLIGHT_CONTACT_BY_PHONE;
220
            }
221
222
            echo " <td class='head'>" . _ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\">
223
    <option value=\"" . $contactby . "\">" . $contactselect . "</option>
224
    <option value=\"1\">" . _ADSLIGHT_CONTACT_BY_EMAIL . "</option>
225
    <option value=\"2\">" . _ADSLIGHT_CONTACT_BY_PM . "</option>
226
    <option value=\"3\">" . _ADSLIGHT_CONTACT_BY_BOTH . "</option>
227
    <option value=\"4\">" . _ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>';
228
229
            if ($GLOBALS['xoopsModuleConfig']['adslight_diff_email'] == '1') {
230
                echo "<tr><td class=\"head\">" . _ADSLIGHT_EMAIL . " </td><td class=\"head\"><input type=\"text\" name=\"email\" size=\"50\" value=\"$email\" /></td>";
231
            } else {
232
                echo "<tr><td class=\"head\">" . _ADSLIGHT_EMAIL . " </td><td class=\"head\">$email<input type=\"hidden\" name=\"email\" value=\"$email\" /></td>";
233
            }
234
            echo "</tr><tr>
235
    <td class=\"head\">" . _ADSLIGHT_TEL . " </td><td class=\"head\"><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\" /></td>
236
    </tr>";
237
            echo "<tr>
238
    <td class=\"head\">" . _ADSLIGHT_TOWN . " </td><td class=\"head\"><input type=\"text\" name=\"town\" size=\"50\" value=\"$town\" /></td>
239
    </tr>";
240
            if ($GLOBALS['xoopsModuleConfig']['adslight_use_country'] == '1') {
241
                echo "<tr>
242
    <td class=\"head\">" . _ADSLIGHT_COUNTRY . " </td><td class=\"head\"><input type=\"text\" name=\"country\" size=\"50\" value=\"$country\" /></td>
243
    </tr>";
244
            } else {
245
                echo "<input type=\"hidden\" name=\"country\" value=\"\">";
246
            }
247
248
            echo "<tr><td class='head'>" . _ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\"";
249
            if ('0' == $status) {
250
                echo 'checked';
251
            }
252
            echo '>' . _ADSLIGHT_ACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"1\"";
253
            if ('1' == $status) {
254
                echo 'checked';
255
            }
256
            echo '>' . _ADSLIGHT_INACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"2\"";
257
            if ('2' == $status) {
258
                echo 'checked';
259
            }
260
            echo '>' . _ADSLIGHT_SOLD . '</td></tr>';
261
            echo "<tr>
262
    <td class=\"head\">" . _ADSLIGHT_TITLE2 . " </td><td class=\"head\"><input type=\"text\" name=\"title\" size=\"50\" value=\"$title\" /></td>
263
    </tr>";
264
            echo "<tr><td class=\"head\">"
265
                 . _ADSLIGHT_PRICE2
266
                 . " </td><td class=\"head\"><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\" /> "
267
                 . $GLOBALS['xoopsModuleConfig']['adslight_money'];
268
269
            $result3 = $xoopsDB->query('SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price');
270
            echo " <select name=\"typeprice\">";
271
            while (list($nom_price, $id_price) = $xoopsDB->fetchRow($result3)) {
272
                $sel = '';
273
                if ($id_price == $typeprice) {
274
                    $sel = 'selected';
275
                }
276
                echo "<option value=\"$id_price\" $sel>$nom_price</option>";
277
            }
278
            echo '</select></td></tr>';
279
            $module_id = $xoopsModule->getVar('mid');
280
            $groups    = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
281
282
            /** @var XoopsGroupPermHandler $gpermHandler */
283
            $gpermHandler = xoops_getHandler('groupperm');
284
            $perm_itemid  = Request::getInt('item_id', 0, 'GET');
285
286
            //If no access
287
            if (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) {
288
                echo "<tr>
289
    <td width='30%' class='head'>" . _ADSLIGHT_WILL_LAST . " </td><td class='head'>$expire  " . _ADSLIGHT_DAY . '</td>
290
    </tr>';
291
                echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\" />";
292
            } else {
293
                echo "<tr>
294
    <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>
295
    </tr>';
296
            }
297
298
            /// Type d'annonce
299
            echo "<tr>
300
    <td class=\"head\">" . _ADSLIGHT_TYPE . " </td><td class=\"head\"><select name=\"type\">";
301
302
            $result5 = $xoopsDB->query('SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type');
303
            while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) {
304
                $sel = '';
305
                if ($id_type == $type) {
306
                    $sel = 'selected';
307
                }
308
                echo "<option value=\"$id_type\" $sel>$nom_type</option>";
309
            }
310
            echo '</select></td></tr>';
311
312
            /// Etat de l'objet
313
            echo "<tr>
314
    <td class=\"head\">" . _ADSLIGHT_TYPE_USURE . " </td><td class=\"head\"><select name=\"typeusure\">";
315
316
            $result6 = $xoopsDB->query('SELECT nom_usure, id_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY nom_usure');
317
            while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) {
318
                $sel = '';
319
                if ($id_usure == $typeusure) {
320
                    $sel = 'selected';
321
                }
322
                echo "<option value=\"$id_usure\" $sel>$nom_usure</option>";
323
            }
324
            echo '</select></td></tr>';
325
326
            echo "<tr>
327
    <td class=\"head\">" . _ADSLIGHT_CAT . " </td><td class=\"head\">";
328
            $mytree->makeMySelBox('title', 'title', $cide, '', 'cid');
329
            echo "</td>
330
    </tr><tr>
331
    <td class=\"head\">" . _ADSLIGHT_DESC . " </td><td class=\"head\">";
332
            $wysiwyg_text_area = AdslightUtilities::getEditor(_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px');
333
            echo $wysiwyg_text_area->render();
334
            echo "</td></tr>
335
    <td colspan=2><br><input type=\"submit\" value=\"" . _ADSLIGHT_MODIFANN . "\" /></td>
336
    </tr></table>";
337
            echo "<input type=\"hidden\" name=\"op\" value=\"ModAdS\" />";
338
339
            $module_id = $xoopsModule->getVar('mid');
340 View Code Duplication
            if (is_object($GLOBALS['xoopsUser'])) {
341
                $groups =& $GLOBALS['xoopsUser']->getGroups();
342
            } else {
343
                $groups = XOOPS_GROUP_ANONYMOUS;
344
            }
345
            /** @var XoopsGroupPermHandler $gpermHandler */
346
            $gpermHandler = xoops_getHandler('groupperm');
347
            $perm_itemid = Request::getInt('item_id', 0, 'POST');
348
            //If no access
349
            if (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) {
350
                if ($GLOBALS['xoopsModuleConfig']['adslight_moderated'] == '1') {
351
                    echo "<input type=\"hidden\" name=\"valid\" value=\"No\" />";
352
                    echo '<br>' . _ADSLIGHT_MODIFBEFORE . '<br>';
353
                } else {
354
                    echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\" />";
355
                }
356
            } else {
357
                echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\" />";
358
            }
359
            echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\" />";
360
            echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\" />";
361
            echo "<input type=\"hidden\" name=\"date\" value=\"$date\" />
362
    " . $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'token') . '';
363
            echo '</form><br></fieldset><br>';
364
        }
365
    }
366
}
367
368
/**
369
 * @param $lid
370
 * @param $cat
371
 * @param $title
372
 * @param $status
373
 * @param $expire
374
 * @param $type
375
 * @param $desctext
376
 * @param $tel
377
 * @param $price
378
 * @param $typeprice
379
 * @param $typeusure
380
 * @param $date
381
 * @param $email
382
 * @param $submitter
383
 * @param $town
384
 * @param $country
385
 * @param $contactby
386
 * @param $premium
387
 * @param $valid
388
 */
389
function modAdS(
390
    $lid,
391
    $cat,
392
    $title,
393
    $status,
394
    $expire,
395
    $type,
396
    $desctext,
397
    $tel,
398
    $price,
399
    $typeprice,
400
    $typeusure,
401
    $date,
402
    $email,
403
    $submitter,
404
    $town,
405
    $country,
406
    $contactby,
407
    $premium,
408
    $valid
409
) {
410
    global $xoopsDB, $xoopsConfig, $myts, $xoopsLogger, $moduleDirName, $main_lang, $xoopsGTicket;
411
412
    if (!$xoopsGTicket->check(true, 'token')) {
413
        redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, $xoopsGTicket->getErrors());
414
    }
415
    $title     = $myts->addSlashes($title);
416
    $status    = $myts->addSlashes($status);
417
    $expire    = $myts->addSlashes($expire);
418
    $type      = $myts->addSlashes($type);
419
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1, 1, 1);
420
    $tel       = $myts->addSlashes($tel);
421
    $price     = str_replace(array(' '), '', $price);
422
    $typeprice = $myts->addSlashes($typeprice);
423
    $typeusure = $myts->addSlashes($typeusure);
424
    $submitter = $myts->addSlashes($submitter);
425
    $town      = $myts->addSlashes($town);
426
    $country   = $myts->addSlashes($country);
427
    $contactby = $myts->addSlashes($contactby);
428
    $premium   = $myts->addSlashes($premium);
429
430
    $xoopsDB->query('UPDATE '
431
                    . $xoopsDB->prefix('adslight_listing')
432
                    . " SET cid='$cat', title='$title', status='$status',  expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid' WHERE lid=$lid");
433
434
    redirect_header('index.php', 1, _ADSLIGHT_ANNMOD2);
435
}
436
437
####################################################
438
foreach ($_POST as $k => $v) {
439
    ${$k} = $v;
440
}
441
$ok = Request::getString('ok', '', 'GET');
442
443 View Code Duplication
if (!Request::hasVar('lid', 'POST') && Request::hasVar('lid', 'GET')) {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
444
    $lid = Request::getInt('lid', 0, 'GET');
445
}
446 View Code Duplication
if (!Request::hasVar('r_lid', 'POST') && Request::hasVar('r_lid', 'GET')) {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
447
    $r_lid = Request::getInt('r_lid', '', 'GET');
448
}
449 View Code Duplication
if (!Request::hasVar('op', 'POST') && Request::hasVar('op', 'GET')) {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
450
    $op = Request::getString('op', '', 'GET');
451
}
452
switch ($op) {
453
454
    case 'ModAd':
455
        include XOOPS_ROOT_PATH . '/header.php';
456
        modAd($lid);
457
        include XOOPS_ROOT_PATH . '/footer.php';
458
        break;
459
460
    case 'ModAdS':
461
        modAdS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid);
462
        break;
463
464
    case 'ListingDel':
465
        include XOOPS_ROOT_PATH . '/header.php';
466
        listingDel($lid, $ok);
467
        include XOOPS_ROOT_PATH . '/footer.php';
468
        break;
469
470
    case 'DelReply':
471
        include XOOPS_ROOT_PATH . '/header.php';
472
        delReply($r_lid, $ok);
473
        include XOOPS_ROOT_PATH . '/footer.php';
474
        break;
475
476
    default:
477
        redirect_header('index.php', 1, '' . _RETURNANN);
478
        break;
479
}
480