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.

menu_block.php (3 issues)

1
<?php
2
3
/**
4
 * Include any constants used for internationalizing templates.
5
 *
6
 * @package      XoopsModules\Pedigree
7
 * @copyright    2004 James Cotton
8
 * @copyright    {@link https://xoops.org/ XOOPS Project}
9
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
10
 * @author       James Cotton {@link http://www.dobermannvereniging.nl James Cotton}
11
 * @author       XOOPS Module Dev Team
12
 */
13
14
use XoopsModules\Pedigree\{
15
    Helper,
16
    Utility
17
};
18
/** @var Helper $helper */
19
20
$moduleDirName = basename(__DIR__);
21
$helper        = Helper::getInstance();
22
$helper->loadLanguage('main');
23
24
// Include any common code for this module.
25
require_once $helper->path('include/common.php');
26
27
/**
28
 * @return XoopsTpl
29
 */
30
function menu_block()
31
{
32
    $helper = Helper::getInstance();
33
34
    [$actlink, $even, $odd, $text, $hovlink, $head, $body, $title] = Utility::getColourScheme();
35
    /*
36
    $actlink = $colors[0];
37
    $even    = $colors[1];
38
    $odd     = $colors[2];
39
    $text    = $colors[3];
40
    $hovlink = $colors[4];
41
    $head    = $colors[5];
42
    $body    = $colors[6];
43
    $title   = $colors[7];
44
    */
45
    //inline-css
46
    echo '<style>';
47
    //text-colour
48
    echo 'body {margin: 0;padding: 0;background: ' . $body . ';color: ' . $text . ";font-size: 100%; /* <-- Resets 1em to 10px */font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; text-align: left;}";
49
    //link-colour
50
    echo 'a, h2 a:hover, h3 a:hover { color: ' . $actlink . '; text-decoration: none; }';
51
    //link hover colour
52
    echo 'a:hover { color: ' . $hovlink . '; text-decoration: underline; }';
53
    //th
54
    echo 'th {padding: 2px;color: #ffffff;background: ' . $title . ';font-family: Verdana, Arial, Helvetica, sans-serif;vertical-align: middle;}';
55
    echo 'td#centercolumn th { color: #fff; background: ' . $title . '; vertical-align: middle; }';
56
    //head
57
    echo '.head {background-color: ' . $head . '; padding: 3px; font-weight: normal;}';
58
    //even
59
    echo '.even {background-color: ' . $even . '; padding: 3px;}';
60
    echo 'tr.even td {background-color: ' . $even . '; padding: 3px;}';
61
    //odd
62
    echo '.odd {background-color: ' . $odd . '; padding: 3px;}';
63
    echo 'tr.odd td {background-color: ' . $odd . '; padding: 3px;}';
64
    echo '</style>';
65
66
    //is current user a module admin ?
67
    if (!empty($GLOBALS['xoopsUser']) && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)
68
        && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
69
        $isAdmin = true;
70
    } else {
71
        $isAdmin = false;
72
    }
73
74
    $counter   = 1;
75
    $menuwidth = 4;
76
77
    $x       = $_SERVER['SCRIPT_NAME'];
78
    $lastpos = Utility::myStrRpos($x, '/');
79
    $len     = mb_strlen($x);
80
    $curpage = mb_substr($x, $lastpos, $len);
0 ignored issues
show
It seems like $lastpos can also be of type false; however, parameter $start of mb_substr() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

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

80
    $curpage = mb_substr($x, /** @scrutinizer ignore-type */ $lastpos, $len);
Loading history...
81
    if ('1' == $helper->getConfig('showwelcome')) {
82
        if ('/welcome.php' === $curpage) {
83
            $title = '<b>' . _MA_PEDIGREE_WELCOME . '</b>';
84
        } else {
85
            $title = _MA_PEDIGREE_WELCOME;
86
        }
87
        $menuarray[] = ['title' => $title, 'link' => 'welcome.php', 'counter' => $counter];
0 ignored issues
show
Comprehensibility Best Practice introduced by
$menuarray was never initialized. Although not strictly required by PHP, it is generally a good practice to add $menuarray = array(); before regardless.
Loading history...
88
        ++$counter;
89
        if ($counter == $menuwidth) {
90
            $counter = 1;
91
        }
92
    }
93
    if ('/index.php' === $curpage || '/result.php' === $curpage) {
94
        $title = '<b>' . _MA_PEDIGREE_VIEWSEARCH . $helper->getConfig('animalTypes') . '</b>';
95
    } else {
96
        $title = '_MA_PEDIGREE_VIEWSEARCH ' . $helper->getConfig('animalTypes');
97
    }
98
    $menuarray[] = ['title' => $title, 'link' => 'result.php', 'counter' => $counter];
99
    ++$counter;
100
    if ($counter == $menuwidth) {
101
        $counter = 1;
102
    }
103
    if ('/index.php' === $curpage) {
104
        $title = '<b>' . _MA_PEDIGREE_ADD_A . $helper->getConfig('animalType') . '</b>';
105
    } else {
106
        $title = 'PED_ADD_A ' . $helper->getConfig('animalType');
107
    }
108
    $menuarray[] = ['title' => $title, 'link' => 'add_dog.php', 'counter' => $counter];
109
    ++$counter;
110
    if ($counter == $menuwidth) {
111
        $counter = 1;
112
    }
113
114
    if ('1' == $helper->getConfig('uselitter')) {
115
        if ('/index.php' === $curpage) {
116
            $title = '<b>' . _MA_PEDIGREE_ADD_LITTER . $helper->getConfig('litter') . '</b>';
117
        } else {
118
            $title = '_MA_PEDIGREE_ADD_LITTER ' . $helper->getConfig('litter');
119
        }
120
121
        $menuarray[] = ['title' => $title, 'link' => 'add_litter.php', 'counter' => $counter];
122
        ++$counter;
123
        if ($counter == $menuwidth) {
124
            $counter = 1;
125
        }
126
    }
127
128
    if ('1' == $helper->getConfig('ownerbreeder')) {
129
        if ('/index.php' === $curpage || '/owner.php' === $curpage) {
130
            $title = '<b>' . _MA_PEDIGREE_VIEW_OWNBREED . '</b>';
131
        } else {
132
            $title = '_MA_PEDIGREE_VIEW_OWNBREED';
133
        }
134
        $menuarray[] = ['title' => $title, 'link' => 'breeder.php', 'counter' => $counter];
135
        ++$counter;
136
        if ($counter == $menuwidth) {
137
            $counter = 1;
138
        }
139
        if ('/index.php' === $curpage || '/add_breeder.php' === $curpage) {
140
            $title = '<b>' . _MA_PEDIGREE_ADD_OWNBREED . '</b>';
141
        } else {
142
            $title = '_MA_PEDIGREE_ADD_OWNBREED';
143
        }
144
        $menuarray[] = ['title' => $title, 'link' => 'add_breeder.php', 'counter' => $counter];
145
        ++$counter;
146
        if ($counter == $menuwidth) {
147
            $counter = 1;
148
        }
149
    }
150
    if ('/index.php' === $curpage || '/advanced.php' === $curpage) {
151
        $title = '<b>' . _MA_PEDIGREE_ADVANCE_INFO . '</b>';
152
    } else {
153
        $title = '_MA_PEDIGREE_ADVANCE_INFO';
154
    }
155
    $menuarray[] = ['title' => $title, 'link' => 'advanced.php', 'counter' => $counter];
156
    ++$counter;
157
    if ($counter == $menuwidth) {
158
        $counter = 1;
159
    }
160
    if ('1' == $helper->getConfig('proversion')) {
161
        if ('/index.php' === $curpage || '/virtual.php' === $curpage) {
162
            $title = '<b>' . _MA_PEDIGREE_VIRUTALTIT . '</b>';
163
        } else {
164
            $title = '_MA_PEDIGREE_VIRUTALTIT';
165
        }
166
        $menuarray[] = ['title' => $title, 'link' => 'virtual.php', 'counter' => $counter];
167
        ++$counter;
168
        if ($counter == $menuwidth) {
169
            $counter = 1;
170
        }
171
    }
172
    if ('/index.php' === $curpage || '/latest.php' === $curpage) {
173
        $title = '<b>' . _MA_PEDIGREE_LATEST_ADD . '</b>';
174
    } else {
175
        $title = '_MA_PEDIGREE_LATEST_ADD';
176
    }
177
    $menuarray[] = ['title' => $title, 'link' => 'latest.php', 'counter' => $counter];
178
    ++$counter;
179
    if ($counter == $menuwidth) {
180
        $counter = 1;
181
    }
182
    if ($isAdmin) {
183
        if ('/index.php' === $curpage || '/tools.php' === $curpage) {
184
            $title = '<b>' . _MA_PEDIGREE_WEB_TOOLS . '</b>';
185
        } else {
186
            $title = '_MA_PEDIGREE_WEB_TOOLS';
187
        }
188
        $menuarray[] = ['title' => $title, 'link' => 'tools.php?op=index', 'counter' => $counter];
189
        ++$counter;
190
        if ($counter == $menuwidth) {
191
            $counter = 1;
192
        }
193
194
        $title       = _MA_PEDIGREE_USER_LOGOUT;
195
        $menuarray[] = ['title' => $title, 'link' => '../../user.php?op=logout', 'counter' => $counter];
196
        ++$counter;
197
        if ($counter == $menuwidth) {
198
            $counter = 1;
0 ignored issues
show
The assignment to $counter is dead and can be removed.
Loading history...
199
        }
200
    } else {
201
        if ('/user.php' === $curpage) {
202
            $title = '._MA_PEDIGREE_USER_LOGIN.';
203
        } else {
204
            $title = _MA_PEDIGREE_USER_LOGIN;
205
        }
206
        $menuarray[] = ['title' => $title, 'link' => '../../user.php', 'counter' => $counter];
207
        ++$counter;
208
        if ($counter == $menuwidth) {
209
            $counter = 1;
210
        }
211
    }
212
213
    //create path taken
214
    //showpath();
215
    $GLOBALS['xoopsTpl']->assign('menuarray', $menuarray);
216
217
    //return the template contents
218
    return $GLOBALS['xoopsTpl'];
219
}
220