Issues (807)

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.
Labels
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits of
4
 supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit
6
 authors.
7
8
 This program is distributed in the hope that it will be useful, but
9
 WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * Module: Pedigree
15
 *
16
 * @package   XoopsModules\Pedigree
17
 * @author    XOOPS Module Development Team
18
 * @copyright Copyright (c) 2001-2019 {@link https://xoops.org XOOPS Project}
19
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GNU Public License
20
 */
21
22
use Xmf\Request;
23
use Xmf\Module\Admin;
24
use XoopsModules\Pedigree\{
25
    Utility
26
};
27
28
//require_once  \dirname(__DIR__, 2) . '/mainfile.php';
29
require_once __DIR__ . '/header.php';
30
$moduleDirName = basename(__DIR__);
31
xoops_loadLanguage('main', $moduleDirName);
32
// Include any common code for this module.
33
require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php';
34
35
// Get all HTTP post or get parameters into global variables that are prefixed with "param_"
36
//import_request_variables("gp", "param_");
37
extract($_GET, EXTR_PREFIX_ALL, 'param');
38
extract($_POST, EXTR_PREFIX_ALL, 'param');
39
40
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_dog.tpl';
41
require XOOPS_ROOT_PATH . '/header.php';
42
43
global $xoopsUser, $xoopsTpl, $xoopsDB, $xoopsModuleConfig, $xoopsModule;
44
global $numofcolumns, $numMatch, $pages, $columns, $dogs;
45
46
$pathIcon16 = Admin::iconUrl('', 16);
47
48
xoops_load('XoopsUserUtility');
49
50
//get module configuration
51
/** @var \XoopsModuleHandler $moduleHandler */
52
$moduleHandler = xoops_getHandler('module');
53
$module        = $moduleHandler->getByDirname($moduleDirName);
54
/** @var \XoopsConfigHandler $configHandler */
55
$configHandler = xoops_getHandler('config');
56
$moduleConfig  = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
57
58
$myts = \MyTextSanitizer::getInstance();
59
60
if (isset($_GET['id'])) {
61
    $id = Request::getInt('id', 0, 'GET');
62
} else {
63
    echo 'No dog has been selected';
64
    exit();
65
}
66
67
if (isset($_GET['delpicture']) && 'true' === $_GET['delpicture']) {
68
    $delpicsql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . " SET foto = '' WHERE id = '" . $id . "'";
69
    $GLOBALS['xoopsDB']->query($delpicsql);
70
}
71
//query
72
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $id;
73
$result      = $GLOBALS['xoopsDB']->query($sql);
74
75
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
76
    //name
77
    $pname = stripslashes($row['pname']);
78
    $xoopsTpl->assign('xoops_pagetitle', $pname . ' -- detailed information');
79
    //owner
80
    if ('0' != $row['id_owner']) {
81
        $queryeig = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE id=' . $row['id_owner'];
82
        $reseig   = $GLOBALS['xoopsDB']->query($queryeig);
83
        while (false !== ($roweig = $GLOBALS['xoopsDB']->fetchArray($reseig))) {
84
            $eig = '<a href="owner.php?ownid=' . $roweig['id'] . '">' . $roweig['firstname'] . ' ' . $roweig['lastname'] . '</a>';
85
        }
86
    } else {
87
        $eig = '<a href="update.php?id=' . $row['id'] . '&fld=ow">' . _MA_PEDIGREE_UNKNOWN . '</a>';
88
    }
89
    //breeder
90
    if ('0' != $row['id_breeder']) {
91
        $queryfok = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE id=' . $row['id_breeder'];
92
        $resfok   = $GLOBALS['xoopsDB']->query($queryfok);
93
        while (false !== ($rowfok = $GLOBALS['xoopsDB']->fetchArray($resfok))) {
94
            $fok = '<a href="owner.php?ownid=' . $rowfok['id'] . '">' . $rowfok['firstname'] . ' ' . $rowfok['lastname'] . '</a>';
95
        }
96
    } else {
97
        $fok = '<a href="update.php?id=' . $row['id'] . '&fld=br">' . _MA_PEDIGREE_UNKNOWN . '</a>';
98
    }
99
    //gender
100
    if (0 == $row['roft']) {
101
        $gender = '<img src="assets/images/male.gif"> ' . strtr(_MA_PEDIGREE_FLD_MALE, ['[male]' => $moduleConfig['male']]);
102
    } else {
103
        $gender = '<img src="assets/images/female.gif"> ' . strtr(_MA_PEDIGREE_FLD_FEMA, ['[female]' => $moduleConfig['female']]);
104
    }
105
    //Sire
106
    if (0 != $row['father']) {
107
        $querysire = 'SELECT pname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $row['father'];
108
        $ressire   = $GLOBALS['xoopsDB']->query($querysire);
109
        while (false !== ($rowsire = $GLOBALS['xoopsDB']->fetchArray($ressire))) {
110
            $sire = '<img src="assets/images/male.gif"><a href="dog.php?id=' . $row['father'] . '">' . stripslashes($rowsire['pname']) . '</a>';
111
        }
112
    } else {
113
        $sire = '<img src="assets/images/male.gif"><a href="seldog.php?curval=' . $row['id'] . '&gend=0&letter=A">' . _MA_PEDIGREE_UNKNOWN . '</a>';
114
    }
115
    //Dam
116
    if (0 != $row['mother']) {
117
        $querydam = 'SELECT pname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $row['mother'];
118
        $resdam   = $GLOBALS['xoopsDB']->query($querydam);
119
        while (false !== ($rowdam = $GLOBALS['xoopsDB']->fetchArray($resdam))) {
120
            $dam = '<img src="assets/images/female.gif"><a href="dog.php?id=' . $row['mother'] . '">' . stripslashes($rowdam['pname']) . '</a>';
121
        }
122
    } else {
123
        $dam = '<img src="assets/images/female.gif"><a href="seldog.php?curval=' . $row['id'] . '&gend=1&letter=A">' . _MA_PEDIGREE_UNKNOWN . '</a>';
124
    }
125
    //picture
126
    if ('' != $row['foto']) {
127
        $picture = '<img src=' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $row['foto'] . '_400.jpeg>';
0 ignored issues
show
The constant PEDIGREE_UPLOAD_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
128
    } else {
129
        $picture = '<a href="update.php?id=' . $row['id'] . '&fld=pc">' . _MA_PEDIGREE_UNKNOWN . '</a>';
130
    }
131
    //inbred precentage
132
    if ('' == $row['coi']) {
133
        if (0 != $row['father'] && 0 != $row['mother']) {
134
            $inbred = '<a href="coi.php?s=' . $row['father'] . '&d=' . $row['mother'] . '&dogid=' . $row['id'] . '&detail=1">' . strtr(_MA_PEDIGREE_COI_WAIT, ['[animalType]' => $helper->getConfig('animalType')]) . '</a>';
135
        } else {
136
            $inbred = _MA_PEDIGREE_COI_MORE;
137
        }
138
    } else {
139
        $inbred = '<a href="coi.php?s=' . $row['father'] . '&d=' . $row['mother'] . '&dogid=' . $row['id'] . '&detail=1" title="' . strtr(_MA_PEDIGREE_COI_WAIT, ['[animalType]' => $helper->getConfig('animalType')]) . '">' . $row['coi'] . ' %</a>';
140
    }
141
    //brothers and sisters
142
    $bas = Utility::bas($id, $row['father'], $row['mother']);
0 ignored issues
show
Are you sure the assignment to $bas is correct as XoopsModules\Pedigree\Ut...ther'], $row['mother']) targeting XoopsModules\Pedigree\Utility::bas() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
143
    //pups
144
    if ('1' == $moduleConfig['pups']) {
145
        $pups = Utility::pups($id, $row['roft']);
0 ignored issues
show
Are you sure the assignment to $pups is correct as XoopsModules\Pedigree\Ut...pups($id, $row['roft']) targeting XoopsModules\Pedigree\Utility::pups() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
146
    }
147
    //check for edit rights
148
    $access      = 0;
149
    $xoopsModule = XoopsModule::getByDirname($moduleDirName);
150
    if (!empty($xoopsUser)) {
151
        if ($xoopsUser->isAdmin($xoopsModule->mid())) {
152
            $access = 1;
153
        }
154
        if ($row['user'] == $xoopsUser->getVar('uid')) {
155
            $access = 1;
156
        }
157
    }
158
159
    //name
160
    $items[] = [
161
        'header' => _MA_PEDIGREE_FLD_NAME,
162
        'data'   => '<a href="pedigree.php?pedid=' . $row['id'] . '">' . $pname . '</a> (click to view pedigree)',
163
        'edit'   => '<a href="update.php?id=' . $row['id'] . "&fld=nm\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
164
    ];
165
    if ('1' == $helper->getConfig('ownerbreeder')) {
166
        //owner
167
        $items[] = [
168
            'header' => _MA_PEDIGREE_FLD_OWNE,
169
            'data'   => $eig,
170
            'edit'   => '<a href="update.php?id=' . $row['id'] . "&fld=ow\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
171
        ];
172
        //breeder
173
        $items[] = [
174
            'header' => _MA_PEDIGREE_FLD_BREE,
175
            'data'   => $fok,
176
            'edit'   => '<a href="update.php?id=' . $row['id'] . "&fld=br\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
177
        ];
178
    }
179
    //gender
180
    $items[] = [
181
        'header' => _MA_PEDIGREE_FLD_GEND,
182
        'data'   => $gender,
183
        'edit'   => '<a href="update.php?id=' . $row['id'] . "&fld=sx\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
184
    ];
185
    //sire
186
    $items[] = [
187
        'header' => strtr(_MA_PEDIGREE_FLD_FATH, ['[father]' => $moduleConfig['father']]),
188
        'data'   => $sire,
189
        'edit'   => '<a href="seldog.php?curval=' . $row['id'] . "&gend=0&letter=A\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
190
    ];
191
    //dam
192
    $items[] = [
193
        'header' => strtr(_MA_PEDIGREE_FLD_MOTH, ['[mother]' => $moduleConfig['mother']]),
194
        'data'   => $dam,
195
        'edit'   => '<a href="seldog.php?curval=' . $row['id'] . "&gend=1&letter=A\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
196
    ];
197
    //picture
198
    $items[] = [
199
        'header' => _MA_PEDIGREE_FLD_PICT,
200
        'data'   => $picture,
201
        'edit'   => '<a href="update.php?id=' . $row['id'] . "&fld=pc\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a><a href=\"dog.php?id=" . $row['id'] . "&delpicture=true\"><img src=' " . $pathIcon16 . "/delete.png' border='0' alt=_DELETE title=_DELETE></a>",
202
    ];
203
204
    //userdefined fields
205
206
    $a      = Request::getInt('id', 1, 'GET');
207
    $animal = new Pedigree\Animal($a);
0 ignored issues
show
The type Pedigree\Animal was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
208
209
    //test to find out how many user fields there are..
210
    $fields = $animal->getNumOfFields();
211
    //create userfields and populate them
212
    foreach ($fields as $i => $iValue) {
213
        $userField = new Pedigree\Field($fields[$i], $animal->getConfig());
0 ignored issues
show
The type Pedigree\Field was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
214
        if ($userField->isActive()) {
215
            $fieldType   = $userField->getSetting('FieldType');
216
            $fieldObject = new $fieldType($userField, $animal);
217
            if ($userField->isLocked()) {
218
                $items[] = [
219
                    'header' => $userField->getSetting('FieldName'),
220
                    'data'   => $fieldObject->showValue(),
221
                    'edit'   => '',
222
                ];
223
            } else {
224
                $items[] = [
225
                    'header' => $userField->getSetting('FieldName'),
226
                    'data'   => $fieldObject->showValue(),
227
                    'edit'   => '<a href="update.php?id=' . $row['id'] . '&fld=' . $iValue . "\"><img src=' " . $pathIcon16 . "/edit.png' border='0' alt=_EDIT title=_EDIT></a>",
228
                ];
229
            }
230
        }
231
        unset($fieldObject, $userField);
232
    }
233
234
    if ('1' == $helper->getConfig('proversion')) {
235
        //inbred percentage
236
        $items[] = [
237
            'header' => _MA_PEDIGREE_FLD_INBR,
238
            'data'   => $inbred,
239
            'edit'   => '',
240
        ];
241
    }
242
    if ('1' == $moduleConfig['pups']) {
243
        //pups
244
        if ('0' == $numMatch) {
245
            $pups = '';
246
        } else {
247
            $pups = 'pups';
248
        }
249
        $items[] = [
250
            'header' => $moduleConfig['children'],
251
            'data'   => $pups,
252
            'edit'   => '',
253
        ];
254
    }
255
    if ('1' == $moduleConfig['brothers']) {
256
        //bas (brothers and sisters)
257
        if ('0' == $nummatch1) {
258
            $bas = '';
259
        } else {
260
            $bas = 'bas';
261
        }
262
        $items[] = [
263
            'header' => _MA_PEDIGREE_FLD_BAS,
264
            'data'   => $bas,
265
            'edit'   => '',
266
        ];
267
    }
268
    //database user
269
    if ('1' == $helper->getConfig('proversion')) {
270
        $items[] = [
271
            'header' => _MA_PEDIGREE_FLD_DBUS,
272
            'data'   => \XoopsUserUtility::getUnameFromId($row['user']),
273
            'edit'   => '',
274
        ];
275
    }
276
    //inbred pedigree
277
    if ('1' == $helper->getConfig('proversion')) {
278
        $items[] = [
279
            'header' => 'Inbred Pedigree',
280
            'data'   => '<a href="mpedigree.php?pedid=' . $row['id'] . '">Inbreeding pedigree</a>',
281
            'edit'   => '',
282
        ];
283
    }
284
    $id = $row['id'];
285
}
286
287
//add data to smarty template
288
//assign dog
289
//pups
290
$xoopsTpl->assign('dogs', $dogs);
291
$xoopsTpl->assign('columns', $columns);
292
$xoopsTpl->assign('numofcolumns', $numofcolumns);
293
$xoopsTpl->assign('nummatch', $numMatch . ' Animals found.');
294
295
//bas
296
$xoopsTpl->assign('dogs1', $dogs1);
297
$xoopsTpl->assign('columns1', $columns1);
298
$xoopsTpl->assign('numofcolumns1', $numofcolumns1);
299
$xoopsTpl->assign('nummatch1', $nummatch1 . ' Animals found.');
300
301
//both pups and bas
302
$xoopsTpl->assign('width', 100 / $numofcolumns);
303
$xoopsTpl->assign('tsarray', Utility::sortTable($numofcolumns));
304
305
$xoopsTpl->assign('access', $access);
306
$xoopsTpl->assign('items', $items);
307
$xoopsTpl->assign('name', $pname);
308
$xoopsTpl->assign('id', $id);
309
$xoopsTpl->assign('sdvins', _MA_PEDIGREE_SDVINS);
310
$xoopsTpl->assign('vpo', _MA_PEDIGREE_VPO);
311
$xoopsTpl->assign('vpo2', _MA_PEDIGREE_VPO2);
312
$xoopsTpl->assign('sii', _MA_PEDIGREE_SII);
313
$xoopsTpl->assign('sip', _MA_PEDIGREE_SIP);
314
$xoopsTpl->assign('id', $id);
315
$xoopsTpl->assign('delete', _DELETE);
316
317
//comments and footer
318
require XOOPS_ROOT_PATH . '/include/comment_view.php';
319
require XOOPS_ROOT_PATH . '/footer.php';
320