Issues (608)

Security Analysis    not enabled

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/actions/delivery.php (1 issue)

Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * oledrion
14
 *
15
 * @copyright   {@link https://xoops.org/ XOOPS Project}
16
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
17
 * @author      Hossein Azizabadi ([email protected])
18
 */
19
20
use XoopsModules\Oledrion;
21
22
/**
23
 * Check is admin
24
 */
25
if (!defined('OLEDRION_ADMIN')) {
26
    exit();
27
}
28
29
switch ($action) {
30
    case 'default':
31
32
        xoops_cp_header();
33
        $adminObject = \Xmf\Module\Admin::getInstance();
34
        $adminObject->displayNavigation('index.php?op=delivery');
35
36
        $start    = \Xmf\Request::getInt('start', 0, 'GET');
37
        $delivery = [];
38
        $form     = "<form method='post' action='$baseurl' name='frmadddelivery' id='frmadddelivery'><input type='hidden' name='op' id='op' value='delivery'><input type='hidden' name='action' id='action' value='add'><input type='submit' name='btngo' id='btngo' value='"
39
                    . _AM_OLEDRION_ADD_ITEM
40
                    . "'></form>";
41
        echo $form;
42
        //        Oledrion\Utility::htitle(_MI_OLEDRION_ADMENU20, 4);
43
        $delivery = $deliveryHandler->getAllDelivery(new Oledrion\Parameters(['start' => $start, 'limit' => $limit]));
44
45
        $class = '';
46
        echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>";
47
        echo "<tr><th align='center'>" . _AM_OLEDRION_ID . "</th><th align='center'>" . _AM_OLEDRION_DELIVERY_TITLE . "</th><th align='center'>" . _OLEDRION_ONLINE . "</th><th align='center'>" . _AM_OLEDRION_ACTION . '</th></tr>';
48
        foreach ($delivery as $item) {
49
            $id        = $item->getVar('delivery_id');
50
            $class     = ('even' === $class) ? 'odd' : 'even';
51
            $actions   = [];
52
            $actions[] = "<a href='$baseurl?op=delivery&action=edit&id=" . $id . "' title='" . _OLEDRION_EDIT . "'>" . $icons['edit'] . '</a>';
53
            $actions[] = "<a href='$baseurl?op=delivery&action=delete&id=" . $id . "' title='" . _OLEDRION_DELETE . "'" . $conf_msg . '>' . $icons['delete'] . '</a>';
54
            $online    = 1 == $item->getVar('delivery_online') ? _YES : _NO;
55
            echo "<tr class='" . $class . "'>\n";
56
            echo "<td align='center'>" . $id . "</td><td align='center'>" . $item->getVar('delivery_title') . "</td><td align='center'>" . $online . "</td><td align='center'>" . implode(' ', $actions) . "</td>\n";
57
            echo "<tr>\n";
58
        }
59
        $class = ('even' === $class) ? 'odd' : 'even';
60
        echo "<tr class='" . $class . "'>\n";
61
        echo "<td colspan='4' align='center'>" . $form . "</td>\n";
62
        echo "</tr>\n";
63
        echo '</table>';
64
        require_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
65
66
        break;
67
    case 'add':
68
69
    case 'edit':
70
71
        xoops_cp_header();
72
        if ('edit' === $action) {
73
            $title = _AM_OLEDRION_DELIVERY_EDIT;
74
            $id    = \Xmf\Request::getInt('id', 0, 'GET');
75
            if (empty($id)) {
76
                Oledrion\Utility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
77
            }
78
            // Item exits ?
79
            $item = null;
80
            $item = $deliveryHandler->get($id);
81
            if (!is_object($item)) {
82
                Oledrion\Utility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
83
            }
84
            $edit         = true;
85
            $label_submit = _AM_OLEDRION_MODIFY;
86
        } else {
87
            $title        = _AM_OLEDRION_DELIVERY_ADD;
88
            $item         = $deliveryHandler->create(true);
89
            $label_submit = _AM_OLEDRION_ADD;
90
            $edit         = false;
91
        }
92
        $sform = new \XoopsThemeForm($title, 'frmadddelivery', $baseurl);
93
        $sform->addElement(new \XoopsFormHidden('op', 'delivery'));
94
        $sform->addElement(new \XoopsFormHidden('action', 'save'));
95
        $sform->addElement(new \XoopsFormHidden('delivery_id', $item->getVar('delivery_id')));
96
        $sform->addElement(new \XoopsFormText(_AM_OLEDRION_DELIVERY_TITLE, 'delivery_title', 50, 150, $item->getVar('delivery_title', 'e')), true);
97
98
        // Add payment options ************************************************************
99
        $payments = $deliveryPayments = $payments_d = $deliveryPayments_d = [];
100
101
        $criteria = new \Criteria('payment_id', 0, '<>');
102
        $criteria->setSort('payment_title');
103
        $payments = $paymentHandler->getObjects($criteria);
104
        foreach ($payments as $oneitem) {
105
            $payments_d[$oneitem->getVar('payment_id')] = xoops_trim($oneitem->getVar('payment_title'));
106
        }
107
108
        if (empty($payments_d)) {
109
            Oledrion\Utility::redirect(_AM_OLEDRION_DELIVERY_PAYMENTADD, $baseurl, 5);
110
        }
111
112
        if ($edit) {
113
            $criteria = new \CriteriaCompo();
114
            $criteria->add(new \Criteria('dp_delivery', $item->getVar('delivery_id'), '='));
115
            $deliveryPayments = $deliveryPaymentHandler->getObjects($criteria);
116
            foreach ($deliveryPayments as $oneproduct) {
117
                $deliveryPayments_d[] = $oneproduct->getVar('dp_payment');
118
            }
119
        }
120
        $paymentSelect = new \XoopsFormSelect(_AM_OLEDRION_DELIVERY_PAYMENT, 'payments', $deliveryPayments_d, 5, true);
121
        $paymentSelect->addOptionArray($payments_d);
122
        $paymentSelect->setDescription(_AM_OLEDRION_SELECT_HLP);
123
        $sform->addElement($paymentSelect, true);
124
125
        if ('edit' === $action && $item->pictureExists()) {
126
            $pictureTray = new \XoopsFormElementTray(_AM_OLEDRION_CURRENT_PICTURE, '<br>');
127
            $pictureTray->addElement(new \XoopsFormLabel('', "<img src='" . $item->getPictureUrl() . "' alt='' border='0'>"));
128
            $deleteCheckbox = new \XoopsFormCheckBox('', 'delpicture');
129
            $deleteCheckbox->addOption(1, _DELETE);
130
            $pictureTray->addElement($deleteCheckbox);
131
            $sform->addElement($pictureTray);
132
            unset($pictureTray, $deleteCheckbox);
133
        }
134
        $sform->addElement(new \XoopsFormFile(_AM_OLEDRION_PICTURE, 'attachedfile', Oledrion\Utility::getModuleOption('maxuploadsize')), false);
135
        $editor = Oledrion\Utility::getWysiwygForm(_AM_OLEDRION_DESCRIPTION, 'delivery_description', $item->getVar('delivery_description', 'e'), 15, 60, 'description_hidden');
136
        if ($editor) {
0 ignored issues
show
$editor is of type XoopsFormEditor, thus it always evaluated to true.
Loading history...
137
            $sform->addElement($editor, false);
138
        }
139
        $sform->addElement(new \XoopsFormRadioYN(_OLEDRION_ONLINE_HLP, 'delivery_online', $item->getVar('delivery_online')), true);
140
        $buttonTray = new \XoopsFormElementTray('', '');
141
        $submit_btn = new \XoopsFormButton('', 'post', $label_submit, 'submit');
142
        $buttonTray->addElement($submit_btn);
143
        $sform->addElement($buttonTray);
144
        $sform = Oledrion\Utility::formMarkRequiredFields($sform);
145
        $sform->display();
146
        require_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
147
148
        break;
149
    case 'save':
150
151
        xoops_cp_header();
152
        $id = \Xmf\Request::getInt('delivery_id', 0, 'POST');
153
        if (!empty($id)) {
154
            $edit = true;
155
            $item = $deliveryHandler->get($id);
156
            if (!is_object($item)) {
157
                Oledrion\Utility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
158
            }
159
            $item->unsetNew();
160
        } else {
161
            $item = $deliveryHandler->create(true);
162
        }
163
        $opRedirect = 'delivery';
164
        $item->setVars($_POST);
165
        if (\Xmf\Request::hasVar('delpicture') && 1 == \Xmf\Request::getInt('delpicture', 0, 'POST')) {
166
            $item->deletePicture();
167
        }
168
        $destname = '';
169
        $res1     = Oledrion\Utility::uploadFile(0, OLEDRION_PICTURES_PATH);
170
        if ($res1) {
171
            if (Oledrion\Utility::getModuleOption('resize_others')) {
172
                // Eventuellement on redimensionne l'image
173
                Oledrion\Utility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, Oledrion\Utility::getModuleOption('images_width'), Oledrion\Utility::getModuleOption('images_height'), true);
174
            }
175
            $item->setVar('delivery_image', basename($destname));
176
        } else {
177
            if (false !== $res1) {
178
                echo $res1;
179
            }
180
        }
181
        $res = $deliveryHandler->insert($item);
182
183
        $delivery_id = $item->getVar('delivery_id');
184
185
        // Save payments for each delivery type
186
        if ($edit) {
187
            // Suppression préalable
188
            $criteria = new \CriteriaCompo();
189
            $criteria->add(new \Criteria('dp_delivery', $delivery_id, '='));
190
            $deliveryPaymentHandler->deleteAll($criteria);
191
        }
192
        if (\Xmf\Request::hasVar('payments', 'POST')) {
193
            foreach ($_POST['payments'] as $id2) {
194
                $item2 = $deliveryPaymentHandler->create(true);
195
                $item2->setVar('dp_delivery', $delivery_id);
196
                $item2->setVar('dp_payment', (int)$id2);
197
                $res1 = $deliveryPaymentHandler->insert($item2);
198
            }
199
        }
200
201
        if ($res) {
202
            Oledrion\Utility::updateCache();
203
            Oledrion\Utility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
204
        } else {
205
            Oledrion\Utility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
206
        }
207
208
        break;
209
    case 'delete':
210
211
        xoops_cp_header();
212
        $id = \Xmf\Request::getInt('id', 0, 'GET');
213
        if (0 == $id) {
214
            Oledrion\Utility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
215
        }
216
        $delivery = null;
217
        $delivery = $deliveryHandler->get($id);
218
        if (!is_object($delivery)) {
219
            Oledrion\Utility::redirect(_AM_OLEDRION_ERROR_10, $baseurl, 5);
220
        }
221
        $msg = sprintf(_AM_OLEDRION_CONF_DEL_ITEM, $delivery->getVar('delivery_title'));
222
        xoops_confirm(['op' => 'delivery', 'action' => 'confdelete', 'id' => $id], 'index.php', $msg);
223
224
        break;
225
    case 'confdelete':
226
227
        xoops_cp_header();
228
        $id = \Xmf\Request::getInt('id', 0, 'POST');
229
        if (empty($id)) {
230
            Oledrion\Utility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
231
        }
232
        $opRedirect = 'delivery';
233
234
        $item = null;
235
        $item = $deliveryHandler->get($id);
236
        if (is_object($item)) {
237
            //Delete delivery payment info
238
            $criteria = new \CriteriaCompo();
239
            $criteria->add(new \Criteria('dp_delivery', $item->getVar('delivery_id')));
240
            $deliveryPaymentHandler->deleteAll($criteria);
241
            // Delete delivery
242
            $res = $deliveryHandler->delete($item);
243
            if ($res) {
244
                Oledrion\Utility::updateCache();
245
                Oledrion\Utility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
246
            } else {
247
                Oledrion\Utility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
248
            }
249
        } else {
250
            Oledrion\Utility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
251
        }
252
253
        break;
254
}
255