Issues (330)

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/importglossaire.php (7 issues)

1
<?php
2
//////////////////////////////////////////////////////////////////////////////
3
//
4
// ------------------------------------------------------------------------ //
5
// This program is free software; you can redistribute it and/or modify     //
6
// it under the terms of the GNU General Public License as published by     //
7
// the Free Software Foundation; either version 2 of the License, or        //
8
// (at your option) any later version.                                      //
9
//                                                                          //
10
// This program is distributed in the hope that it will be useful, but      //
11
// WITHOUT ANY WARRANTY; without even the implied warranty of               //
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU         //
13
// General Public License for more details.                                 //
14
//                                                                          //
15
// You should have received a copy of the GNU General Public License        //
16
// along with this program; if not, write to the                            //
17
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,      //
18
// MA 02111-1307 USA                                                        //
19
// ------------------------------------------------------------------------ //
20
// code partially from Aiba and rmdp                                        //
21
// ------------------------------------------------------------------------ //
22
// import script glossaire  -> Lexikon                                      //
23
// ------------------------------------------------------------------------ //
24
//////////////////////////////////////////////////////////////////////////////
25
26
use Xmf\Request;
27
28
require_once __DIR__ . '/admin_header.php';
29
$myts = \MyTextSanitizer::getInstance();
30
$op   = '';
31
32
/****
33
 * Available operations
34
 ****/
35
switch ($op) {
36
    case 'default':
37
    default:
38
        xoops_cp_header();
39
        global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $entryID;
40
        $myts = \MyTextSanitizer::getInstance();
41
}
42
43
/****
44
 * Start Import
45
 ***
46
 * @param $msg
47
 */
48
function showerror($msg)
49
{
50
    global $xoopsDB;
51
    if ('' != $xoopsDB->error()) {
52
        echo '<br>' . $msg . ' <br><span style="font-size: xx-small; "> - ' . _AM_LEXIKON_IMPORT_ERROR . ': ' . $xoopsDB->error() . '</span>.';
53
    } else {
54
        echo '<br>' . $msg . '' . _AM_LEXIKON_IMPORT_OK;
55
    }
56
}
57
58
/**
59
 * @param $text
60
 * @return array|string|string[]|null
61
 */
62
function import2db($text)
63
{
64
    return preg_replace(["/'/i"], ["\'"], $text);
65
}
66
67
/**
68
 * @param $delete
69
 */
70
function DefinitionImport($delete)
0 ignored issues
show
The parameter $delete is not used and could be removed. ( Ignorable by Annotation )

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

70
function DefinitionImport(/** @scrutinizer ignore-unused */ $delete)

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

Loading history...
71
{
72
    global $xoopsConfig, $xoopsDB, $xoopsModule;
73
    $sqlQuery = $xoopsDB->query('SELECT count(id) AS count FROM ' . $xoopsDB->prefix('glossaire'));
74
    [$count] = $xoopsDB->fetchRow($sqlQuery);
75
    if ($count < 1) {
76
        redirect_header('import.php', 1, _AM_LEXIKON_MODULEIMPORTEMPTY10);
77
    }
78
79
    $delete       = 0;
80
    $glocounter   = 0;
81
    $errorcounter = 0;
82
83
    if (isset($delete)) {
84
        $delete = \Xmf\Request::getInt('delete', 0, 'POST');
85
    } else {
86
        if (isset($delete)) {
87
            $delete = \Xmf\Request::getInt('delete', 0, 'POST');
88
        }
89
    }
90
91
    /****
92
     * delete all entries and categories without comments
93
     ****/
94
    if ($delete) {
95
        // delete notifications
96
        xoops_notification_deletebymodule($xoopsModule->getVar('mid'));
97
        //get all entries
98
        $result3 = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . ' ');
99
        //delete comments for each entry
100
        while (list($entryID) = $xoopsDB->fetchRow($result3)) {
101
            xoops_comment_delete($xoopsModule->getVar('mid'), $entryID);
102
        }
103
        $resultC = $xoopsDB->query('SELECT categoryID FROM ' . $xoopsDB->prefix('lxcategories') . ' ');
104
        while (list($categoryID) = $xoopsDB->fetchRow($resultC)) {
105
            // delete permissions
106
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_view', $categoryID);
107
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_submit', $categoryID);
108
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_approve', $categoryID);
109
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_request', $categoryID);
110
        }
111
        // delete everything
112
        $sqlquery1 = $xoopsDB->queryF('TRUNCATE TABLE ' . $xoopsDB->prefix('lxentries'));
0 ignored issues
show
The assignment to $sqlquery1 is dead and can be removed.
Loading history...
113
        $sqlquery2 = $xoopsDB->queryF('TRUNCATE TABLE ' . $xoopsDB->prefix('lxcategories'));
0 ignored issues
show
The assignment to $sqlquery2 is dead and can be removed.
Loading history...
114
    }
115
116
    /****
117
     * Import ENTRIES
118
     ****/
119
    $sqlQuery = $xoopsDB->query(
120
        'SELECT id, lettre, nom, definition, affiche
121
                                  FROM ' . $xoopsDB->prefix('glossaire')
122
    );
123
    $fecha    = time() - 1;
124
    while (false !== ($sqlfetch = $xoopsDB->fetchArray($sqlQuery))) {
125
        $glo               = [];
126
        $glo['id']         = $sqlfetch['id'];
127
        $glo['lettre']     = $sqlfetch['lettre'];
128
        $glo['nom']        = import2db($sqlfetch['nom']);
129
        $glo['definition'] = import2db($sqlfetch['definition']);
130
        $glo['affiche']    = ++$fecha;
131
132
        ++$glocounter;
133
134
        if ($delete) {
135
            $insert = $xoopsDB->queryF(
136
                '
137
                                       INSERT INTO ' . $xoopsDB->prefix('lxentries') . "
138
                                       (entryID, init, term, definition, url, submit, datesub, offline, comments)
139
                                       VALUES ('" . $glo['id'] . "','" . $glo['lettre'] . "','" . $glo['nom'] . "','" . $glo['definition'] . "','','','" . $glo['affiche'] . "','','')"
140
            );
141
        } else {
142
            $insert = $xoopsDB->queryF(
143
                '
144
                                       INSERT INTO ' . $xoopsDB->prefix('lxentries') . "
145
                                       (entryID, init, term, definition, url, submit, datesub, offline, comments)
146
                                       VALUES ('','" . $glo['lettre'] . "','" . $glo['nom'] . "','" . $glo['definition'] . "','','','" . $glo['affiche'] . "','','')"
147
            );
148
        }
149
        if (!$insert) {
150
            ++$errorcounter;
151
            showerror('<br>' . _AM_LEXIKON_IMPORT_ERROR_IMPORT_TERM . ': <span style="color:red">entryID: ' . $glo['id'] . '</span>: ' . $glo['nom'] . ' ...');
152
        }
153
        // update user posts count
154
        if ($ret1) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ret1 seems to be never defined.
Loading history...
155
            if ($uid) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $uid seems to be never defined.
Loading history...
156
                /** @var \XoopsMemberHandler $memberHandler */
157
                $memberHandler = xoops_getHandler('member');
158
                $submitter     = $memberHandler->getUser($uid);
159
                if (is_object($submitter)) {
160
                    $submitter->setVar('posts', $submitter->getVar('posts') + 1);
161
                    $res = $memberHandler->insertUser($submitter, true);
0 ignored issues
show
The assignment to $res is dead and can be removed.
Loading history...
162
                    unset($submitter);
163
                }
164
            }
165
        }
166
    }
167
168
    $sqlQuery = $xoopsDB->query(
169
        '
170
                                SELECT mid
171
                                FROM ' . $xoopsDB->prefix('modules') . "
172
                                WHERE dirname = 'glossaire'"
173
    );
174
    [$gloID] = $xoopsDB->fetchRow($sqlQuery);
175
    echo '<p>' . _AM_LEXIKON_IMPORT_MODULE_ID . ': ' . $gloID . '</p>';
176
    echo '<p>' . _AM_LEXIKON_IMPORT_MODULE_LEX_ID . ': ' . $xoopsModule->getVar('mid') . '<br>';
177
178
    $comentario = $xoopsDB->queryF(
179
        'UPDATE ' . $xoopsDB->prefix('xoopscomments') . "
180
                                   SET com_modid = '" . $xoopsModule->getVar('mid') . "'
181
                                   WHERE  com_modid = '" . $gloID . "'"
182
    );
183
    if (!$comentario) {
184
        showerror(_AM_LEXIKON_IMPORT_ERROR_IMPORT_COMMENT . ':  ...');
185
    } else {
186
        showerror(_AM_LEXIKON_IMPORT_COMMENT . ':  ');
187
    }
188
    echo '<p>' . _AM_LEXIKON_IMPORT_UPDATE_COUNT . '</p>';
189
    echo "<p><span style='color:red'>" . _AM_LEXIKON_IMPORT_INCORRECTLY . ': ' . $errorcounter . '</span></p>';
190
    echo '<p>' . _AM_LEXIKON_IMPORT_PROCESSED . ': ' . $glocounter . '</p>';
191
    echo '<h3>' . _AM_LEXIKON_IMPORT_FINISH . '</h3>';
192
    echo "<br><b><a href='import.php'>" . _AM_LEXIKON_IMPORT_TO_ADMIN . '</a></b><p>';
193
    require_once __DIR__ . '/admin_footer.php';
194
}
195
196
/****
197
 * IMPORT FORM
198
 ****/
199
function FormImport()
200
{
201
    global $xoopsConfig, $xoopsDB, $xoopsModule;
202
    //lx_importMenu(9);
203
    echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_GLOSSAIRE . '</strong><br><br>';
204
    /** @var \XoopsModuleHandler $moduleHandler */
205
    $moduleHandler   = xoops_getHandler('module');
206
    $glossaireModule = $moduleHandler->getByDirname('glossaire');
207
    $got_options     = false;
0 ignored issues
show
The assignment to $got_options is dead and can be removed.
Loading history...
208
    if (is_object($glossaireModule)) {
209
        echo "<table style='width:100%; border:0;' class='outer'>";
210
        echo '<tr>';
211
        echo "<td colspan='2' class='bg3' style='text-align:left;'><span style='font-size: x-small; '><b>" . _AM_LEXIKON_MODULEHEADIMPORTGLO . '</b></span></td>';
212
        echo '</tr>';
213
214
        echo '<tr>';
215
        echo "<td class='head' style='width:200px; text-align:center;'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/assets/images/dialog-important.png' . "' alt='' style='margin-right:10px;  margin-top:20px; text-align:middle;'></td>";
216
        echo "<td class='even' style='text-align:center;'><br><b><span style='font-size:x-small; color:red;'>" . _AM_LEXIKON_IMPORTWARN . '</span></b></td>';
217
        echo '</tr>';
218
219
        echo '<tr>';
220
        echo "<td class='head' style='width:200px; text-align:left'><span style='font-size:x-small;'>" . _AM_LEXIKON_IMPORTDELWB . '</span></td>';
221
        echo "<td class='even' style='text-align:center;'><form action='importdictionary.php?op=import' method=POST>
222
        <input type='radio' name='delete' value='1'>&nbsp;" . _YES . "&nbsp;&nbsp;
223
        <input type='radio' name='delete' value='0' checked>&nbsp;" . _NO . '</td>';
224
        echo "</tr><tr><td class='head' style='width:200px; text-align:center;'>&nbsp;</td>";
225
        echo "<td class='even' style='text-align:center;'>
226
        <input type='submit' name='button' id='import' value='" . _AM_LEXIKON_IMPORT . "'>&nbsp;
227
        <input type='button' name='cancel' value='" . _CANCEL . "' onclick='history.go(-1);'></td>";
228
        echo "</tr></table><br>\n";
229
    } else {
230
        echo "<br><b><span style='color:red'>" . _AM_LEXIKON_IMPORT_ERROR_MODULE . "</span></b><br><br><a href='import.php'><button>" . _AM_LEXIKON_BACK . '</button></a>';
231
    }
232
    require_once __DIR__ . '/admin_footer.php';
233
}
234
235
global $op;
236
$op = Request::getCmd('op', '');
237
switch ($op) {
238
    case 'import':
239
        $delete = \Xmf\Request::getInt('delete', \Xmf\Request::getInt('delete', 0, 'POST'), 'GET');
240
        DefinitionImport($delete);
241
        break;
242
    default:
243
        FormImport();
244
        break;
245
}
246