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

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__ . '/header.php';
24
$myts = MyTextSanitizer::getInstance();// MyTextSanitizer object
25
require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
26
include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
27
include XOOPS_ROOT_PATH . '/class/module.errorhandler.php';
28
include_once __DIR__ . '/include/functions.php';
29
// include_once XOOPS_ROOT_PATH."/class/captcha/xoopscaptcha.php";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
30
31
$erh = new ErrorHandler; //ErrorHandler object
32
33
$module_id = $xoopsModule->getVar('mid');
34
if (is_object($xoopsUser)) {
35
    $groups = $xoopsUser->getGroups();
36
} else {
37
    $groups = XOOPS_GROUP_ANONYMOUS;
38
}
39
$gperm_handler = xoops_getHandler('groupperm');
40
if (isset($_POST['item_id'])) {
41
    $perm_itemid = (int)$_POST['item_id'];
42
} else {
43
    $perm_itemid = 0;
44
}
45 View Code Duplication
if (!$gperm_handler->checkRight('adslight_submit', $perm_itemid, $groups, $module_id)) {
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...
46
    redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
47
}
48
if (!$gperm_handler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) {
49
    $premium = 0;
50
} else {
51
    $premium = 1;
52
}
53
54
include_once XOOPS_ROOT_PATH . '/modules/adslight/include/functions.php';
55
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
56
include_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
57
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
58
59
if (empty($xoopsUser)) {
60
    redirect_header(XOOPS_URL . '/user.php', 2, _ADS_MUSTREGFIRST);
61
}
62
63
if (!empty($_POST['submit'])) {
64
    $howlong = $xoopsModuleConfig['adslight_howlong'];
65
66
    if (!$xoopsGTicket->check(true, 'token')) {
67
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
68
    }
69
70
    //    xoops_load("xoopscaptcha");
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...
71
    //    $xoopsCaptcha = XoopsCaptcha::getInstance();
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
72
    //    if ( !$xoopsCaptcha->verify() ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
73
    //        redirect_header( XOOPS_URL . "/modules/adslight/index.php", 2, $xoopsCaptcha->getMessage() );
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
74
    //    }
75
76
    if ($_POST['title'] == '') {
77
        $erh->show('1001');
78
    }
79
80 View Code Duplication
    if (!empty($_POST['cid'])) {
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...
81
        $cid = (int)$_POST['cid'];
82
    } else {
83
        $cid = 0;
84
    }
85
    $cat_perms = adslight_MygetItemIds('adslight_submit');
86
    if (!in_array($cid, $cat_perms)) {
87
        redirect_header(XOOPS_URL, 2, _NOPERM);
88
    }
89
90
    $title     = $myts->addSlashes($_POST['title']);
91
    $status    = $myts->addSlashes($_POST['status']);
92
    $expire    = $myts->addSlashes($_POST['expire']);
93
    $type      = $myts->addSlashes($_POST['type']);
94
    $desctext  = $myts->displayTarea($_POST['desctext'], 1, 1, 1);
95
    $tel       = $myts->addSlashes($_POST['tel']);
96
    $price     = str_replace(array(' '), '', $_POST['price']);
97
    $typeprice = $myts->addSlashes($_POST['typeprice']);
98
    $typeusure = $myts->addSlashes($_POST['typeusure']);
99
    $date      = $myts->addSlashes($_POST['date']);
100
    $email     = $myts->addSlashes($_POST['email']);
101
    $submitter = $myts->addSlashes($_POST['submitter']);
102
    $usid      = $myts->addSlashes($_POST['usid']);
103
    $town      = $myts->addSlashes($_POST['town']);
104
    $country   = $myts->addSlashes($_POST['country']);
105
    $contactby = $myts->addSlashes($_POST['contactby']);
106
    $premium   = $myts->addSlashes($_POST['premium']);
107
    $valid     = $myts->addSlashes($_POST['valid']);
108
    $date      = time();
109
    $newid     = $xoopsDB->genId($xoopsDB->prefix('adslight_listing') . '_lid_seq');
110
111
    $sql =
112
        sprintf("INSERT INTO %s (lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, usid, town, country, contactby, premium, valid) VALUES (%u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
113
                $xoopsDB->prefix('adslight_listing'), $newid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town, $country,
114
                $contactby, $premium, $valid);
115
    $xoopsDB->query($sql) || $erh->show('0013');
116
117
    $lid = $xoopsDB->getInsertId();
118
119 View Code Duplication
    if ($valid === 'Yes') {
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...
120
        $notification_handler = xoops_getHandler('notification');
121
        //$lid = $xoopsDB->getInsertId();
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
122
        $tags                    = array();
123
        $tags['TITLE']           = $title;
124
        $tags['ADDED_TO_CAT']    = _ADSLIGHT_ADDED_TO_CAT;
125
        $tags['RECIEVING_NOTIF'] = _ADSLIGHT_RECIEVING_NOTIF;
126
        $tags['ERROR_NOTIF']     = _ADSLIGHT_ERROR_NOTIF;
127
        $tags['WEBMASTER']       = _ADSLIGHT_WEBMASTER;
128
        $tags['HELLO']           = _ADSLIGHT_HELLO;
129
        $tags['FOLLOW_LINK']     = _ADSLIGHT_FOLLOW_LINK;
130
        $tags['TYPE']            = adslight_NameType($type);
131
        $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
132
        $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid);
133
        $result2                 = $xoopsDB->query($sql);
134
        $row                     = $xoopsDB->fetchArray($result2);
135
        $tags['CATEGORY_TITLE']  = $row['title'];
136
        $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cid);
137
        $notification_handler    = xoops_getHandler('notification');
138
        $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
139
        $notification_handler->triggerEvent('category', $cid, 'new_listing', $tags);
140
        $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags);
141
    } else {
142
        $tags                   = array();
143
        $subject                = '' . _ADSLIGHT_NEW_WAITING_SUBJECT . '';
144
        $tags['TITLE']          = $title;
145
        $tags['DESCTEXT']       = $desctext;
146
        $tags['ADMIN']          = _ADSLIGHT_ADMIN;
147
        $tags['NEW_WAITING']    = _ADSLIGHT_NEW_WAITING;
148
        $tags['PLEASE_CHECK']   = _ADSLIGHT_PLEASE_CHECK;
149
        $tags['WEBMASTER']      = _ADSLIGHT_WEBMASTER;
150
        $tags['HELLO']          = _ADSLIGHT_HELLO;
151
        $tags['FOLLOW_LINK']    = _ADSLIGHT_FOLLOW_LINK;
152
        $tags['TYPE']           = adslight_NameType($type);
153
        $tags['NEED_TO_LOGIN']  = _ADSLIGHT_NEED_TO_LOGIN;
154
        $tags['ADMIN_LINK']     = XOOPS_URL . '/modules/adslight/admin/validate_ads.php';
155
        $sql                    = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid);
156
        $result2                = $xoopsDB->query($sql);
157
        $row                    = $xoopsDB->fetchArray($result2);
158
        $tags['CATEGORY_TITLE'] = $row['title'];
159
        $tags['NEWAD']          = _ADSLIGHT_NEWAD;
160
161
        $mail = xoops_getMailer();
162
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/adslight/language/' . $xoopsConfig['language'] . '/mail_template/');
163
        $mail->setTemplate('listing_notify_admin.tpl');
164
        $mail->useMail();
165
        $mail->multimailer->isHTML(true);
166
        $mail->setFromName($xoopsConfig['sitename']);
167
        $mail->setFromEmail($xoopsConfig['adminmail']);
168
        $mail->setToEmails($xoopsConfig['adminmail']);
169
        $mail->setSubject($subject);
170
        $mail->assign($tags);
171
        $mail->send();
172
        echo $mail->getErrors();
173
    }
174
175 View Code Duplication
    if (!empty($_POST['addphotonow'])) {
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...
176
        $addphotonow = (int)$_POST['addphotonow'];
177
    } else {
178
        $addphotonow = '0';
179
    }
180
181 View Code Duplication
    if ($addphotonow) {
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...
182
        //$lid = $xoopsDB->getInsertId();
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
183
        redirect_header("view_photos.php?lid=$lid&uid=$usid", 3, _ADSLIGHT_ADSADDED);
184
    } else {
185
        redirect_header('index.php', 3, _ADSLIGHT_ADSADDED);
186
    }
187
} else {
188
    $xoopsOption['template_main'] = 'adslight_addlisting.tpl';
189
    include XOOPS_ROOT_PATH . '/header.php';
190
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
191
192 View Code Duplication
    if (!empty($_POST['cid'])) {
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...
193
        $cid = (int)$_POST['cid'];
194
    } else {
195
        $cid = 0;
196
    }
197
198 View Code Duplication
    if (!empty($_POST['cat_moderate'])) {
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...
199
        $cat_moderate = (int)$_POST['cat_moderate'];
200
    } else {
201
        $cat_moderate = 0;
202
    }
203
204
    $howlong      = $xoopsModuleConfig['adslight_howlong'];
205
    $member_usid  = $xoopsUser->getVar('uid', 'E');
206
    $member_email = $xoopsUser->getVar('email', 'E');
207
    $member_uname = $xoopsUser->getVar('uname', 'E');
208
209
    $result  = $xoopsDB->query('select id_type, nom_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type');
210
    $result1 = $xoopsDB->query('select id_price, nom_price from ' . $xoopsDB->prefix('adslight_price') . ' order by id_price');
211
    $result3 = $xoopsDB->query('select id_usure, nom_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by id_usure');
212
213
    ob_start();
214
    $form = new XoopsThemeForm(_ADSLIGHT_ADD_LISTING, 'submitform', 'add.php');
215
    $form->setExtra('enctype="multipart/form-data"');
216
217
    $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__, 1800, 'token');
218
219 View Code Duplication
    if ($cat_moderate) {
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...
220
        if ($premium != '0') {
221
            echo '';
222
        } else {
223
            echo '';
224
        }
225
    } else {
226
        if ($premium != '0') {
227
            echo '';
228
        } else {
229
            echo '';
230
        }
231
    }
232
233 View Code Duplication
    if ($xoopsModuleConfig['adslight_diff_name'] == '1') {
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...
234
        $form->addElement(new XoopsFormText(_ADSLIGHT_SUBMITTER, 'submitter', 50, 50, $member_uname), true);
235
    } else {
236
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_SUBMITTER, $member_uname));
237
        $form->addElement(new XoopsFormHidden('submitter', $member_uname), true);
238
    }
239 View Code Duplication
    if ($xoopsModuleConfig['adslight_diff_email'] == '1') {
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...
240
        $form->addElement(new XoopsFormText(_ADSLIGHT_EMAIL, 'email', 50, 50, $member_email), true);
241
    } else {
242
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_EMAIL, $member_email));
243
        $form->addElement(new XoopsFormHidden('email', $member_email), true);
244
    }
245
    $form->addElement(new XoopsFormText(_ADSLIGHT_TOWN, 'town', 50, 50, ''), false);
246 View Code Duplication
    if ($xoopsModuleConfig['adslight_use_country'] == '1') {
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...
247
        $form->addElement(new XoopsFormText(_ADSLIGHT_COUNTRY, 'country', 50, 50, ''), false);
248
    } else {
249
        $form->addElement(new XoopsFormHidden('country', ''), false);
250
    }
251
    $form->addElement(new XoopsFormText(_ADSLIGHT_TEL, 'tel', 50, 50, ''), false);
252
253
    // $cat_id = $_GET['cid'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
254
    $cid       = 1;
255
    $cat_perms = adslight_MygetItemIds('adslight_submit');
256
    if (is_array($cat_perms) && count($cat_perms) > 0) {
257
        if (!in_array($cid, $cat_perms)) {
258
            redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM);
259
        }
260
        ////  Début Menu déroulant /////
261
        ob_start();
262
        $mytree->makeMySelBox('title', 'title', $cid, 'cid');
263
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_CAT3, ob_get_contents()), true);
264
        ob_end_clean();
265
        //// Fin Menu déroulant /////
266
267
        $category = $xoopsDB->query('select title, cat_moderate from ' . $xoopsDB->prefix('adslight_categories') . ' where cid=' . $xoopsDB->escape($cid) . '');
268
269
        list($cat_title, $cat_moderate) = $xoopsDB->fetchRow($category);
270
271 View Code Duplication
        if ($premium == '1') {
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...
272
            $radio        = new XoopsFormRadio(_ADSLIGHT_STATUS, 'status', '');
273
            $options['0'] = _ADSLIGHT_ACTIVE;
274
            $options['1'] = _ADSLIGHT_INACTIVE;
275
            $radio->addOptionArray($options);
276
            $form->addElement($radio, true);
277
        } else {
278
            $form->addElement(new XoopsFormHidden('status', '0'), true);
279
        }
280
281 View Code Duplication
        if ($premium == 1) {
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...
282
            $form->addElement(new XoopsFormText(_ADSLIGHT_HOW_LONG, 'expire', 3, 3, $xoopsModuleConfig['adslight_howlong']), true);
283
        } else {
284
            $form->addElement(new XoopsFormLabel(_ADSLIGHT_WILL_LAST, $xoopsModuleConfig['adslight_howlong']));
285
            $form->addElement(new XoopsFormHidden('expire', $xoopsModuleConfig['adslight_howlong']), false);
286
        }
287
288
        /// Type d'annonce
289
        $type_form = new XoopsFormSelect(_ADSLIGHT_TYPE, 'type', '', '1');
290
        while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result)) {
291
            $type_form->addOption($nom_type, $id_type);
292
        }
293
        /// Etat de l'objet
294
        $usure_form = new XoopsFormSelect(_ADSLIGHT_TYPE_USURE, 'typeusure', '', '1');
295
        while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result3)) {
296
            $usure_form->addOption($nom_usure, $id_usure);
297
        }
298
299
        $form->addElement($type_form, true);
300
        $form->addElement($usure_form, true);
301
302
        $form->addElement(new XoopsFormText(_ADSLIGHT_TITLE2, 'title', 40, 50, ''), true);
303
        $form->addElement(adslight_getEditor(_ADSLIGHT_DESC, 'desctext', '', 5, 40), true);
304
        $form->addElement(new XoopsFormText(_ADSLIGHT_PRICE2, 'price', 40, 50, ''), true);
305
306
        /// Type de prix
307
        $sel_form = new XoopsFormSelect(_ADSLIGHT_PRICETYPE, 'typeprice', '', '1');
308
        while (list($nom_price, $id_price) = $xoopsDB->fetchRow($result1)) {
309
            $sel_form->addOption($nom_price, $id_price);
310
        }
311
312
        $form->addElement($sel_form);
313
314
        $contactby_form = new XoopsFormSelect(_ADSLIGHT_CONTACTBY, 'contactby', '', '1');
315
        $contactby_form->addOption(1, _ADSLIGHT_CONTACT_BY_EMAIL);
316
        $contactby_form->addOption(2, _ADSLIGHT_CONTACT_BY_PM);
317
        $contactby_form->addOption(3, _ADSLIGHT_CONTACT_BY_BOTH);
318
        $contactby_form->addOption(4, _ADSLIGHT_CONTACT_BY_PHONE);
319
        $form->addElement($contactby_form, true);
320
        $form->addElement(new XoopsFormRadioYN(_ADSLIGHT_ADD_PHOTO_NOW, 'addphotonow', 1));
321
322
        //if ($xoopsModuleConfig["adslight_use_captcha"] == '1') {
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
323
        //  $form->addElement(new XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, "xoopscaptcha", false), true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
324
        //}
325
326 View Code Duplication
        if ($premium != '0') {
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...
327
            $form->addElement(new XoopsFormHidden('premium', 'yes'), false);
328
        } else {
329
            $form->addElement(new XoopsFormHidden('premium', 'no'), false);
330
        }
331
332 View Code Duplication
        if ($cat_moderate == '1') {
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...
333
            $form->addElement(new XoopsFormHidden('valid', 'No'), false);
334
            $form->addElement(new XoopsFormHidden('cat_moderate', '1'), false);
335
        } else {
336
            $form->addElement(new XoopsFormHidden('valid', 'Yes'), false);
337
        }
338
        $form->addElement(new XoopsFormHidden('usid', $member_usid), false);
339
        $form->addElement(new XoopsFormHidden('date', time()), false);
340
        $form->addElement(new XoopsFormButton('', 'submit', _ADSLIGHT_SUBMIT, 'submit'));
341
        $form->display();
342
        $xoopsTpl->assign('submit_form', ob_get_contents());
343
        ob_end_clean();
344
    } else {    // User can't see any category
345
        redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
346
    }
347
    include XOOPS_ROOT_PATH . '/footer.php';
348
}
349