Completed
Push — master ( deac0a...054aa6 )
by Michael
01:55
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
use Xmf\Request;
23
24
require_once __DIR__ . '/header.php';
25
$myts = MyTextSanitizer::getInstance();// MyTextSanitizer object
26
//require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
27
include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
28
//require_once __DIR__ . '/include/functions.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% 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...
29
// require_once XOOPS_ROOT_PATH . '/class/captcha/xoopscaptcha.php';
30
31
$module_id = $xoopsModule->getVar('mid');
32
$groups    = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
0 ignored issues
show
The class XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
33
/** @var XoopsGroupPermHandler $gpermHandler */
34
$gpermHandler = xoops_getHandler('groupperm');
35
$perm_itemid  = Request::getInt('item_id', 0, 'POST');
36
37
if (!$gpermHandler->checkRight('adslight_submit', $perm_itemid, $groups, $module_id)) {
38
    redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
39
}
40
41
$premium = $gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id) ? 1 : 0;
42
43
//require_once XOOPS_ROOT_PATH . '/modules/adslight/class/utility.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% 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...
44
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
45
require_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
46
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
47
48 View Code Duplication
if (!$GLOBALS['xoopsUser'] instanceof XoopsUser) {
0 ignored issues
show
The class XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
49
    redirect_header(XOOPS_URL . '/user.php', 2, _MA_ADSLIGHT_MUSTREGFIRST);
50
}
51
52
if (Request::hasVar('submit', 'POST')) {
53
    $howlong = $GLOBALS['xoopsModuleConfig']['adslight_howlong'];
54
55 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check(true, $_REQUEST['token'])) {
56
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
57
    }
58
59
    //    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...
60
    //    $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...
61
    //    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...
62
    //        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...
63
    //    }
64
    if (Request::hasVar('submit', 'POST')) {
65
        $moduleHandler = xoops_getHandler('module');
66
        $myModule      = $moduleHandler->getByDirname('adslight');
67
        $myModule->setErrors('Could not connect to the database.');
68
    }
69
70
    $cid       = Request::getInt('cid', 0, 'POST');
71
    $cat_perms = AdslightUtility::getMyItemIds('adslight_submit');
72
    if (!in_array($cid, $cat_perms)) {
73
        redirect_header(XOOPS_URL, 2, _NOPERM);
74
    }
75
76
    $title = Request::getString('title', '', 'POST');
77
    //    $status    = $myts->addSlashes($_POST["status"]);
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...
78
    $status    = (int)$status;
79
    $expire    = Request::getString('expire', '', 'POST');
80
    $type      = Request::getString('type', '', 'POST');
81
    $desctext  = Request::getText('desctext', '', 'POST'); // $myts->displayTarea($_POST['desctext'], 1, 1, 1);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
82
    $tel       = Request::getString('tel', '', 'POST');
83
    $price     = str_replace(array(' '), '', Request::getFloat('price', 0, 'POST'));
84
    $typeprice = Request::getString('typeprice', '', 'POST');
85
    $typeusure = Request::getString('typeusure', '', 'POST');
86
    $date      = Request::getInt('date', 0, 'POST');
87
    $email     = Request::getString('email', '', 'POST');
88
    $submitter = Request::getString('submitter', '', 'POST');
89
    $usid      = Request::getString('usid', '', 'POST');
90
    $town      = Request::getString('town', '', 'POST');
91
    $country   = Request::getString('country', 0, 'POST');
92
    $contactby = Request::getString('contactby', '', 'POST');
93
    $premium   = Request::getString('premium', '', 'POST');
94
    $valid     = Request::getString('valid', '', 'POST');
95
    $date      = time();
96
    $newid     = $xoopsDB->genId($xoopsDB->prefix('adslight_listing') . '_lid_seq');
97
98
    $sql     = 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')",
99
                       $xoopsDB->prefix('adslight_listing'), $newid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town,
100
                       $country, $contactby, $premium, $valid);
101
    $success = $xoopsDB->query($sql);
102
    if (!$success) {
103
        $moduleHandler = xoops_getHandler('module');
104
        $myModule      = $moduleHandler->getByDirname('adslight');
105
        $myModule->setErrors('Could not query the database.');
106
    }
107
108
    $lid = $xoopsDB->getInsertId();
109
110
    if ('Yes' === $valid) {
111
        /** @var XoopsNotificationHandler $notificationHandler */
112
        $notificationHandler = xoops_getHandler('notification');
113
        //$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...
114
        $tags                    = array();
115
        $tags['TITLE']           = $title;
116
        $tags['ADDED_TO_CAT']    = _ADSLIGHT_ADDED_TO_CAT;
117
        $tags['RECIEVING_NOTIF'] = _ADSLIGHT_RECIEVING_NOTIF;
118
        $tags['ERROR_NOTIF']     = _ADSLIGHT_ERROR_NOTIF;
119
        $tags['WEBMASTER']       = _ADSLIGHT_WEBMASTER;
120
        $tags['HELLO']           = _ADSLIGHT_HELLO;
121
        $tags['FOLLOW_LINK']     = _ADSLIGHT_FOLLOW_LINK;
122
        $tags['TYPE']            = AdslightUtility::getNameType($type);
123
        $tags['LINK_URL']        = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid;
124
        $sql                     = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid);
125
        $result2                 = $xoopsDB->query($sql);
126
        $row                     = $xoopsDB->fetchArray($result2);
127
        $tags['CATEGORY_TITLE']  = $row['title'];
128
        $tags['CATEGORY_URL']    = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cid);
129
        /** @var XoopsNotificationHandler $notificationHandler */
130
        $notificationHandler = xoops_getHandler('notification');
131
        $notificationHandler->triggerEvent('global', 0, 'new_listing', $tags);
132
        $notificationHandler->triggerEvent('category', $cid, 'new_listing', $tags);
133
        $notificationHandler->triggerEvent('listing', $lid, 'new_listing', $tags);
134
    } else {
135
        $tags                   = array();
136
        $subject                = '' . _ADSLIGHT_NEW_WAITING_SUBJECT . '';
137
        $tags['TITLE']          = $title;
138
        $tags['DESCTEXT']       = $desctext;
139
        $tags['ADMIN']          = _ADSLIGHT_ADMIN;
140
        $tags['NEW_WAITING']    = _ADSLIGHT_NEW_WAITING;
141
        $tags['PLEASE_CHECK']   = _ADSLIGHT_PLEASE_CHECK;
142
        $tags['WEBMASTER']      = _ADSLIGHT_WEBMASTER;
143
        $tags['HELLO']          = _ADSLIGHT_HELLO;
144
        $tags['FOLLOW_LINK']    = _ADSLIGHT_FOLLOW_LINK;
145
        $tags['TYPE']           = AdslightUtility::getNameType($type);
146
        $tags['NEED_TO_LOGIN']  = _ADSLIGHT_NEED_TO_LOGIN;
147
        $tags['ADMIN_LINK']     = XOOPS_URL . '/modules/adslight/admin/validate_ads.php';
148
        $sql                    = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid);
149
        $result2                = $xoopsDB->query($sql);
150
        $row                    = $xoopsDB->fetchArray($result2);
151
        $tags['CATEGORY_TITLE'] = $row['title'];
152
        $tags['NEWAD']          = _ADSLIGHT_NEWAD;
153
154
        $mail = xoops_getMailer();
155
        //@todo - add check to see if directory (and file) exists, otherwise use english
156
        $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/adslight/language/' . $xoopsConfig['language'] . '/mail_template/');
157
        $mail->setTemplate('listing_notify_admin.tpl');
158
        $mail->useMail();
159
        $mail->multimailer->isHTML(true);
160
        $mail->setFromName($xoopsConfig['sitename']);
161
        $mail->setFromEmail($xoopsConfig['adminmail']);
162
        $mail->setToEmails($xoopsConfig['adminmail']);
163
        $mail->setSubject($subject);
164
        $mail->assign($tags);
165
        $mail->send();
166
        echo $mail->getErrors();
167
    }
168
169
    $addphotonow = Request::getInt('addphotonow', 0, 'POST');
170 View Code Duplication
    if ($addphotonow) {
171
        //$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...
172
        redirect_header("view_photos.php?lid=$lid&uid=$usid", 3, _ADSLIGHT_ADSADDED);
173
    } else {
174
        redirect_header('index.php', 3, _ADSLIGHT_ADSADDED);
175
    }
176
} else {
177
    $GLOBALS['xoopsOption']['template_main'] = 'adslight_addlisting.tpl';
178
    include XOOPS_ROOT_PATH . '/header.php';
179
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
180
181
    $cid          = Request::getInt('cide', 0, 'GET');
182
    $cat_moderate = Request::getInt('cat_moderate', 0, 'POST');
183
    $howlong      = $GLOBALS['xoopsModuleConfig']['adslight_howlong'];
184
    $member_usid  = $GLOBALS['xoopsUser']->getVar('uid', 'E');
185
    $member_email = $GLOBALS['xoopsUser']->getVar('email', 'E');
186
    $member_uname = $GLOBALS['xoopsUser']->getVar('uname', 'E');
187
188
    $result  = $xoopsDB->query('SELECT id_type, nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type');
189
    $result1 = $xoopsDB->query('SELECT id_price, nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY id_price');
190
    $result3 = $xoopsDB->query('SELECT id_usure, nom_usure FROM ' . $xoopsDB->prefix('adslight_usure') . ' ORDER BY id_usure');
191
192
    ob_start();
193
    $form = new XoopsThemeForm(_ADSLIGHT_ADD_LISTING, 'submitform', 'add.php', 'post', true);
194
    $form->setExtra('enctype="multipart/form-data"');
195
196
//    $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__, 1800, 'token');
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
197
198
    //@todo - this 'if' code doesn't do anything, what should happen for premium accounts?
199
    if ($cat_moderate) {
200
        if ($premium != '0') {
201
            echo '';
202
        } else {
203
            echo '';
204
        }
205
    } else {
206
        if ($premium != '0') {
207
            echo '';
208
        } else {
209
            echo '';
210
        }
211
    }
212
213 View Code Duplication
    if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_diff_name']) {
214
        $form->addElement(new XoopsFormText(_ADSLIGHT_SUBMITTER, 'submitter', 50, 50, $member_uname), true);
215
    } else {
216
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_SUBMITTER, $member_uname));
217
        $form->addElement(new XoopsFormHidden('submitter', $member_uname), true);
218
    }
219 View Code Duplication
    if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_diff_email']) {
220
        $form->addElement(new XoopsFormText(_ADSLIGHT_EMAIL, 'email', 50, 50, $member_email), true);
221
    } else {
222
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_EMAIL, $member_email));
223
        $form->addElement(new XoopsFormHidden('email', $member_email), true);
224
    }
225
    $form->addElement(new XoopsFormText(_ADSLIGHT_TOWN, 'town', 50, 50, ''), false);
226 View Code Duplication
    if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_country']) {
227
        $form->addElement(new XoopsFormText(_ADSLIGHT_COUNTRY, 'country', 50, 50, ''), false);
228
    } else {
229
        $form->addElement(new XoopsFormHidden('country', ''), false);
230
    }
231
    $form->addElement(new XoopsFormText(_ADSLIGHT_TEL, 'tel', 50, 50, ''), false);
232
233
    // $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...
234
    $cid       = 1;
235
    $cat_perms = AdslightUtility::getMyItemIds('adslight_submit');
236
    if (is_array($cat_perms) && count($cat_perms) > 0) {
237
        if (!in_array($cid, $cat_perms)) {
238
            redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM);
239
        }
240
241
        // Category select box
242
        ob_start();
243
        $mytree->makeMySelBox('title', 'title', $cid, 'cid');
244
        $form->addElement(new XoopsFormLabel(_ADSLIGHT_CAT3, ob_get_contents()), true);
245
        ob_end_clean();
246
247
        $category = $xoopsDB->query('SELECT title, cat_moderate FROM ' . $xoopsDB->prefix('adslight_categories') . " WHERE cid='" . $xoopsDB->escape($cid) . "'");
248
249
        list($cat_title, $cat_moderate) = $xoopsDB->fetchRow($category);
250
251
        if ('1' == $premium) {
252
            $radio        = new XoopsFormRadio(_ADSLIGHT_STATUS, 'status', '');
253
            $options['0'] = _ADSLIGHT_ACTIVE;
254
            $options['1'] = _ADSLIGHT_INACTIVE;
255
            $radio->addOptionArray($options);
256
            $form->addElement($radio, true);
257
        } else {
258
            $form->addElement(new XoopsFormHidden('status', '0'), true);
259
        }
260
261
        if ($premium == 1) {
262
            $form->addElement(new XoopsFormText(_ADSLIGHT_HOW_LONG, 'expire', 3, 3, $GLOBALS['xoopsModuleConfig']['adslight_howlong']), true);
263
        } else {
264
            $form->addElement(new XoopsFormLabel(_ADSLIGHT_WILL_LAST, $GLOBALS['xoopsModuleConfig']['adslight_howlong']));
265
            $form->addElement(new XoopsFormHidden('expire', $GLOBALS['xoopsModuleConfig']['adslight_howlong']), false);
266
        }
267
268
        // Type
269
        $type_form = new XoopsFormSelect(_ADSLIGHT_TYPE, 'type', '', '1');
270
        while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result)) {
271
            $type_form->addOption($nom_type, $id_type);
272
        }
273
274
        // State of Object
275
        $usure_form = new XoopsFormSelect(_ADSLIGHT_TYPE_USURE, 'typeusure', '', '1');
276
        while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result3)) {
277
            $usure_form->addOption($nom_usure, $id_usure);
278
        }
279
280
        $form->addElement($type_form, true);
281
        $form->addElement($usure_form, true);
282
283
        $form->addElement(new XoopsFormText(_ADSLIGHT_TITLE2, 'title', 40, 50, ''), true);
284
285
        $form->addElement(AdslightUtility::getEditor(_ADSLIGHT_DESC, 'desctext', '', '100%', 40), true);
286
287
        //        $form->addElement(new XoopsFormEditor(_ADSLIGHT_DESC, $GLOBALS['xoopsModuleConfig']['adslightEditorUser'], $options, $nohtml = FALSE, $onfailure = 'textarea'));
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% 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...
288
        //        $optionsTrayNote->addElement($bodynote);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
289
290
        $form->addElement(new XoopsFormText(_ADSLIGHT_PRICE2, 'price', 40, 50, ''), true);
291
292
        // Price Type
293
        $sel_form = new XoopsFormSelect(_ADSLIGHT_PRICETYPE, 'typeprice', '', '1');
294
        while (list($nom_price, $id_price) = $xoopsDB->fetchRow($result1)) {
295
            $sel_form->addOption($nom_price, $id_price);
296
        }
297
298
        $form->addElement($sel_form);
299
300
        $contactby_form = new XoopsFormSelect(_ADSLIGHT_CONTACTBY, 'contactby', '', '1');
301
        $contactby_form->addOption(1, _ADSLIGHT_CONTACT_BY_EMAIL);
302
        $contactby_form->addOption(2, _ADSLIGHT_CONTACT_BY_PM);
303
        $contactby_form->addOption(3, _ADSLIGHT_CONTACT_BY_BOTH);
304
        $contactby_form->addOption(4, _ADSLIGHT_CONTACT_BY_PHONE);
305
        $form->addElement($contactby_form, true);
306
        $form->addElement(new XoopsFormRadioYN(_ADSLIGHT_ADD_PHOTO_NOW, 'addphotonow', 1));
307
        /*
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...
308
                if ('1' == $GLOBALS['xoopsModuleConfig']["adslight_use_captcha"]) {
309
                    $form->addElement(new XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, "xoopscaptcha", false), true);
310
                }
311
        */
312 View Code Duplication
        if ('0' != $premium) {
313
            $form->addElement(new XoopsFormHidden('premium', 'yes'), false);
314
        } else {
315
            $form->addElement(new XoopsFormHidden('premium', 'no'), false);
316
        }
317
318 View Code Duplication
        if ('1' == $cat_moderate) {
319
            $form->addElement(new XoopsFormHidden('valid', 'No'), false);
320
            $form->addElement(new XoopsFormHidden('cat_moderate', '1'), false);
321
        } else {
322
            $form->addElement(new XoopsFormHidden('valid', 'Yes'), false);
323
        }
324
        $form->addElement(new XoopsFormHidden('usid', $member_usid), false);
325
        $form->addElement(new XoopsFormHidden('date', time()), false);
326
        $form->addElement(new XoopsFormButton('', 'submit', _ADSLIGHT_SUBMIT, 'submit'));
327
        $form->display();
328
        $xoopsTpl->assign('submit_form', ob_get_contents());
329
        ob_end_clean();
330
    } else {    // User can't see any category
331
        redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM);
332
    }
333
    include XOOPS_ROOT_PATH . '/footer.php';
334
}
335