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.

caddy.php (4 issues)

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      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 */
19
20
use XoopsModules\Oledrion;
21
22
/**
23
 * Affichage et gestion du caddy
24
 */
25
require_once __DIR__ . '/header.php';
26
$GLOBALS['current_category']             = -1;
27
$GLOBALS['xoopsOption']['template_main'] = 'oledrion_caddy.tpl';
28
require_once XOOPS_ROOT_PATH . '/header.php';
29
// require_once OLEDRION_PATH . 'class/Registryfile.php';
30
31
$xoopsTpl->assign('mod_pref', $mod_pref); // Module Preferences
32
33
if (Oledrion\Utility::getModuleOption('restrict_orders', false)) {
34
    $registry = new Oledrion\Registryfile();
35
    $text     = $registry->getfile(OLEDRION_TEXTFILE5);
36
    $xoopsTpl->assign('restrict_orders_text', xoops_trim($text));
37
} else {
38
    $xoopsTpl->assign('restrict_orders_text', '');
39
}
40
41
$op = \Xmf\Request::getCmd('op', 'default');
42
43
$productId = 0;
44
if (\Xmf\Request::hasVar('product_id', 'POST')) {
45
    $productId = \Xmf\Request::getInt('product_id', 0, 'POST');
46
} elseif (\Xmf\Request::hasVar('product_id', 'GET')) {
47
    $productId = \Xmf\Request::getInt('product_id', 0, 'GET');
48
}
49
50
$xoopsTpl->assign('op', $op);
51
$xoopsTpl->assign('confEmpty', Oledrion\Utility::javascriptLinkConfirm(_OLEDRION_EMPTY_CART_SURE, true));
52
$xoopsTpl->assign('confirm_delete_item', Oledrion\Utility::javascriptLinkConfirm(_OLEDRION_EMPTY_ITEM_SURE, false));
53
54
$uid = Oledrion\Utility::getCurrentUserID();
55
if ($uid > 0) {
56
    $xoopsTpl->assign('isCartExists', $persistentCartHandler->isCartExists());
57
} else {
58
    $xoopsTpl->assign('isCartExists', false);
59
}
60
61
// ********************************************************************************************************************
62
// Liste le contenu du caddy
63
// ********************************************************************************************************************
64
function listCart()
65
{
66
    global $xoopsTpl, $uid;
67
    $cartForTemplate = $discountsDescription = [];
68
    $emptyCart       = false;
69
    $shippingAmount  = $commandAmount = $vatAmount = $commandAmountTTC = $discountsCount = $ecotaxeAmount = $discountAmount = $totalSavings = 0;
0 ignored issues
show
The assignment to $ecotaxeAmount is dead and can be removed.
Loading history...
The assignment to $totalSavings is dead and can be removed.
Loading history...
The assignment to $discountAmount is dead and can be removed.
Loading history...
70
    $goOn            = '';
71
    $reductions      = new Oledrion\Reductions();
72
    $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount, $checkoutAttributes, $ecotaxeAmount = null, $discountAmount = null, $totalSavings = null);
0 ignored issues
show
The call to XoopsModules\Oledrion\Reductions::computeCart() has too many arguments starting with $ecotaxeAmount = null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

72
    $reductions->/** @scrutinizer ignore-call */ 
73
                 computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount, $checkoutAttributes, $ecotaxeAmount = null, $discountAmount = null, $totalSavings = null);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
73
    $oledrionCurrency = Oledrion\Currency::getInstance();
74
    $xoopsTpl->assign('emptyCart', $emptyCart);                                            // Caddy Vide ?
75
    $xoopsTpl->assign('caddieProducts', $cartForTemplate);                                // Produits dans le caddy
76
    $xoopsTpl->assign('shippingAmount', $oledrionCurrency->amountForDisplay($shippingAmount));        // Montant des frais de port
77
    $xoopsTpl->assign('ecotaxeAmount', $oledrionCurrency->amountForDisplay($ecotaxeAmount));        // Montant des frais de port
78
    $xoopsTpl->assign('commandAmount', $oledrionCurrency->amountForDisplay($commandAmount));        // Montant HT de la commande
79
    $xoopsTpl->assign('discountAmount', $oledrionCurrency->amountForDisplay($discountAmount));        // Total Discount
80
    $xoopsTpl->assign('totalSavings', $oledrionCurrency->amountForDisplay($totalSavings));        // Total Savings
81
    $xoopsTpl->assign('vatAmount', $oledrionCurrency->amountForDisplay($vatAmount));                // Montant de la TVA
82
    $xoopsTpl->assign('discountsCount', $discountsCount);                                // Nombre de réductions appliquées
83
    $xoopsTpl->assign('goOn', $goOn);                                                    // Adresse à utiliser pour continuer ses achats
84
    $xoopsTpl->assign('commandAmountTTC', $oledrionCurrency->amountForDisplay($commandAmountTTC));    // Montant TTC de la commande
85
    $xoopsTpl->assign('commandAmountTTC_long', $oledrionCurrency->amountForDisplay($commandAmountTTC, 'l'));    // Montant TTC de la commande
86
    $xoopsTpl->assign('discountsDescription', $discountsDescription);                    // Liste des réductions accordées
87
    $xoopsTpl->assign('checkoutAttributes', $checkoutAttributes);
88
    $showOrderButton   = true;
89
    $showRegistredOnly = false;
90
    if (0 == $uid && Oledrion\Utility::getModuleOption('restrict_orders', false)) {
91
        $showRegistredOnly = true;
92
        $showOrderButton   = false;
93
    }
94
    $xoopsTpl->assign('showRegistredOnly', $showRegistredOnly);
95
    $xoopsTpl->assign('showOrderButton', $showOrderButton);
96
}
97
98
// ********************************************************************************************************************
99
// ********************************************************************************************************************
100
// ********************************************************************************************************************
101
switch ($op) {
102
    // ****************************************************************************************************************
103
    case 'update': // Recalcul des quantités
104
105
        // ****************************************************************************************************************
106
        $caddyHandler->updateQuantites();
107
        listCart();
108
109
        break;
110
    // ****************************************************************************************************************
111
    case 'reload': // Chargement du dernier panier enregistré
112
113
        // ****************************************************************************************************************
114
        $caddyHandler->reloadPersistentCart();
115
        listCart();
116
117
        break;
118
    // ****************************************************************************************************************
119
    case 'delete': // Suppression d'un élément
120
121
        // ****************************************************************************************************************
122
        $productId--;
123
        $caddyHandler->deleteProduct($productId);
124
        listCart();
125
126
        break;
127
    // ****************************************************************************************************************
128
    case 'addproduct': // Ajout d'un produit
129
130
        // ****************************************************************************************************************
131
        if (0 === $productId) {
132
            Oledrion\Utility::redirect(_OLEDRION_ERROR9, 'index.php', 4);
133
        }
134
        $product = null;
135
        /** @var \XoopsModules\Oledrion\Products $product */
136
        $product = $productsHandler->get($productId);
137
        if (!is_object($product)) {
138
            Oledrion\Utility::redirect(_OLEDRION_ERROR9, 'index.php', 4);
139
        }
140
        if (0 === $product->getVar('product_online')) {
141
            Oledrion\Utility::redirect(_OLEDRION_ERROR2, 'index.php', 4);
142
        }
143
144
        if ($product->getVar('product_stock') - 1 >= 0) {
145
            // Options
146
            $userAttributes = [];
147
            if ($product->productAttributesCount() > 0) {
148
                // Si le produit a des attributs
149
                $productAttributes = [];
150
                // On commence par vérifier que les attributs obligatoires sont renseignés
151
                // It starts by checking if mandatory attributes are filled
152
                if ($product->getProductMandatoryAttributesCount()) {
153
                    $mandatoryFieldsList = [];
154
                    $mandatoryFieldsList = $product->getProductMandatoryFieldsList();
155
                    if (count($mandatoryFieldsList) > 0) {
156
                        $productUrl = $product->getLink();
157
                        foreach ($mandatoryFieldsList as $mandatoryField) {
158
                            $mandatoryFieldKey  = $mandatoryField->getAttributeNameInForm();
159
                            $mandatoryFieldText = $mandatoryField->getVar('attribute_title');
160
                            if (!isset($_POST[$mandatoryFieldKey]) && !$mandatoryField->hasDefaultValue()) {
161
                                Oledrion\Utility::redirect(sprintf(_OLEDRION_MANDATORY_MISSED, $mandatoryFieldText), $productUrl, 4);
162
                            }
163
                        }
164
                    }
165
                }
166
                // Toujours là c'est que le produit a des attributs et qu'ils sont renseignés
167
                //Checks if the product has more options and if they are set
168
                $productAttributes = $product->getProductsAttributesList();
169
                foreach ($productAttributes as $attribute) {
170
                    $nameInForm = $attribute->getAttributeNameInForm();
171
                    if (isset($_POST[$nameInForm])) {
172
                        $userAttributes[$attribute->attribute_id] = $_POST[$nameInForm];
173
                    } else {
174
                        // On va chercher sa valeur par défaut
175
                        if ($attribute->hasDefaultValue()) {
176
                            $userAttributes[$attribute->attribute_id] = $attribute->getAttributeDefaultValue();
177
                        }
178
                    }
179
                }
180
            }
181
            $caddyHandler->addProduct($productId, 1, $userAttributes);
182
            $url = OLEDRION_URL . 'caddy.php';
183
            if (!OLEDRION_CART_BUG) {
184
                header("Location: $url");
185
            } else {
186
                listCart();
187
            }
188
        } else {
189
            Oledrion\Utility::redirect(_OLEDRION_PROBLEM_QTY, 'index.php', 5); // Plus de stock !
190
        }
191
        listCart();
192
193
        break;
194
    // ****************************************************************************************************************
195
    case 'empty': // Suppression du contenu du caddy
196
197
        // ****************************************************************************************************************
198
        $caddyHandler->emptyCart();
199
        listCart();
200
201
        break;
202
    // ****************************************************************************************************************
203
    case 'default': // Action par défaut
204
205
        // ****************************************************************************************************************
206
        listCart();
207
208
        break;
209
}
210
211
// Image icons
212
if (file_exists(OLEDRION_PATH . 'language/' . $xoopsConfig['language'] . '/image/step1.png')) {
213
    $step1 = OLEDRION_URL . 'language/' . $xoopsConfig['language'] . '/image/step1.png';
214
    $step2 = OLEDRION_URL . 'language/' . $xoopsConfig['language'] . '/image/step2.png';
215
    $step3 = OLEDRION_URL . 'language/' . $xoopsConfig['language'] . '/image/step3.png';
216
} else {
217
    // Fallback
218
    $step1 = OLEDRION_URL . 'language/english/image/step1.png';
219
    $step2 = OLEDRION_URL . 'language/english/image/step2.png';
220
    $step3 = OLEDRION_URL . 'language/english/image/step3.png';
221
}
222
$xoopsTpl->assign('step1', $step1);
223
$xoopsTpl->assign('step2', $step2);
224
$xoopsTpl->assign('step3', $step3);
225
226
Oledrion\Utility::setCSS();
227
Oledrion\Utility::setLocalCSS($xoopsConfig['language']);
228
$helper->loadLanguage('modinfo');
229
230
$xoopsTpl->assign('breadcrumb', Oledrion\Utility::breadcrumb([OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME1]));
231
232
$title = _MI_OLEDRION_SMNAME1 . ' - ' . Oledrion\Utility::getModuleName();
233
Oledrion\Utility::setMetas($title, $title);
234
require_once XOOPS_ROOT_PATH . '/footer.php';
235