Completed
Push — master ( 0424ea...923121 )
by Michael
03:57
created

admin/validate_ads.php (10 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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 33 and the first side effect is on line 23.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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
include_once __DIR__ . '/admin_header.php';
24
25
if (isset($_REQUEST['op'])) {
26
    $op = $_REQUEST['op'];
27
} else {
28
    $op = 'liste';
29
}
30
31
#  function Index
32
#####################################################
33
function Index()
0 ignored issues
show
The function Index() has been defined more than once; this definition is ignored, only the first definition in admin/main.php (L33-293) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
34
{
35
    global $hlpfile, $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
36
37
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
38
39
    include_once __DIR__ . '/header.php';
40
    xoops_cp_header();
41
    //    loadModuleAdminMenu(0, "");
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
42
43
    // photo dir setting checker
44
    $photo_dir         = $xoopsModuleConfig['adslight_path_upload'];
45
    $photo_thumb_dir   = $xoopsModuleConfig['adslight_path_upload'] . '/thumbs';
46
    $photo_resized_dir = $xoopsModuleConfig['adslight_path_upload'] . '/midsize';
47
    if (!is_dir($photo_dir)) {
48
        mkdir($photo_dir);
49
    }
50
    if (!is_dir($photo_thumb_dir)) {
51
        mkdir($photo_thumb_dir);
52
    }
53
    if (!is_dir($photo_resized_dir)) {
54
        mkdir($photo_resized_dir);
55
    }
56 View Code Duplication
    if (!is_writable($photo_dir) || !is_readable($photo_dir)) {
57
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
58
        echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_dir . '</b></font><br><br>';
59
        echo '</fieldset><br>';
60
    }
61
62 View Code Duplication
    if (!is_writable($photo_thumb_dir) || !is_readable($photo_thumb_dir)) {
63
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
64
        echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_thumb_dir . '</b></font><br><br>';
65
        echo '</fieldset><br>';
66
    }
67
68 View Code Duplication
    if (!is_writable($photo_resized_dir) || !is_readable($photo_resized_dir)) {
69
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
70
        echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_resized_dir . '</b></font><br><br>';
71
        echo '</fieldset><br>';
72
    }
73
74
    $result  =
75
        $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo, usid from ' .
76
                        $xoopsDB->prefix('adslight_listing') .
77
                        " WHERE valid='no' order by lid");
78
    $numrows = $xoopsDB->getRowsNum($result);
79
    if ($numrows > 0) {
80
81
        ///////// Il y a [..] Annonces en attente d'être approuvées //////
82
        echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
83
        echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>";
84
        echo "<font color=\"#00B4C4\"><b>" . _AM_ADSLIGHT_THEREIS . "</b></font> <b>$numrows</b> <font color=\"#00B4C4\">" . _AM_ADSLIGHT_WAIT . '</b></font>';
85
        echo '</td></tr></table><br>';
86
87
        ///// Liste des ID  ///// Soumis par /////  Titre   /////  Description  /////  Date d'ajout
88
        echo "<table width='100%' border='0' class='outer'>";
89
        $rank = 1;
90
91
        while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo, $usid) =
92
            $xoopsDB->fetchRow($result)) {
93
            $title    = $myts->htmlSpecialChars($title);
94
            $desctext = $myts->displayTarea($desctext, 1, 0, 1, 1, 1);
95
96 View Code Duplication
            if (strlen($desctext) >= 200) {
97
                $desctext = substr($desctext, 0, 199) . '...';
98
            } else {
99
                $desctext = $myts->displayTarea($desctext, 1, 1, 1);
100
            }
101
            $date2 = formatTimestamp($date, 's');
102
103
            if (is_integer($rank / 2)) {
104
                $color = '#ffffff';
105
            } else {
106
                $color = 'head';
107
            }
108
109
            $status    = $myts->htmlSpecialChars($status);
110
            $expire    = $myts->htmlSpecialChars($expire);
111
            $type      = $myts->htmlSpecialChars($type);
112
            $tel       = $myts->htmlSpecialChars($tel);
113
            $price     = number_format($price, 2, ',', ' ');
114
            $typeprice = $myts->htmlSpecialChars($typeprice);
115
            $typeusure = $myts->htmlSpecialChars($typeusure);
116
            $submitter = $myts->htmlSpecialChars($submitter);
117
            $town      = $myts->htmlSpecialChars($town);
118
            $country   = $myts->htmlSpecialChars($country);
119
            $contactby = $myts->htmlSpecialChars($contactby);
120
            $premium   = $myts->htmlSpecialChars($premium);
121
122
            $updir   = $xoopsModuleConfig['adslight_link_upload'];
123
            $sql     = 'select cod_img, lid, uid_owner, url from ' .
124
                       $xoopsDB->prefix('adslight_pictures') .
125
                       ' where  uid_owner=' .
126
                       $xoopsDB->escape($usid) .
127
                       ' and lid=' .
128
                       $xoopsDB->escape($lid) .
129
                       ' order by date_added ASC limit 1';
130
            $resultp = $xoopsDB->query($sql);
131 View Code Duplication
            while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) {
132
                if ($photo) {
133
                    $photo3 = "<a href='" .
134
                              XOOPS_URL .
135
                              '/modules/adslight/viewads.php?lid=' .
136
                              $lid .
137
                              "'><img class=\"thumb\" src=\"$updir/thumbs/thumb_$url\" align=\"left\" width=\"100px\" alt=\"$title\"></a>";
138
                }
139
            }
140
            if ($photo > 0) {
0 ignored issues
show
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
141
            } else {
142
                $photo3 = "<a href=\"index.php?op=IndexView&lid=$lid\"><img class=\"thumb\" src=\"" .
143
                          XOOPS_URL .
144
                          "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"$title\"></a>";
145
            }
146
147
            if ($photo > 0) {
148
                $photo4 = "$photo";
149
            } else {
150
                $photo4 = '0';
151
            }
152
153
            $result7 = $xoopsDB->query('select nom_type from ' . $xoopsDB->prefix('adslight_type') . ' where id_type=' . $xoopsDB->escape($type) . '');
154
            list($nom_type) = $xoopsDB->fetchRow($result7);
155
156
            $result8 = $xoopsDB->query('select nom_price from ' . $xoopsDB->prefix('adslight_price') . ' where id_price=' . $xoopsDB->escape($typeprice) . '');
157
            list($nom_price) = $xoopsDB->fetchRow($result8);
158
159
            /* $result9=$xoopsDB->query("select nom_usure from ".$xoopsDB->prefix("adslight_usure")." where id_usure=".$xoopsDB->escape($typeusure)."");
0 ignored issues
show
Unused Code Comprehensibility introduced by
68% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
160
                list($nom_usure) = $xoopsDB->fetchRow($result9); */
161
162
            echo "<form action=\"validate_ads.php\" method=\"post\">";
163
            echo "<tr><th align='left'>" .
164
                 _AM_ADSLIGHT_LID .
165
                 ": $lid</th><th align='left'>$photo4 " .
166
                 _AM_ADSLIGHT_NBR_PHOTO .
167
                 "</th><th align='left'>" .
168
                 _AM_ADSLIGHT_TITLE .
169
                 ":</th><th align='left'>" .
170
                 _AM_ADSLIGHT_DESC .
171
                 "</th><th align='left'></th></tr>";
172
173
            echo "<tr><td class='even' width='3%'></td>";
174
            echo "<td class='odd' width='10%' >$photo3</td>";
175
176
            echo "<td class='even' width='20%'><b>$title</b><br/><br/>$nom_type<br/>$price " . $xoopsModuleConfig['adslight_money'] . " $nom_price<br/>";
177
            echo "$town - $country<br/>";
178
            echo '<b>' . _AM_ADSLIGHT_SUBMITTER . ":</b> $submitter<br/>";
179
            echo '<b>' . _AM_ADSLIGHT_DATE . ":</b> $date2</td>";
180
            echo "<td class='even' width='35%'>$desctext</td><td class='even' width='2%' align=right></td>";
181
            echo "</tr><tr><td width='5%'></td><td>";
182
183
            echo "<select name=\"op\">
184
        <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . "
185
        <option value=\"IndexView\"> " . _AM_ADSLIGHT_MODIF . "
186
        <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
187
        </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\">";
188
189
            echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
190
            echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
191
            echo "<input type=\"hidden\" name=\"cid\" value=\"$cid\">";
192
            echo "<input type=\"hidden\" name=\"title\" value=\"$title\">";
193
            echo "<input type=\"hidden\" name=\"status\" value=\"$status\">";
194
            echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\">";
195
            echo "<input type=\"hidden\" name=\"type\" value=\"$type\">";
196
            echo "<input type=\"hidden\" name=\"desctext\" value=\"$desctext\">";
197
            echo "<input type=\"hidden\" name=\"tel\" value=\"$tel\">";
198
            echo "<input type=\"hidden\" name=\"price\" value=\"$price\">";
199
            echo "<input type=\"hidden\" name=\"typeprice\" value=\"$typeprice\">";
200
            echo "<input type=\"hidden\" name=\"typeusure\" value=\"$typeusure\">";
201
            echo "<input type=\"hidden\" name=\"date\" value=\"$date\">";
202
            echo "<input type=\"hidden\" name=\"email\" value=\"$email\">";
203
            echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
204
            echo "<input type=\"hidden\" name=\"town\" value=\"$town\">";
205
            echo "<input type=\"hidden\" name=\"country\" value=\"$country\">";
206
            echo "<input type=\"hidden\" name=\"contactby\" value=\"$contactby\">";
207
            echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\">";
208
            echo "<input type=\"hidden\" name=\"photo\" value=\"$photo\">";
209
            echo '</form><br></td></tr>';
210
            ++$rank;
211
        }
212
213
        echo '</td></tr></table>
214
              <br><br>';
215
    } else {
216
        echo "<table class='outer' width='50%' border='0'><tr><td width=40>";
217
        echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>";
218
        echo "<font color='#00B4C4'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></font>';
219
        echo '</td></tr></table><br>';
220
    }
221
222
    // Modify Annonces
223
    list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ''));
224 View Code Duplication
    if ($numrows > 0) {
225
        echo "<table width='100%' border='0' class='outer'><tr class='bg4'><td valign='top'>";
226
        echo "<form method=\"post\" action=\"validate_ads.php\">" .
227
             '<b>' .
228
             _AM_ADSLIGHT_MODANN .
229
             '</b><br><br>' .
230
             '' .
231
             _AM_ADSLIGHT_NUMANN .
232
             " <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\">&nbsp;&nbsp;" .
233
             "<input type=\"hidden\" name=\"op\" value=\"ModifyAds\">" .
234
             "<input type=\"submit\" value=\"" .
235
             _AM_ADSLIGHT_MODIF .
236
             "\">" .
237
             '</form><br>';
238
        echo '</td></tr></table><br>';
239
    }
240
241
    echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>";
242
    echo "<a href=\"map.php\">" . _AM_ADSLIGHT_GESTCAT . "</a> | <a href=\"../index.php\">" . _AM_ADSLIGHT_ACCESMYANN . '</a>';
243
    echo '</td></tr></table><br>';
244
245
    xoops_cp_footer();
246
}
247
248
#  function IndexView
249
#####################################################
250
/**
251
 * @param $lid
252
 */
253
function IndexView($lid)
254
{
255
    global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
256
257
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
258
259
    include_once __DIR__ . '/header.php';
260
    xoops_cp_header();
261
    //    loadModuleAdminMenu(0, "");
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
262
263
    $result  = $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo from ' .
264
                               $xoopsDB->prefix('adslight_listing') .
265
                               " WHERE valid='No' AND lid='$lid'");
266
    $numrows = $xoopsDB->getRowsNum($result);
267
    if ($numrows > 0) {
268
        echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>";
269
        echo '<b>' . _AM_ADSLIGHT_WAIT . '</b><br><br>';
270
271
        list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo) =
272
            $xoopsDB->fetchRow($result);
273
274
        $date2     = formatTimestamp($date, 's');
275
        $title     = $myts->htmlSpecialChars($title);
276
        $status    = $myts->htmlSpecialChars($status);
277
        $expire    = $myts->htmlSpecialChars($expire);
278
        $type      = $myts->htmlSpecialChars($type);
279
        $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
280
        $tel       = $myts->htmlSpecialChars($tel);
281
        $price     = number_format($price, 2, ',', ' ');
282
        $typeprice = $myts->htmlSpecialChars($typeprice);
283
        $typeusure = $myts->htmlSpecialChars($typeusure);
284
        $submitter = $myts->htmlSpecialChars($submitter);
285
        $town      = $myts->htmlSpecialChars($town);
286
        $country   = $myts->htmlSpecialChars($country);
287
        $contactby = $myts->htmlSpecialChars($contactby);
288
        $premium   = $myts->htmlSpecialChars($premium);
289
290
        echo "<form action=\"validate_ads.php\" method=\"post\">
291
            <table><tr class='head' border='1'>
292
            <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid &nbsp;&nbsp;&nbsp;&nbsp;   " . _AM_ADSLIGHT_ADDED_ON . " &nbsp;&nbsp;&nbsp;&nbsp; $date2</td>
293
            </tr><tr class='odd' border='1'>
294
            <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td>
295
            </tr><tr class='head' border='1'>
296
            <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td>
297
            </tr><tr class='head' border='1'>
298
            <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td>
299
            </tr><tr class='head' border='1'>
300
            <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td>
301
            </tr><tr class='head' border='1'>
302
            <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td>
303
            </tr><tr class='head' border='1'>
304
            <td>" . _AM_ADSLIGHT_CONTACTBY . " </td><td><input type=\"text\" name=\"contactby\" size=\"40\" value=\"$contactby\"></td>
305
            </tr>";
306
307
        echo "<tr>
308
            <td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\"";
309
        if ($status == '0') {
310
            echo 'checked';
311
        }
312
        echo '>' . _AM_ADSLIGHT_ACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"1\"";
313
        if ($status == '1') {
314
            echo 'checked';
315
        }
316
        echo '>' . _AM_ADSLIGHT_INACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"2\"";
317
        if ($status == '2') {
318
            echo 'checked';
319
        }
320
        echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>';
321
322
        echo "<tr class='head' border='1'>
323
            <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td>
324
            </tr><tr class='head' border='1'>
325
            <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td>
326
            </tr><tr class='head' border='1'>
327
            <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td>
328
            </tr><tr class='head' border='1'>
329
            <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">";
330
331
        $result5 = $xoopsDB->query('select nom_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type');
332
        while (list($nom_type) = $xoopsDB->fetchRow($result5)) {
333
            $sel = '';
334
            if ($nom_type == $type) {
335
                $sel = 'selected';
336
            }
337
            echo "<option value=\"$nom_type\" $sel>$nom_type</option>";
338
        }
339
340
        echo '</select></td></tr>';
341
342
        ////// Etat d'usure
343
        echo "<tr class='head' border='1'>
344
            <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">";
345
346
        $result6 = $xoopsDB->query('select nom_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by nom_usure');
347
        while (list($nom_usure) = $xoopsDB->fetchRow($result6)) {
348
            $sel = '';
349
            if ($nom_usure == $typeusure) {
350
                $sel = 'selected';
351
            }
352
            echo "<option value=\"$nom_usure\" $sel>$nom_usure</option>";
353
        }
354
        echo '</select></td></tr>';
355
356
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $xoopsModuleConfig['adslight_money'] . '';
357
        $result3 = $xoopsDB->query('select nom_price from ' . $xoopsDB->prefix('adslight_price') . ' order by id_price');
358
        echo " <select name=\"typeprice\"><option value=\"$typeprice\">$typeprice</option>";
359
        while (list($nom_price) = $xoopsDB->fetchRow($result3)) {
360
            echo "<option value=\"$nom_price\">$nom_price</option>";
361
        }
362
        echo '</select></td></tr>';
363
364
        echo "<tr class='head' border='1'>
365
            <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"40\" value=\"$photo\"></td>
366
            </tr>";
367
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_DESC . '</td><td>';
368
        $wysiwyg_text_area = adslight_adminEditor(_AM_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px', 'small');
369
        echo $wysiwyg_text_area->render();
370
        echo '</td></tr>';
371
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_CAT . ' </td><td>';
372
        $mytree->makeMySelBox('title', 'title', $cid);
373
        echo "</td>
374
        </tr><tr class='head' border='1'>
375
        <td>&nbsp;</td><td><select name=\"op\">
376
        <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . "
377
        <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
378
        </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td>
379
        </tr></table>";
380
        echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
381
        echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
382
        echo "<input type=\"hidden\" name=\"date\" value=\"$date\">";
383
        echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">
384
            </form>";
385
386
        echo '</td></tr></table>';
387
        echo '<br>';
388
    }
389
390
    xoops_cp_footer();
391
}
392
393
#  function ModifyAds
394
#####################################################
395
/**
396
 * @param $lid
397
 */
398 View Code Duplication
function ModifyAds($lid)
0 ignored issues
show
The function ModifyAds() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L124-296) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
399
{
400
    global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
401
402
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
403
404
    $id_price  = '';
405
    $nom_price = '';
406
407
    include_once __DIR__ . '/header.php';
408
    xoops_cp_header();
409
    //    loadModuleAdminMenu(0, "");
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
410
411
    echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>';
412
413
    $result =
414
        $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, valid, photo from ' .
415
                        $xoopsDB->prefix('adslight_listing') .
416
                        " where lid=$lid");
417
418
    while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) =
419
        $xoopsDB->fetchRow($result)) {
420
        $title     = $myts->htmlSpecialChars($title);
421
        $status    = $myts->htmlSpecialChars($status);
422
        $expire    = $myts->htmlSpecialChars($expire);
423
        $type      = $myts->htmlSpecialChars($type);
424
        $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
425
        $tel       = $myts->htmlSpecialChars($tel);
426
        $price     = number_format($price, 2, ',', ' ');
427
        $typeprice = $myts->htmlSpecialChars($typeprice);
428
        $typeusure = $myts->htmlSpecialChars($typeusure);
429
        $submitter = $myts->htmlSpecialChars($submitter);
430
        $town      = $myts->htmlSpecialChars($town);
431
        $country   = $myts->htmlSpecialChars($country);
432
        $contactby = $myts->htmlSpecialChars($contactby);
433
        $premium   = $myts->htmlSpecialChars($premium);
434
435
        $date2 = formatTimestamp($date, 's');
436
437
        echo "<form action=\"validate_ads.php\" method=post>
438
            <table border=0><tr class='head' border='1'>
439
            <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid &nbsp;" . _AM_ADSLIGHT_ADDED_ON . "&nbsp; $date2</td>
440
            </tr><tr class='head' border='1'>
441
            <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td>
442
            </tr><tr class='head' border='1'>
443
            <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td>
444
            </tr><tr class='head' border='1'>
445
            <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td>
446
            </tr><tr class='head' border='1'>
447
            <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td>
448
            </tr><tr class='head' border='1'>
449
            <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td>
450
            </tr>
451
            <tr class='head' border='1'>";
452
453
        if ($contactby == 1) {
454
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_EMAIL;
455
        }
456
        if ($contactby == 2) {
457
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_PM;
458
        }
459
        if ($contactby == 3) {
460
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_BOTH;
461
        }
462
        if ($contactby == 4) {
463
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_PHONE;
464
        }
465
466
        echo " <td class='head'>" . _AM_ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\">
467
           <option value=\"" . $contactby . "\">" . $contactselect . "</option>
468
           <option value=\"1\">" . _AM_ADSLIGHT_CONTACT_BY_EMAIL . "</option>
469
           <option value=\"2\">" . _AM_ADSLIGHT_CONTACT_BY_PM . "</option>
470
           <option value=\"3\">" . _AM_ADSLIGHT_CONTACT_BY_BOTH . "</option>
471
           <option value=\"4\">" . _AM_ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>';
472
473
        echo "<tr><td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\"";
474
        if ($status == '0') {
475
            echo 'checked';
476
        }
477
        echo '>' . _AM_ADSLIGHT_ACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"1\"";
478
        if ($status == '1') {
479
            echo 'checked';
480
        }
481
        echo '>' . _AM_ADSLIGHT_INACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"2\"";
482
        if ($status == '2') {
483
            echo 'checked';
484
        }
485
        echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>';
486
487
        echo "<tr class='head' border='1'>
488
            <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td>
489
            </tr><tr class='head' border='1'>
490
            <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td>
491
            </tr><tr class='head' border='1'>
492
            <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td>
493
            </tr>";
494
        ////// Type d'annonce
495
        echo "<tr class='head' border='1'>
496
                 <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">";
497
498
        $result5 = $xoopsDB->query('select nom_type, id_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type');
499
        while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) {
500
            $sel = '';
501
            if ($id_type == $type) {
502
                $sel = 'selected';
503
            }
504
            echo "<option value=\"$id_type\" $sel>$nom_type</option>";
505
        }
506
        echo '</select></td></tr>';
507
508
        ////// Etat d'usure
509
510
        echo "<tr class='head' border='1'>
511
                 <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">";
512
513
        $result6 = $xoopsDB->query('select nom_usure, id_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by nom_usure');
514
        while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) {
515
            $sel = '';
516
            if ($id_usure == $typeusure) {
517
                $sel = 'selected';
518
            }
519
            echo "<option value=\"$id_usure\" $sel>$nom_usure</option>";
520
        }
521
        echo '</select></td></tr>';
522
523
        //////// Price
524
525
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $xoopsModuleConfig['adslight_money'] . '';
526
527
        //////// Price type
528
529
        $resultx = $xoopsDB->query('select nom_price, id_price from ' . $xoopsDB->prefix('adslight_price') . ' order by nom_price');
530
531
        echo " <select name=\"typeprice\"><option value=\"$id_price\">$nom_price</option>";
532
        while (list($nom_price, $id_price) = $xoopsDB->fetchRow($resultx)) {
533
            $sel = '';
534
            if ($id_price == $typeprice) {
535
                $sel = 'selected';
536
            }
537
538
            echo "<option value=\"$id_price\" $sel>$nom_price</option>";
539
        }
540
        echo '</select></td>';
541
542
        /////// Category
543
        echo "<tr class='head' border='1'>
544
            <td>" . _AM_ADSLIGHT_CAT2 . ' </td><td>';
545
        $mytree->makeMySelBox('title', 'title', $cid);
546
        echo "</td>
547
            </tr><tr class='head' border='1'>
548
            <td>" . _AM_ADSLIGHT_DESC . ' </td><td>';
549
550
        $wysiwyg_text_area = adslight_adminEditor('', 'desctext', $desctext, '100%', '200px', 'small');
551
        echo $wysiwyg_text_area->render();
552
553
        echo '</td></tr>';
554
555
        echo "<tr class='head' border='1'>
556
            <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"50\" value=\"$photo\"></td>
557
            </tr><tr>";
558
        $time = time();
559
        echo "</tr><tr class='head' border='1'>
560
            <td>&nbsp;</td><td><select name=\"op\">
561
            <option value=\"ModifyAdsS\"> " . _AM_ADSLIGHT_MODIF . "
562
            <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
563
            </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td>
564
            </tr></table>";
565
        echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
566
        echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
567
        echo "<input type=\"hidden\" name=\"date\" value=\"$time\">";
568
        echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">
569
        </form><br>";
570
        echo '</fieldset><br>';
571
        xoops_cp_footer();
572
    }
573
}
574
575
#  function ModifyAdsS
576
#####################################################
577
578
/**
579
 * @param $lid
580
 * @param $cat
581
 * @param $title
582
 * @param $status
583
 * @param $expire
584
 * @param $type
585
 * @param $desctext
586
 * @param $tel
587
 * @param $price
588
 * @param $typeprice
589
 * @param $typeusure
590
 * @param $date
591
 * @param $email
592
 * @param $submitter
593
 * @param $town
594
 * @param $country
595
 * @param $contactby
596
 * @param $premium
597
 * @param $valid
598
 * @param $photo
599
 */
600 View Code Duplication
function ModifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo)
0 ignored issues
show
The function ModifyAdsS() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L323-347) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
601
{
602
    global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang;
603
604
    $title     = $myts->htmlSpecialChars($title);
605
    $status    = $myts->htmlSpecialChars($status);
606
    $expire    = $myts->htmlSpecialChars($expire);
607
    $type      = $myts->htmlSpecialChars($type);
608
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
609
    $tel       = $myts->htmlSpecialChars($tel);
610
    $price     = str_replace(array(' '), '', $price);
611
    $typeprice = $myts->htmlSpecialChars($typeprice);
612
    $typeusure = $myts->htmlSpecialChars($typeusure);
613
    $submitter = $myts->htmlSpecialChars($submitter);
614
    $town      = $myts->htmlSpecialChars($town);
615
    $country   = $myts->htmlSpecialChars($country);
616
    $contactby = $myts->htmlSpecialChars($contactby);
617
    $premium   = $myts->htmlSpecialChars($premium);
618
619
    $xoopsDB->query('update ' .
620
                    $xoopsDB->prefix('adslight_listing') .
621
                    " set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$date', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' where lid=$lid");
622
623
    redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD);
624
}
625
626
#  function ListingDel
627
#####################################################
628
/**
629
 * @param $lid
630
 * @param $photo
631
 */
632 View Code Duplication
function ListingDel($lid, $photo)
0 ignored issues
show
The function ListingDel() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L355-388) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
633
{
634
    global $xoopsDB, $moduleDirName, $admin_lang;
635
636
    $result2 = $xoopsDB->query('select p.url FROM ' .
637
                               $xoopsDB->prefix('adslight_listing') .
638
                               ' l LEFT JOIN ' .
639
                               $xoopsDB->prefix('adslight_pictures') .
640
                               ' p  ON l.lid=p.lid where l.lid=' .
641
                               $xoopsDB->escape($lid) .
642
                               '');
643
644
    while (list($purl) = $xoopsDB->fetchRow($result2)) {
645
        if ($purl) {
646
            $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
647
            if (file_exists("$destination/$purl")) {
648
                unlink("$destination/$purl");
649
            }
650
            $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
651
            if (file_exists("$destination2/thumb_$purl")) {
652
                unlink("$destination2/thumb_$purl");
653
            }
654
            $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
655
            if (file_exists("$destination3/resized_$purl")) {
656
                unlink("$destination3/resized_$purl");
657
            }
658
            $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_pictures') . " where lid=$lid");
659
        }
660
    }
661
662
    $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_listing') . " where lid=$lid");
663
664
    redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNDEL);
665
}
666
667
#  function ListingValid
668
#####################################################
669
/**
670
 * @param $lid
671
 * @param $cat
672
 * @param $title
673
 * @param $status
674
 * @param $expire
675
 * @param $type
676
 * @param $desctext
677
 * @param $tel
678
 * @param $price
679
 * @param $typeprice
680
 * @param $typeusure
681
 * @param $date
682
 * @param $email
683
 * @param $submitter
684
 * @param $town
685
 * @param $country
686
 * @param $contactby
687
 * @param $premium
688
 * @param $valid
689
 * @param $photo
690
 */
691 View Code Duplication
function ListingValid($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo)
692
{
693
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
694
695
    $title     = $myts->htmlSpecialChars($title);
696
    $status    = $myts->htmlSpecialChars($status);
697
    $expire    = $myts->htmlSpecialChars($expire);
698
    $type      = $myts->htmlSpecialChars($type);
699
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
700
    $tel       = $myts->htmlSpecialChars($tel);
701
    $price     = str_replace(array(' '), '', $price);
702
    $typeprice = $myts->htmlSpecialChars($typeprice);
703
    $typeusure = $myts->htmlSpecialChars($typeusure);
704
    $submitter = $myts->htmlSpecialChars($submitter);
705
    $town      = $myts->htmlSpecialChars($town);
706
    $country   = $myts->htmlSpecialChars($country);
707
    $contactby = $myts->htmlSpecialChars($contactby);
708
    $premium   = $myts->htmlSpecialChars($premium);
709
    $now       = time();
710
    $xoopsDB->query('update ' .
711
                    $xoopsDB->prefix('adslight_listing') .
712
                    " set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$now', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' where lid=$lid");
713
714
    if ($email == '') {
715
    } else {
716
        $tags               = array();
717
        $tags['TITLE']      = $title;
718
        $tags['TYPE']       = adslight_NameType($type);
719
        $tags['SUBMITTER']  = $submitter;
720
        $tags['DESCTEXT']   = stripslashes($desctext);
721
        $tags['EMAIL']      = _AM_ADSLIGHT_EMAIL;
722
        $tags['TEL']        = _AM_ADSLIGHT_TEL;
723
        $tags['HELLO']      = _AM_ADSLIGHT_HELLO;
724
        $tags['VEDIT_AD']   = _AM_ADSLIGHT_VEDIT_AD;
725
        $tags['ANNACCEPT']  = _AM_ADSLIGHT_ANNACCEPT;
726
        $tags['CONSULTTO']  = _AM_ADSLIGHT_CONSULTTO;
727
        $tags['THANKS']     = _ADSLIGHT_THANKS;
728
        $tags['TEAMOF']     = _AM_ADSLIGHT_TEAMOF;
729
        $tags['META_TITLE'] = $meta['title'];
730
        $tags['LINK_URL']   = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . '';
731
        $tags['YOUR_AD']    = _AM_ADSLIGHT_YOUR_AD;
732
        $tags['WEBMASTER']  = _AM_ADSLIGHT_WEBMASTER;
733
        $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON;
734
        $tags['APPROVED']   = _AM_ADSLIGHT_APPROVED;
735
736
        $subject = '' . _AM_ADSLIGHT_ANNACCEPT . '';
737
        $mail    =& getMailer();
738
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
739
        $mail->setTemplate('listing_approve.tpl');
740
        $mail->useMail();
741
        $mail->multimailer->isHTML(true);
742
        $mail->setFromName($meta['title']);
743
        $mail->setFromEmail($xoopsConfig['adminmail']);
744
        $mail->setToEmails($email);
745
        $mail->setSubject($subject);
746
        $mail->assign($tags);
747
        $mail->send();
748
        echo $mail->getErrors();
749
    }
750
751
    $tags                    = array();
752
    $tags['TITLE']           = $title;
753
    $tags['ADDED_TO_CAT']    = _AM_ADSLIGHT_ADDED_TO_CAT;
754
    $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF;
755
    $tags['ERROR_NOTIF']     = _AM_ADSLIGHT_ERROR_NOTIF;
756
    $tags['WEBMASTER']       = _AM_ADSLIGHT_WEBMASTER;
757
    $tags['HELLO']           = _AM_ADSLIGHT_HELLO;
758
    $tags['FOLLOW_LINK']     = _AM_ADSLIGHT_FOLLOW_LINK;
759
    $tags['TYPE']            = adslight_NameType($type);
760
    $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
761
    $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat);
762
    $result                  = $xoopsDB->query($sql);
763
    $row                     = $xoopsDB->fetchArray($result);
764
    $tags['CATEGORY_TITLE']  = $row['title'];
765
    $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat);
766
    $notification_handler    = xoops_getHandler('notification');
767
    $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
768
    $notification_handler->triggerEvent('category', $cat, 'new_listing', $tags);
769
    $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags);
770
771
    redirect_header('validate_ads.php', 3, _AM_ADSLIGHT_ANNVALID);
772
}
773
774
#####################################################
775
#####################################################
776
777
foreach ($_POST as $k => $v) {
778
    ${$k} = $v;
779
}
780
781
$pa = isset($_GET['pa']) ? $_GET['pa'] : '';
782
783
if (!isset($_POST['lid']) && isset($_GET['lid'])) {
784
    $lid = $_GET['lid'];
785
}
786
if (!isset($_POST['op']) && isset($_GET['op'])) {
787
    $op = $_GET['op'];
788
}
789
if (!isset($op)) {
790
    $op = '';
791
}
792
793 View Code Duplication
switch ($op) {
794
795
    case 'IndexView':
796
        IndexView($lid);
797
        break;
798
799
    case 'ListingDel':
800
        ListingDel($lid, $photo);
801
        break;
802
803
    case 'ListingValid':
804
        ListingValid($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo);
805
        break;
806
807
    case 'ModifyAds':
808
        ModifyAds($lid);
809
        break;
810
811
    case 'ModifyAdsS':
812
        ModifyAdsS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo);
813
        break;
814
815
    default:
816
        Index();
817
        break;
818
819
}
820