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