Completed
Push — master ( a25b3b...67bb37 )
by Michael
02:44
created

admin/validate_ads.php (7 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
include_once __DIR__ . '/admin_header.php';
24
25
$op = XoopsRequest::getString('op', 'liste');
26
27
global $moduleDirName;
28
$moduleDirName = basename(dirname(__DIR__));
29
30
#  function Index
31
#####################################################
32
function index()
33
{
34
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $moduleDirName, $admin_lang;
35
36
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
37
38
    //    include_once __DIR__ . '/admin_header.php';
39
    xoops_cp_header();
40
    //    loadModuleAdminMenu(0, "");
41
42
    // photo dir setting checker
43
    $photo_dir         = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'];
44
    $photo_thumb_dir   = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/thumbs';
45
    $photo_resized_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/midsize';
46
    if (!is_dir($photo_dir)) {
47
        mkdir($photo_dir);
48
    }
49
    if (!is_dir($photo_thumb_dir)) {
50
        mkdir($photo_thumb_dir);
51
    }
52
    if (!is_dir($photo_resized_dir)) {
53
        mkdir($photo_resized_dir);
54
    }
55 View Code Duplication
    if (!is_writable($photo_dir) || !is_readable($photo_dir)) {
56
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
57
        echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_dir . '</b></span><br><br>';
58
        echo '</fieldset><br>';
59
    }
60
61 View Code Duplication
    if (!is_writable($photo_thumb_dir) || !is_readable($photo_thumb_dir)) {
62
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
63
        echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_thumb_dir . '</b></span><br><br>';
64
        echo '</fieldset><br>';
65
    }
66
67 View Code Duplication
    if (!is_writable($photo_resized_dir) || !is_readable($photo_resized_dir)) {
68
        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>';
69
        echo "<span style='color: #FF0000;'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_resized_dir . '</b></span><br><br>';
70
        echo '</fieldset><br>';
71
    }
72
73
    $result  = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo, usid FROM '
74
                               . $xoopsDB->prefix('adslight_listing')
75
                               . " WHERE valid='no' ORDER BY lid");
76
    $numrows = $xoopsDB->getRowsNum($result);
77
    if ($numrows > 0) {
78
79
        ///////// Il y a [..] Annonces en attente d'être approuvées //////
80
        echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
81
        echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>";
82
        echo "<span style='color:#00B4C4;'><b>" . _AM_ADSLIGHT_THEREIS . "</b></span> <b>$numrows</b> <span style='color:#00B4C4'>" . _AM_ADSLIGHT_WAIT . '</b></span>';
83
        echo '</td></tr></table><br>';
84
85
        ///// Liste des ID  ///// Soumis par /////  Titre   /////  Description  /////  Date d'ajout
86
        echo "<table width='100%' border='0' class='outer'>";
87
        $rank = 1;
88
89
        while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo, $usid) = $xoopsDB->fetchRow($result)) {
90
            $title    = $myts->htmlSpecialChars($title);
91
            $desctext = $myts->displayTarea($desctext, 1, 0, 1, 1, 1);
92
93 View Code Duplication
            if (strlen($desctext) >= 200) {
94
                $desctext = substr($desctext, 0, 199) . '...';
95
            } else {
96
                $desctext = $myts->displayTarea($desctext, 1, 1, 1);
97
            }
98
            $date2 = formatTimestamp($date, 's');
99
100
            if (is_int($rank / 2)) {
101
                $color = '#ffffff';
102
            } else {
103
                $color = 'head';
104
            }
105
106
            $status    = $myts->htmlSpecialChars($status);
107
            $expire    = $myts->htmlSpecialChars($expire);
108
            $type      = $myts->htmlSpecialChars($type);
109
            $tel       = $myts->htmlSpecialChars($tel);
110
//            $price     = number_format($price, 2, ',', ' ');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% 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...
111
112
            xoops_load('XoopsLocal');
113
            $tempXoopsLocal = new XoopsLocal;
114
            //  For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
115
            $price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
116
            //  For other countries uncomment the below line and comment out the above line
117
            //      $price = $tempXoopsLocal->number_format($price);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% 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...
118
119
            $typeprice = $myts->htmlSpecialChars($typeprice);
120
            $typeusure = $myts->htmlSpecialChars($typeusure);
121
            $submitter = $myts->htmlSpecialChars($submitter);
122
            $town      = $myts->htmlSpecialChars($town);
123
            $country   = $myts->htmlSpecialChars($country);
124
            $contactby = $myts->htmlSpecialChars($contactby);
125
            $premium   = $myts->htmlSpecialChars($premium);
126
127
            $updir   = $GLOBALS['xoopsModuleConfig']['adslight_link_upload'];
128
            $sql     = 'SELECT cod_img, lid, uid_owner, url FROM '
129
                       . $xoopsDB->prefix('adslight_pictures')
130
                       . ' WHERE  uid_owner='
131
                       . $xoopsDB->escape($usid)
132
                       . ' AND lid='
133
                       . $xoopsDB->escape($lid)
134
                       . ' ORDER BY date_added ASC limit 1';
135
            $resultp = $xoopsDB->query($sql);
136 View Code Duplication
            while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) {
137
                if ($photo) {
138
                    $photo3 = "<a href='"
139
                              . XOOPS_URL
140
                              . '/modules/adslight/viewads.php?lid='
141
                              . $lid
142
                              . "'><img class=\"thumb\" src=\"$updir/thumbs/thumb_$url\" align=\"left\" width=\"100px\" alt=\"$title\"></a>";
143
                }
144
            }
145
            if ($photo > 0) {
146
            } else {
147
                $photo3 = "<a href=\"index.php?op=IndexView&lid=$lid\"><img class=\"thumb\" src=\""
148
                          . XOOPS_URL
149
                          . "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"$title\"></a>";
150
            }
151
152
            if ($photo > 0) {
153
                $photo4 = "$photo";
154
            } else {
155
                $photo4 = '0';
156
            }
157
158
            $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'");
159
            list($nom_type) = $xoopsDB->fetchRow($result7);
160
161
            $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'");
162
            list($nom_price) = $xoopsDB->fetchRow($result8);
163
164
            /* $result9=$xoopsDB->query("select nom_usure from ".$xoopsDB->prefix("adslight_usure")." WHERE id_usure=".$xoopsDB->escape($typeusure)."");
165
                list($nom_usure) = $xoopsDB->fetchRow($result9); */
166
167
            echo "<form action=\"validate_ads.php\" method=\"post\">";
168
            echo "<tr><th align='left'>"
169
                 . _AM_ADSLIGHT_LID
170
                 . ": $lid</th><th align='left'>$photo4 "
171
                 . _AM_ADSLIGHT_NBR_PHOTO
172
                 . "</th><th align='left'>"
173
                 . _AM_ADSLIGHT_TITLE
174
                 . ":</th><th align='left'>"
175
                 . _AM_ADSLIGHT_DESC
176
                 . "</th><th align='left'></th></tr>";
177
178
            echo "<tr><td class='even' width='3%'></td>";
179
            echo "<td class='odd' width='10%' >$photo3</td>";
180
181
            echo "<td class='even' width='20%'><b>$title</b><br><br>$nom_type<br>$price " . $GLOBALS['xoopsModuleConfig']['adslight_money'] . " $nom_price<br>";
182
            echo "$town - $country<br>";
183
            echo '<b>' . _AM_ADSLIGHT_SUBMITTER . ":</b> $submitter<br>";
184
            echo '<b>' . _AM_ADSLIGHT_DATE . ":</b> $date2</td>";
185
            echo "<td class='even' width='35%'>$desctext</td><td class='even' width='2%' align=right></td>";
186
            echo "</tr><tr><td width='5%'></td><td>";
187
188
            echo "<select name=\"op\">
189
        <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . "
190
        <option value=\"IndexView\"> " . _AM_ADSLIGHT_MODIF . "
191
        <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
192
        </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\">";
193
194
            echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
195
            echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
196
            echo "<input type=\"hidden\" name=\"cid\" value=\"$cid\">";
197
            echo "<input type=\"hidden\" name=\"title\" value=\"$title\">";
198
            echo "<input type=\"hidden\" name=\"status\" value=\"$status\">";
199
            echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\">";
200
            echo "<input type=\"hidden\" name=\"type\" value=\"$type\">";
201
            echo "<input type=\"hidden\" name=\"desctext\" value=\"$desctext\">";
202
            echo "<input type=\"hidden\" name=\"tel\" value=\"$tel\">";
203
            echo "<input type=\"hidden\" name=\"price\" value=\"$price\">";
204
            echo "<input type=\"hidden\" name=\"typeprice\" value=\"$typeprice\">";
205
            echo "<input type=\"hidden\" name=\"typeusure\" value=\"$typeusure\">";
206
            echo "<input type=\"hidden\" name=\"date\" value=\"$date\">";
207
            echo "<input type=\"hidden\" name=\"email\" value=\"$email\">";
208
            echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
209
            echo "<input type=\"hidden\" name=\"town\" value=\"$town\">";
210
            echo "<input type=\"hidden\" name=\"country\" value=\"$country\">";
211
            echo "<input type=\"hidden\" name=\"contactby\" value=\"$contactby\">";
212
            echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\">";
213
            echo "<input type=\"hidden\" name=\"photo\" value=\"$photo\">";
214
            echo '</form><br></td></tr>';
215
            ++$rank;
216
        }
217
218
        echo '</td></tr></table>
219
              <br><br>';
220
    } else {
221
        echo "<table class='outer' width='50%' border='0'><tr><td width=40>";
222
        echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>";
223
        echo "<span style='color: #00B4C4;'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></span>';
224
        echo '</td></tr></table><br>';
225
    }
226
227
    // Modify Annonces
228
    list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ''));
229 View Code Duplication
    if ($numrows > 0) {
230
        echo "<table width='100%' border='0' class='outer'><tr class='bg4'><td valign='top'>";
231
        echo "<form method=\"post\" action=\"validate_ads.php\">"
232
             . '<b>'
233
             . _AM_ADSLIGHT_MODANN
234
             . '</b><br><br>'
235
             . ''
236
             . _AM_ADSLIGHT_NUMANN
237
             . " <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\">&nbsp;&nbsp;"
238
             . "<input type=\"hidden\" name=\"op\" value=\"ModifyAds\">"
239
             . "<input type=\"submit\" value=\""
240
             . _AM_ADSLIGHT_MODIF
241
             . "\">"
242
             . '</form><br>';
243
        echo '</td></tr></table><br>';
244
    }
245
246
    echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>";
247
    echo "<a href=\"map.php\">" . _AM_ADSLIGHT_GESTCAT . "</a> | <a href=\"../index.php\">" . _AM_ADSLIGHT_ACCESMYANN . '</a>';
248
    echo '</td></tr></table><br>';
249
250
    xoops_cp_footer();
251
}
252
253
#  function IndexView
254
#####################################################
255
/**
256
 * @param $lid
257
 */
258
function indexView($lid)
259
{
260
    global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang;
261
262
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
263
264
    //    include_once __DIR__ . '/admin_header.php';
265
    xoops_cp_header();
266
    //    loadModuleAdminMenu(0, "");
267
268
    $result  = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo FROM '
269
                               . $xoopsDB->prefix('adslight_listing')
270
                               . " WHERE valid='No' AND lid='$lid'");
271
    $numrows = $xoopsDB->getRowsNum($result);
272
    if ($numrows > 0) {
273
        echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>";
274
        echo '<b>' . _AM_ADSLIGHT_WAIT . '</b><br><br>';
275
276
        list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo) = $xoopsDB->fetchRow($result);
277
278
        $date2     = formatTimestamp($date, 's');
279
        $title     = $myts->htmlSpecialChars($title);
280
        $status    = $myts->htmlSpecialChars($status);
281
        $expire    = $myts->htmlSpecialChars($expire);
282
        $type      = $myts->htmlSpecialChars($type);
283
        $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
284
        $tel       = $myts->htmlSpecialChars($tel);
285
//        $price     = number_format($price, 2, ',', ' ');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% 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...
286
        xoops_load('XoopsLocal');
287
        $tempXoopsLocal = new XoopsLocal;
288
        //  For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
289
        $price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
290
        //  For other countries uncomment the below line and comment out the above line
291
        //      $price = $tempXoopsLocal->number_format($price);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% 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...
292
293
        $typeprice = $myts->htmlSpecialChars($typeprice);
294
        $typeusure = $myts->htmlSpecialChars($typeusure);
295
        $submitter = $myts->htmlSpecialChars($submitter);
296
        $town      = $myts->htmlSpecialChars($town);
297
        $country   = $myts->htmlSpecialChars($country);
298
        $contactby = $myts->htmlSpecialChars($contactby);
299
        $premium   = $myts->htmlSpecialChars($premium);
300
301
        echo "<form action=\"validate_ads.php\" method=\"post\">
302
            <table><tr class='head' border='1'>
303
            <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid &nbsp;&nbsp;&nbsp;&nbsp;   " . _AM_ADSLIGHT_ADDED_ON . " &nbsp;&nbsp;&nbsp;&nbsp; $date2</td>
304
            </tr><tr class='odd' border='1'>
305
            <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td>
306
            </tr><tr class='head' border='1'>
307
            <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td>
308
            </tr><tr class='head' border='1'>
309
            <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td>
310
            </tr><tr class='head' border='1'>
311
            <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td>
312
            </tr><tr class='head' border='1'>
313
            <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td>
314
            </tr><tr class='head' border='1'>
315
            <td>" . _AM_ADSLIGHT_CONTACTBY . " </td><td><input type=\"text\" name=\"contactby\" size=\"40\" value=\"$contactby\"></td>
316
            </tr>";
317
318
        echo "<tr>
319
            <td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\"";
320
        if ($status == '0') {
321
            echo 'checked';
322
        }
323
        echo '>' . _AM_ADSLIGHT_ACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"1\"";
324
        if ($status == '1') {
325
            echo 'checked';
326
        }
327
        echo '>' . _AM_ADSLIGHT_INACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"2\"";
328
        if ($status == '2') {
329
            echo 'checked';
330
        }
331
        echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>';
332
333
        echo "<tr class='head' border='1'>
334
            <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td>
335
            </tr><tr class='head' border='1'>
336
            <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td>
337
            </tr><tr class='head' border='1'>
338
            <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td>
339
            </tr><tr class='head' border='1'>
340
            <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">";
341
342
        $result5 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type');
343
        while (list($nom_type) = $xoopsDB->fetchRow($result5)) {
344
            $sel = '';
345
            if ($nom_type == $type) {
346
                $sel = 'selected';
347
            }
348
            echo "<option value=\"$nom_type\" $sel>$nom_type</option>";
349
        }
350
351
        echo '</select></td></tr>';
352
353
        ////// Etat d'usure
354
        echo "<tr class='head' border='1'>
355
            <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">";
356
357
        $result6 = $xoopsDB->query('SELECT nom_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY nom_usure');
358
        while (list($nom_usure) = $xoopsDB->fetchRow($result6)) {
359
            $sel = '';
360
            if ($nom_usure == $typeusure) {
361
                $sel = 'selected';
362
            }
363
            echo "<option value=\"$nom_usure\" $sel>$nom_usure</option>";
364
        }
365
        echo '</select></td></tr>';
366
367
        echo "<tr class='head' border='1'><td>"
368
             . _AM_ADSLIGHT_PRICE2
369
             . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> "
370
             . $GLOBALS['xoopsModuleConfig']['adslight_money']
371
             . '';
372
        $result3 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price');
373
        echo " <select name=\"typeprice\"><option value=\"$typeprice\">$typeprice</option>";
374
        while (list($nom_price) = $xoopsDB->fetchRow($result3)) {
375
            echo "<option value=\"$nom_price\">$nom_price</option>";
376
        }
377
        echo '</select></td></tr>';
378
379
        echo "<tr class='head' border='1'>
380
            <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"40\" value=\"$photo\"></td>
381
            </tr>";
382
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_DESC . '</td><td>';
383
        $wysiwyg_text_area = AdslightUtilities::getEditor(_AM_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px', 'small');
384
        echo $wysiwyg_text_area->render();
385
        echo '</td></tr>';
386
        echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_CAT . ' </td><td>';
387
        $mytree->makeMySelBox('title', 'title', $cid);
388
        echo "</td>
389
        </tr><tr class='head' border='1'>
390
        <td>&nbsp;</td><td><select name=\"op\">
391
        <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . "
392
        <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
393
        </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td>
394
        </tr></table>";
395
        echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
396
        echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
397
        echo "<input type=\"hidden\" name=\"date\" value=\"$date\">";
398
        echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">
399
            </form>";
400
401
        echo '</td></tr></table>';
402
        echo '<br>';
403
    }
404
405
    xoops_cp_footer();
406
}
407
408
#  function modifyAds
409
#####################################################
410
/**
411
 * @param $lid
412
 */
413
function modifyAds($lid)
414
{
415
    global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang;
416
417
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
418
419
    $id_price  = '';
420
    $nom_price = '';
421
422
    //    include_once __DIR__ . '/admin_header.php';
423
    xoops_cp_header();
424
    //    loadModuleAdminMenu(0, "");
425
426
    echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>';
427
428
    $result = $xoopsDB->query('SELECT lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, valid, photo FROM '
429
                              . $xoopsDB->prefix('adslight_listing')
430
                              . " WHERE lid=$lid");
431
432 View Code Duplication
    while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) = $xoopsDB->fetchRow($result)) {
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...
433
        $title     = $myts->htmlSpecialChars($title);
434
        $status    = $myts->htmlSpecialChars($status);
435
        $expire    = $myts->htmlSpecialChars($expire);
436
        $type      = $myts->htmlSpecialChars($type);
437
        $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
438
        $tel       = $myts->htmlSpecialChars($tel);
439
//        $price     = number_format($price, 2, ',', ' ');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% 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...
440
441
        xoops_load('XoopsLocal');
442
        $tempXoopsLocal = new XoopsLocal;
443
        //  For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
444
        $price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
445
        //  For other countries uncomment the below line and comment out the above line
446
        //      $price = $tempXoopsLocal->number_format($price);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% 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...
447
448
        $typeprice = $myts->htmlSpecialChars($typeprice);
449
        $typeusure = $myts->htmlSpecialChars($typeusure);
450
        $submitter = $myts->htmlSpecialChars($submitter);
451
        $town      = $myts->htmlSpecialChars($town);
452
        $country   = $myts->htmlSpecialChars($country);
453
        $contactby = $myts->htmlSpecialChars($contactby);
454
        $premium   = $myts->htmlSpecialChars($premium);
455
456
        $date2 = formatTimestamp($date, 's');
457
458
        echo "<form action=\"validate_ads.php\" method=post>
459
            <table border=0><tr class='head' border='1'>
460
            <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid &nbsp;" . _AM_ADSLIGHT_ADDED_ON . "&nbsp; $date2</td>
461
            </tr><tr class='head' border='1'>
462
            <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td>
463
            </tr><tr class='head' border='1'>
464
            <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td>
465
            </tr><tr class='head' border='1'>
466
            <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td>
467
            </tr><tr class='head' border='1'>
468
            <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td>
469
            </tr><tr class='head' border='1'>
470
            <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td>
471
            </tr>
472
            <tr class='head' border='1'>";
473
474
        if ($contactby == 1) {
475
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_EMAIL;
476
        }
477
        if ($contactby == 2) {
478
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_PM;
479
        }
480
        if ($contactby == 3) {
481
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_BOTH;
482
        }
483
        if ($contactby == 4) {
484
            $contactselect = _AM_ADSLIGHT_CONTACT_BY_PHONE;
485
        }
486
487
        echo " <td class='head'>" . _AM_ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\">
488
           <option value=\"" . $contactby . "\">" . $contactselect . "</option>
489
           <option value=\"1\">" . _AM_ADSLIGHT_CONTACT_BY_EMAIL . "</option>
490
           <option value=\"2\">" . _AM_ADSLIGHT_CONTACT_BY_PM . "</option>
491
           <option value=\"3\">" . _AM_ADSLIGHT_CONTACT_BY_BOTH . "</option>
492
           <option value=\"4\">" . _AM_ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>';
493
494
        echo "<tr><td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\"";
495
        if ($status == '0') {
496
            echo 'checked';
497
        }
498
        echo '>' . _AM_ADSLIGHT_ACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"1\"";
499
        if ($status == '1') {
500
            echo 'checked';
501
        }
502
        echo '>' . _AM_ADSLIGHT_INACTIVE . "&nbsp;&nbsp; <input type=\"radio\" name=\"status\" value=\"2\"";
503
        if ($status == '2') {
504
            echo 'checked';
505
        }
506
        echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>';
507
508
        echo "<tr class='head' border='1'>
509
            <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td>
510
            </tr><tr class='head' border='1'>
511
            <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td>
512
            </tr><tr class='head' border='1'>
513
            <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td>
514
            </tr>";
515
        ////// Type d'annonce
516
        echo "<tr class='head' border='1'>
517
                 <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">";
518
519
        $result5 = $xoopsDB->query('SELECT nom_type, id_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type');
520
        while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) {
521
            $sel = '';
522
            if ($id_type == $type) {
523
                $sel = 'selected';
524
            }
525
            echo "<option value=\"$id_type\" $sel>$nom_type</option>";
526
        }
527
        echo '</select></td></tr>';
528
529
        ////// Etat d'usure
530
531
        echo "<tr class='head' border='1'>
532
                 <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">";
533
534
        $result6 = $xoopsDB->query('SELECT nom_usure, id_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY nom_usure');
535
        while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) {
536
            $sel = '';
537
            if ($id_usure == $typeusure) {
538
                $sel = 'selected';
539
            }
540
            echo "<option value=\"$id_usure\" $sel>$nom_usure</option>";
541
        }
542
        echo '</select></td></tr>';
543
544
        //////// Price
545
546
        echo "<tr class='head' border='1'><td>"
547
             . _AM_ADSLIGHT_PRICE2
548
             . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> "
549
             . $GLOBALS['xoopsModuleConfig']['adslight_money'];
550
551
        //////// Price type
552
553
        $resultx = $xoopsDB->query('SELECT nom_price, id_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY nom_price');
554
555
        echo " <select name=\"typeprice\"><option value=\"$id_price\">$nom_price</option>";
556
        while (list($nom_price, $id_price) = $xoopsDB->fetchRow($resultx)) {
557
            $sel = '';
558
            if ($id_price == $typeprice) {
559
                $sel = 'selected';
560
            }
561
562
            echo "<option value=\"$id_price\" $sel>$nom_price</option>";
563
        }
564
        echo '</select></td>';
565
566
        /////// Category
567
        echo "<tr class='head' border='1'>
568
            <td>" . _AM_ADSLIGHT_CAT2 . ' </td><td>';
569
        $mytree->makeMySelBox('title', 'title', $cid);
570
        echo "</td>
571
            </tr><tr class='head' border='1'>
572
            <td>" . _AM_ADSLIGHT_DESC . ' </td><td>';
573
574
        $wysiwyg_text_area = AdslightUtilities::getEditor('', 'desctext', $desctext, '100%', '200px', 'small');
575
        echo $wysiwyg_text_area->render();
576
577
        echo '</td></tr>';
578
579
        echo "<tr class='head' border='1'>
580
            <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"50\" value=\"$photo\"></td>
581
            </tr><tr>";
582
        $time = time();
583
        echo "</tr><tr class='head' border='1'>
584
            <td>&nbsp;</td><td><select name=\"op\">
585
            <option value=\"ModifyAdsS\"> " . _AM_ADSLIGHT_MODIF . "
586
            <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . "
587
            </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td>
588
            </tr></table>";
589
        echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">";
590
        echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
591
        echo "<input type=\"hidden\" name=\"date\" value=\"$time\">";
592
        echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">
593
        </form><br>";
594
        echo '</fieldset><br>';
595
        xoops_cp_footer();
596
    }
597
}
598
599
#  function modifyAdsS
600
#####################################################
601
602
/**
603
 * @param $lid
604
 * @param $cat
605
 * @param $title
606
 * @param $status
607
 * @param $expire
608
 * @param $type
609
 * @param $desctext
610
 * @param $tel
611
 * @param $price
612
 * @param $typeprice
613
 * @param $typeusure
614
 * @param $date
615
 * @param $email
616
 * @param $submitter
617
 * @param $town
618
 * @param $country
619
 * @param $contactby
620
 * @param $premium
621
 * @param $valid
622
 * @param $photo
623
 */
624
function modifyAdsS(
625
    $lid,
626
    $cat,
627
    $title,
628
    $status,
629
    $expire,
630
    $type,
631
    $desctext,
632
    $tel,
633
    $price,
634
    $typeprice,
635
    $typeusure,
636
    $date,
637
    $email,
638
    $submitter,
639
    $town,
640
    $country,
641
    $contactby,
642
    $premium,
643
    $valid,
644
    $photo
645
) {
646
    global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang;
647
648
    $title     = $myts->htmlSpecialChars($title);
649
    $status    = $myts->htmlSpecialChars($status);
650
    $expire    = $myts->htmlSpecialChars($expire);
651
    $type      = $myts->htmlSpecialChars($type);
652
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
653
    $tel       = $myts->htmlSpecialChars($tel);
654
    $price     = str_replace(array(' '), '', $price);
655
    $typeprice = $myts->htmlSpecialChars($typeprice);
656
    $typeusure = $myts->htmlSpecialChars($typeusure);
657
    $submitter = $myts->htmlSpecialChars($submitter);
658
    $town      = $myts->htmlSpecialChars($town);
659
    $country   = $myts->htmlSpecialChars($country);
660
    $contactby = $myts->htmlSpecialChars($contactby);
661
    $premium   = $myts->htmlSpecialChars($premium);
662
663
    $sql = 'UPDATE '
664
           . $xoopsDB->prefix('adslight_listing')
665
           . " 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";
666
667
    $result = $xoopsDB->query($sql);
668 View Code Duplication
    if (!$result) {
669
        redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_UPGRADEFAILED);
670
    } else {
671
        redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD);
672
    }
673
}
674
675
#  function listingDel
676
#####################################################
677
/**
678
 * @param $lid
679
 * @param $photo
680
 */
681 View Code Duplication
function listingDel($lid, $photo)
682
{
683
    global $xoopsDB, $moduleDirName, $admin_lang;
684
685
    $result2 = $xoopsDB->query('SELECT p.url FROM '
686
                               . $xoopsDB->prefix('adslight_listing')
687
                               . ' l LEFT JOIN '
688
                               . $xoopsDB->prefix('adslight_pictures')
689
                               . ' p  ON l.lid=p.lid WHERE l.lid='
690
                               . $xoopsDB->escape($lid));
691
692
    while (list($purl) = $xoopsDB->fetchRow($result2)) {
693
        if ($purl) {
694
            $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight';
695
            if (file_exists("$destination/$purl")) {
696
                unlink("$destination/$purl");
697
            }
698
            $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs';
699
            if (file_exists("$destination2/thumb_$purl")) {
700
                unlink("$destination2/thumb_$purl");
701
            }
702
            $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize';
703
            if (file_exists("$destination3/resized_$purl")) {
704
                unlink("$destination3/resized_$purl");
705
            }
706
            $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_pictures') . " WHERE lid=$lid");
707
        }
708
    }
709
710
    $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid=$lid");
711
712
    redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNDEL);
713
}
714
715
#  function listingValid
716
#####################################################
717
/**
718
 * @param $lid
719
 * @param $cat
720
 * @param $title
721
 * @param $status
722
 * @param $expire
723
 * @param $type
724
 * @param $desctext
725
 * @param $tel
726
 * @param $price
727
 * @param $typeprice
728
 * @param $typeusure
729
 * @param $date
730
 * @param $email
731
 * @param $submitter
732
 * @param $town
733
 * @param $country
734
 * @param $contactby
735
 * @param $premium
736
 * @param $valid
737
 * @param $photo
738
 */
739
function listingValid(
740
    $lid,
741
    $cat,
742
    $title,
743
    $status,
744
    $expire,
745
    $type,
746
    $desctext,
747
    $tel,
748
    $price,
749
    $typeprice,
750
    $typeusure,
751
    $date,
752
    $email,
753
    $submitter,
754
    $town,
755
    $country,
756
    $contactby,
757
    $premium,
758
    $valid,
759
    $photo
760
) {
761
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
762
763
    $title     = $myts->htmlSpecialChars($title);
764
    $status    = $myts->htmlSpecialChars($status);
765
    $expire    = $myts->htmlSpecialChars($expire);
766
    $type      = $myts->htmlSpecialChars($type);
767
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1);
768
    $tel       = $myts->htmlSpecialChars($tel);
769
    $price     = str_replace(array(' '), '', $price);
770
    $typeprice = $myts->htmlSpecialChars($typeprice);
771
    $typeusure = $myts->htmlSpecialChars($typeusure);
772
    $submitter = $myts->htmlSpecialChars($submitter);
773
    $town      = $myts->htmlSpecialChars($town);
774
    $country   = $myts->htmlSpecialChars($country);
775
    $contactby = $myts->htmlSpecialChars($contactby);
776
    $premium   = $myts->htmlSpecialChars($premium);
777
    $now       = time();
778
    $sql       = 'UPDATE '
779
                 . $xoopsDB->prefix('adslight_listing')
780
                 . " 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'";
781
782
    $result = $xoopsDB->query($sql);
783 View Code Duplication
    if (!$result) {
784
        redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_UPGRADEFAILED);
785
    } else {
786
        redirect_header('validate_ads.php', 1, _AM_ADSLIGHT_ANNMOD);
787
    }
788
789
    if ($email == '') {
790
    } else {
791
        $tags               = array();
792
        $tags['TITLE']      = $title;
793
        $tags['TYPE']       = AdslightUtilities::getNameType($type);
794
        $tags['SUBMITTER']  = $submitter;
795
        $tags['DESCTEXT']   = stripslashes($desctext);
796
        $tags['EMAIL']      = _AM_ADSLIGHT_EMAIL;
797
        $tags['TEL']        = _AM_ADSLIGHT_TEL;
798
        $tags['HELLO']      = _AM_ADSLIGHT_HELLO;
799
        $tags['VEDIT_AD']   = _AM_ADSLIGHT_VEDIT_AD;
800
        $tags['ANNACCEPT']  = _AM_ADSLIGHT_ANNACCEPT;
801
        $tags['CONSULTTO']  = _AM_ADSLIGHT_CONSULTTO;
802
        $tags['THANKS']     = _ADSLIGHT_THANKS;
803
        $tags['TEAMOF']     = _AM_ADSLIGHT_TEAMOF;
804
        $tags['META_TITLE'] = $meta['title'];
805
        $tags['LINK_URL']   = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . '';
806
        $tags['YOUR_AD']    = _AM_ADSLIGHT_YOUR_AD;
807
        $tags['WEBMASTER']  = _AM_ADSLIGHT_WEBMASTER;
808
        $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON;
809
        $tags['APPROVED']   = _AM_ADSLIGHT_APPROVED;
810
811
        $subject = '' . _AM_ADSLIGHT_ANNACCEPT . '';
812
        $mail    =& getMailer();
813
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
814
        $mail->setTemplate('listing_approve.tpl');
815
        $mail->useMail();
816
        $mail->multimailer->isHTML(true);
817
        $mail->setFromName($meta['title']);
818
        $mail->setFromEmail($xoopsConfig['adminmail']);
819
        $mail->setToEmails($email);
820
        $mail->setSubject($subject);
821
        $mail->assign($tags);
822
        $mail->send();
823
        echo $mail->getErrors();
824
    }
825
826
    $tags                    = array();
827
    $tags['TITLE']           = $title;
828
    $tags['ADDED_TO_CAT']    = _AM_ADSLIGHT_ADDED_TO_CAT;
829
    $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF;
830
    $tags['ERROR_NOTIF']     = _AM_ADSLIGHT_ERROR_NOTIF;
831
    $tags['WEBMASTER']       = _AM_ADSLIGHT_WEBMASTER;
832
    $tags['HELLO']           = _AM_ADSLIGHT_HELLO;
833
    $tags['FOLLOW_LINK']     = _AM_ADSLIGHT_FOLLOW_LINK;
834
    $tags['TYPE']            = AdslightUtilities::getNameType($type);
835
    $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
836
    $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat);
837
    $result                  = $xoopsDB->query($sql);
838
    $row                     = $xoopsDB->fetchArray($result);
839
    $tags['CATEGORY_TITLE']  = $row['title'];
840
    $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat);
841
    $notification_handler    = xoops_getHandler('notification');
842
    $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
843
    $notification_handler->triggerEvent('category', $cat, 'new_listing', $tags);
844
    $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags);
845
846
    redirect_header('validate_ads.php', 3, _AM_ADSLIGHT_ANNVALID);
847
}
848
849
#####################################################
850
#####################################################
851
852
foreach ($_POST as $k => $v) {
853
    ${$k} = $v;
854
}
855
856
$pa      = XoopsRequest::getInt('pa', '', 'GET');
857
858
if (!isset($_POST['lid']) && isset($_GET['lid'])) {
859
    $lid = $_GET['lid'];
860
}
861
if (!isset($_POST['op']) && isset($_GET['op'])) {
862
    $op = $_GET['op'];
863
}
864
if (!isset($op)) {
865
    $op = '';
866
}
867
868 View Code Duplication
switch ($op) {
869
870
    case 'IndexView':
871
        indexView($lid);
872
        break;
873
874
    case 'ListingDel':
875
        listingDel($lid, $photo);
876
        break;
877
878
    case 'ListingValid':
879
        listingValid($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo);
880
        break;
881
882
    case 'ModifyAds':
883
        modifyAds($lid);
884
        break;
885
886
    case 'ModifyAdsS':
887
        modifyAdsS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo);
888
        break;
889
890
    default:
891
        index();
892
        break;
893
894
}
895