Issues (149)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

admin/customer.php (18 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
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
/**
13
 * Module: Equipment
14
 *
15
 * @category        Module
16
 * @package         equipment
17
 * @author          swt02026 (https://github.com/swt02026/)
18
 * @author          XOOPS Development Team <http://xoops.org>
19
 * @copyright       {@link https://xoops.org/ XOOPS Project}
20
 * @license         GPL 2.0 or later
21
 * @link            https://xoops.org/
22
 * @since           1.0.0
23
 */
24
25
use Xmf\Module\Admin;
26
use Xmf\Database\Tables;
27
use Xmf\Debug;
28
use Xmf\Module\Helper;
29
use Xmf\Module\Helper\Permission;
30
use Xmf\Request;
31
32
require_once __DIR__ . '/admin_header.php';
33
xoops_cp_header();
34
//It recovered the value of argument op in URL$
35
$op    = Request::getString('op', 'list');
36
$order = Request::getString('order', 'desc');
37
$sort  = Request::getString('sort', '');
38
39
$adminObject->displayNavigation(basename(__FILE__));
40
/** @var Permission $permHelper */
41
$permHelper = new Permission($moduleDirName);
42
$uploadDir  = XOOPS_UPLOAD_PATH . '/equipment/images/';
43
$uploadUrl  = XOOPS_UPLOAD_URL . '/equipment/images/';
44
45
switch ($op) {
46
    case 'list':
47
    default:
48
        $adminObject->addItemButton(AM_EQUIPMENT_ADD_CUSTOMER, 'customer.php?op=new', 'add');
49
        echo $adminObject->displayButton('left');
50
        $start                   = Request::getInt('start', 0);
51
        $customerPaginationLimit = $GLOBALS['xoopsModuleConfig']['userpager'];
52
53
        $criteria = new CriteriaCompo();
54
        $criteria->setSort('id ASC, last');
55
        $criteria->setOrder('ASC');
56
        $criteria->setLimit($customerPaginationLimit);
57
        $criteria->setStart($start);
58
        $customerTempRows  = $customerHandler->getCount();
59
        $customerTempArray = $customerHandler->getAll($criteria);/*
60
//
61
// 
62
                    <th class='center width5'>".AM_EQUIPMENT_FORM_ACTION."</th>
63
//                    </tr>";
64
//            $class = "odd";
65
*/
66
67
        // Display Page Navigation
68 View Code Duplication
        if ($customerTempRows > $customerPaginationLimit) {
0 ignored issues
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...
69
            require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
70
71
            $pagenav = new XoopsPageNav($customerTempRows, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
72
            $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
73
        }
74
75
        $GLOBALS['xoopsTpl']->assign('customerRows', $customerTempRows);
76
        $customerArray = array();
77
78
        //    $fields = explode('|', id:int:8::NOT NULL::primary:ID|first:varchar:30::NOT NULL::unique:First Name|last:varchar:50::NOT NULL::unique:Last Name|address:varchar:100::NOT NULL::unique:Address|city:varchar:100::NOT NULL:::City|country:varchar:20::NOT NULL:::Country|created:datetime:::NOT NULL:::Since);
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...
79
        //    $fieldsCount    = count($fields);
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...
80
81
        $criteria = new CriteriaCompo();
82
83
        //$criteria->setOrder('DESC');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
84
        $criteria->setSort($sort);
85
        $criteria->setOrder($order);
86
        $criteria->setLimit($customerPaginationLimit);
87
        $criteria->setStart($start);
88
89
        $customerCount     = $customerHandler->getCount($criteria);
90
        $customerTempArray = $customerHandler->getAll($criteria);
91
92
        //    for ($i = 0; $i < $fieldsCount; ++$i) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% 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...
93
        if ($customerCount > 0) {
94
            foreach (array_keys($customerTempArray) as $i) {
95
96
97
                //        $field = explode(':', $fields[$i]);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% 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...
98
99
                $selectorid = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_ID, 'id');
100
                $GLOBALS['xoopsTpl']->assign('selectorid', $selectorid);
101
                $customerArray['id'] = $customerTempArray[$i]->getVar('id');
102
103
                $selectorfirst = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_FIRST, 'first');
104
                $GLOBALS['xoopsTpl']->assign('selectorfirst', $selectorfirst);
105
                $customerArray['first'] = $customerTempArray[$i]->getVar('first');
106
107
                $selectorlast = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_LAST, 'last');
108
                $GLOBALS['xoopsTpl']->assign('selectorlast', $selectorlast);
109
                $customerArray['last'] = $customerTempArray[$i]->getVar('last');
110
111
                $selectoraddress = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_ADDRESS, 'address');
112
                $GLOBALS['xoopsTpl']->assign('selectoraddress', $selectoraddress);
113
                $customerArray['address'] = $customerTempArray[$i]->getVar('address');
114
115
                $selectorcity = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_CITY, 'city');
116
                $GLOBALS['xoopsTpl']->assign('selectorcity', $selectorcity);
117
                $customerArray['city'] = $customerTempArray[$i]->getVar('city');
118
119
                $selectorcountry = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_COUNTRY, 'country');
120
                $GLOBALS['xoopsTpl']->assign('selectorcountry', $selectorcountry);
121
                $customerArray['country'] = $customerTempArray[$i]->getVar('country');
122
123
                $selectorcreated = EquipmentUtility::selectSorting(AM_EQUIPMENT_CUSTOMER_CREATED, 'created');
124
                $GLOBALS['xoopsTpl']->assign('selectorcreated', $selectorcreated);
125
                $customerArray['created']     = date(_SHORTDATESTRING, strtotime($customerTempArray[$i]->getVar('created')));
126
                $customerArray['edit_delete'] = "<a href='customer.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
127
               <a href='customer.php?op=delete&id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
128
               <a href='customer.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
129
130
                $GLOBALS['xoopsTpl']->append_by_ref('customerArrays', $customerArray);
131
                unset($customerArray);
132
            }
133
            unset($customerTempArray);
134
            // Display Navigation
135 View Code Duplication
            if ($customerCount > $customerPaginationLimit) {
0 ignored issues
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...
136
                require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
137
                $pagenav = new XoopsPageNav($customerCount, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
138
                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
139
            }
140
141
            //                     echo "<td class='center width5'>
142
143
            //                    <a href='customer.php?op=edit&id=".$i."'><img src=".$pathIcon16."/edit.png alt='"._EDIT."' title='"._EDIT."'></a>
144
            //                    <a href='customer.php?op=delete&id=".$i."'><img src=".$pathIcon16."/delete.png alt='"._DELETE."' title='"._DELETE."'></a>
145
            //                    </td>";
146
147
            //                echo "</tr>";
148
149
            //            }
150
151
            //            echo "</table><br><br>";
152
153
            //        } else {
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...
154
155
            //            echo "<table width='100%' cellspacing='1' class='outer'>
156
157
            //                    <tr>
158
159
            //                     <th class='center width5'>".AM_EQUIPMENT_FORM_ACTION."XXX</th>
160
            //                    </tr><tr><td class='errorMsg' colspan='8'>There are noXXX customer</td></tr>";
161
            //            echo "</table><br><br>";
162
163
            //-------------------------------------------
164
165
            echo $GLOBALS['xoopsTpl']->fetch(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/equipment_admin_customer.tpl');
166
        }
167
168
        break;
169
170 View Code Duplication
    case 'new':
0 ignored issues
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...
171
        $adminObject->addItemButton(AM_EQUIPMENT_CUSTOMER_LIST, 'customer.php', 'list');
172
        echo $adminObject->displayButton('left');
173
174
        $customerObject = $customerHandler->create();
175
        $form           = $customerObject->getForm();
176
        $form->display();
177
        break;
178
179
    case 'save':
180
        if (!$GLOBALS['xoopsSecurity']->check()) {
181
            redirect_header('customer.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
182
        }
183
        if (0 != Request::getInt('id', 0)) {
184
            $customerObject = $customerHandler->get(Request::getInt('id', 0));
185
        } else {
186
            $customerObject = $customerHandler->create();
187
        }
188
        // Form save fields
189
        $customerObject->setVar('first', Request::getVar('first', ''));
190
        $customerObject->setVar('last', Request::getVar('last', ''));
191
        $customerObject->setVar('address', Request::getVar('address', ''));
192
        $customerObject->setVar('city', Request::getVar('city', ''));
193
        $customerObject->setVar('country', Request::getVar('country', ''));
194
        $customerObject->setVar('created', $_REQUEST['created']);
195
        //Permissions
196
        //===============================================================
197
198
        $mid = $GLOBALS['xoopsModule']->mid();
199
        /** @var XoopsGroupPermHandler $gpermHandler */
200
        $gpermHandler = xoops_getHandler('groupperm');
201
        $id           = Request::getInt('id', 0);
202
203
        /**
204
         * @param $myArray
205
         * @param $permissionGroup
206
         * @param $id
207
         * @param $gpermHandler
208
         * @param $permissionName
209
         * @param $mid
210
         */
211 View Code Duplication
        function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid)
0 ignored issues
show
The parameter $permissionGroup is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
This function seems to be duplicated in 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...
212
        {
213
            $permissionArray = $myArray;
214
            if ($id > 0) {
215
                $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name` = '" . $permissionName . "' AND `gperm_itemid`= $id;";
216
                $GLOBALS['xoopsDB']->query($sql);
217
            }
218
            //admin
219
            $gperm = $gpermHandler->create();
220
            $gperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
221
            $gperm->setVar('gperm_name', $permissionName);
222
            $gperm->setVar('gperm_modid', $mid);
223
            $gperm->setVar('gperm_itemid', $id);
224
            $gpermHandler->insert($gperm);
225
            unset($gperm);
226
            //non-Admin groups
227
            if (is_array($permissionArray)) {
228
                foreach ($permissionArray as $key => $cat_groupperm) {
229
                    if ($cat_groupperm > 0) {
230
                        $gperm = $gpermHandler->create();
231
                        $gperm->setVar('gperm_groupid', $cat_groupperm);
232
                        $gperm->setVar('gperm_name', $permissionName);
233
                        $gperm->setVar('gperm_modid', $mid);
234
                        $gperm->setVar('gperm_itemid', $id);
235
                        $gpermHandler->insert($gperm);
236
                        unset($gperm);
237
                    }
238
                }
239
            } elseif ($permissionArray > 0) {
240
                $gperm = $gpermHandler->create();
241
                $gperm->setVar('gperm_groupid', $permissionArray);
242
                $gperm->setVar('gperm_name', $permissionName);
243
                $gperm->setVar('gperm_modid', $mid);
244
                $gperm->setVar('gperm_itemid', $id);
245
                $gpermHandler->insert($gperm);
246
                unset($gperm);
247
            }
248
        }
249
250
        //setPermissions for View items
251
        $permissionGroup   = 'groupsRead';
252
        $permissionName    = 'equipment_view';
253
        $permissionArray   = Request::getArray($permissionGroup, '');
254
        $permissionArray[] = XOOPS_GROUP_ADMIN;
255
        //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
256
        $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
257
258
        //setPermissions for Submit items
259
        $permissionGroup   = 'groupsSubmit';
260
        $permissionName    = 'equipment_submit';
261
        $permissionArray   = Request::getArray($permissionGroup, '');
262
        $permissionArray[] = XOOPS_GROUP_ADMIN;
263
        //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
264
        $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
265
266
        //setPermissions for Approve items
267
        $permissionGroup   = 'groupsModeration';
268
        $permissionName    = 'equipment_approve';
269
        $permissionArray   = Request::getArray($permissionGroup, '');
270
        $permissionArray[] = XOOPS_GROUP_ADMIN;
271
        //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
272
        $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
273
274
        /*
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...
275
                    //Form equipment_view
276
                    $arr_equipment_view = Request::getArray('cat_gperms_read');
277
                    if ($id > 0) {
278
                        $sql
279
                            =
280
                            'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name`='equipment_view' AND `gperm_itemid`=$id;";
281
                        $GLOBALS['xoopsDB']->query($sql);
282
                    }
283
                    //admin
284
                    $gperm = $gpermHandler->create();
285
                    $gperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
286
                    $gperm->setVar('gperm_name', 'equipment_view');
287
                    $gperm->setVar('gperm_modid', $mid);
288
                    $gperm->setVar('gperm_itemid', $id);
289
                    $gpermHandler->insert($gperm);
290
                    unset($gperm);
291
                    if (is_array($arr_equipment_view)) {
292
                        foreach ($arr_equipment_view as $key => $cat_groupperm) {
293
                            $gperm = $gpermHandler->create();
294
                            $gperm->setVar('gperm_groupid', $cat_groupperm);
295
                            $gperm->setVar('gperm_name', 'equipment_view');
296
                            $gperm->setVar('gperm_modid', $mid);
297
                            $gperm->setVar('gperm_itemid', $id);
298
                            $gpermHandler->insert($gperm);
299
                            unset($gperm);
300
                        }
301
                    } else {
302
                        $gperm = $gpermHandler->create();
303
                        $gperm->setVar('gperm_groupid', $arr_equipment_view);
304
                        $gperm->setVar('gperm_name', 'equipment_view');
305
                        $gperm->setVar('gperm_modid', $mid);
306
                        $gperm->setVar('gperm_itemid', $id);
307
                        $gpermHandler->insert($gperm);
308
                        unset($gperm);
309
                    }
310
        */
311
312
        //===============================================================
313
314
        if ($customerHandler->insert($customerObject)) {
315
            redirect_header('customer.php?op=list', 2, AM_EQUIPMENT_FORMOK);
316
        }
317
318
        echo $customerObject->getHtmlErrors();
319
        $form = $customerObject->getForm();
320
        $form->display();
321
        break;
322
323 View Code Duplication
    case 'edit':
0 ignored issues
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...
324
        $adminObject->addItemButton(AM_EQUIPMENT_ADD_CUSTOMER, 'customer.php?op=new', 'add');
325
        $adminObject->addItemButton(AM_EQUIPMENT_CUSTOMER_LIST, 'customer.php', 'list');
326
        echo $adminObject->displayButton('left');
327
        $customerObject = $customerHandler->get(Request::getString('id', ''));
328
        $form           = $customerObject->getForm();
329
        $form->display();
330
        break;
331
332 View Code Duplication
    case 'delete':
0 ignored issues
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
        $customerObject = $customerHandler->get(Request::getString('id', ''));
334
        if (1 == Request::getInt('ok', 0)) {
335
            if (!$GLOBALS['xoopsSecurity']->check()) {
336
                redirect_header('customer.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
337
            }
338
            if ($customerHandler->delete($customerObject)) {
339
                redirect_header('customer.php', 3, AM_EQUIPMENT_FORMDELOK);
340
            } else {
341
                echo $customerObject->getHtmlErrors();
342
            }
343
        } else {
344
            xoops_confirm(array(
345
                              'ok' => 1,
346
                              'id' => Request::getString('id', ''),
347
                              'op' => 'delete'
348
                          ), Request::getCmd('REQUEST_URI', '', 'SERVER'), sprintf(AM_EQUIPMENT_FORMSUREDEL, $customerObject->getVar('last')));
349
        }
350
        break;
351
352 View Code Duplication
    case 'clone':
0 ignored issues
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...
353
354
        $id_field = Request::getString('id', '');
355
356
        if (EquipmentUtility::cloneRecord('equipment_customer', 'id', $id_field)) {
357
            redirect_header('customer.php', 3, AM_EQUIPMENT_CLONED_OK);
358
        } else {
359
            redirect_header('customer.php', 3, AM_EQUIPMENT_CLONED_FAILED);
360
        }
361
362
        break;
363
}
364
require_once __DIR__ . '/admin_footer.php';
365