This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | $userConfig = $this->loadUserConfig(); |
||
3 | $authconfig = $userConfig['authentication']; |
||
4 | |||
5 | if( !function_exists("grantsArrayToString") ) { |
||
6 | function grantsArrayToString($grants) { |
||
7 | $grantstring = ""; |
||
8 | if (is_array($grants)) { |
||
9 | foreach ($grants as $grant => $granttype) { |
||
10 | if (is_array($granttype)) { |
||
11 | $grantstring .= " $grant ( "; |
||
12 | reset($granttype); |
||
13 | while (list($class, $modifierId)=each($granttype)) { |
||
14 | View Code Duplication | if( $granttype > 0 ) { |
|
15 | switch($modifierId) { |
||
16 | case ARGRANTLOCAL: |
||
17 | $modifier = "="; |
||
18 | break; |
||
19 | case ARGRANTCHILDREN: |
||
20 | $modifier = ">"; |
||
21 | break; |
||
22 | default: |
||
23 | $modifier = ""; |
||
24 | } |
||
25 | $grantstring .= " $modifier$class "; |
||
26 | } |
||
27 | } |
||
28 | $grantstring .= " ) "; |
||
29 | View Code Duplication | } elseif( $granttype > 0 ) { |
|
30 | switch($granttype) { |
||
31 | case ARGRANTLOCAL: |
||
32 | $modifier = "="; |
||
33 | break; |
||
34 | case ARGRANTCHILDREN: |
||
35 | $modifier = ">"; |
||
36 | break; |
||
37 | default: |
||
38 | $modifier = ""; |
||
39 | } |
||
40 | $grantstring .= " $modifier$grant "; |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | return $grantstring; |
||
45 | } |
||
46 | } |
||
47 | |||
48 | if( !function_exists("arGetGrantType") ) { |
||
49 | function arGetGrantType($value) { |
||
50 | if (($value & ARMASKLOCAL) && ($value & ARMASKCHILDREN)) { |
||
51 | $result=""; |
||
52 | } else if ($value & ARMASKLOCAL) { |
||
53 | $result="="; |
||
54 | } else { |
||
55 | $result=">"; |
||
56 | } |
||
57 | return $result; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | if( !function_exists("array_compare") ) { |
||
62 | function array_compare(&$ar1, &$ar2) { |
||
63 | if (count($ar1) != count($ar2)) { |
||
64 | return false; |
||
65 | } else { |
||
66 | foreach ($ar1 as $key => $value) { |
||
67 | if (is_array($value) && is_array($ar2[$key])) { |
||
68 | return array_compare($ar1[$key], $ar2[$key]); |
||
69 | } else |
||
70 | if ($value !== $ar2[$key]) { |
||
71 | return false; |
||
72 | } |
||
73 | return true; |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 | } |
||
78 | |||
79 | if( !function_exists("getClass") ) { |
||
80 | function getClass($grey=false) { |
||
81 | global $ARCurrent; |
||
82 | if ($ARCurrent->oddline=($ARCurrent->oddline+1)%2) { |
||
83 | $class='odd'; |
||
84 | } else { |
||
85 | $class='even'; |
||
86 | } |
||
87 | if ($grey) { |
||
88 | $class .= '-grey'; |
||
89 | } |
||
90 | return $class; |
||
91 | } |
||
92 | } |
||
93 | |||
94 | if( !function_exists("getPathByType") ) { |
||
95 | function getPathByType($type, $id) { |
||
96 | global $AR; |
||
97 | switch ($type) { |
||
98 | case 'pgroup': |
||
99 | View Code Duplication | foreach ($authconfig['groupdirs'] as $groupdir) { |
|
0 ignored issues
–
show
|
|||
100 | $path = current($AR->user->find($groupdir, 'login.value=\''.$id.'\'', 'system.get.path.phtml')); |
||
101 | if ($path) { |
||
102 | break; |
||
103 | } |
||
104 | } |
||
105 | break; |
||
106 | case 'puser': |
||
107 | View Code Duplication | foreach ($authconfig['userdirs'] as $userdir) { |
|
108 | $path = current($AR->user->find($userdir, 'login.value=\''.$id.'\'', 'system.get.path.phtml')); |
||
109 | if ($path) { |
||
110 | break; |
||
111 | } |
||
112 | } |
||
113 | break; |
||
114 | } |
||
115 | return $path; |
||
0 ignored issues
–
show
The variable
$path does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
116 | } |
||
117 | } |
||
118 | |||
119 | if( !function_exists("removeSimilarGrants") ) { |
||
120 | function removeSimilarGrants($grants) { |
||
121 | // first check for similar grants (same modifiers) |
||
122 | $grants_check = $grants; |
||
123 | foreach ($grants as $grant => $grant_ar) { |
||
124 | // loop $grants for each entry in $grants_check (which is a copy) |
||
125 | array_shift($grants_check); |
||
126 | if (is_array($grant_ar)) { |
||
127 | foreach ($grants_check as $grant_c => $grant_ar_c) { |
||
128 | if (is_array($grant_ar_c) && array_compare($grant_ar, $grant_ar_c)) { |
||
129 | unset($grants[$grant_c]); |
||
130 | } |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | reset($grants); |
||
135 | ksort($grants); |
||
136 | return $grants; |
||
137 | } |
||
138 | } |
||
139 | |||
140 | if( !function_exists("getGrantString") ) { |
||
141 | function getGrantString($id, $type, $grants, $grey) { |
||
142 | if ($grants && is_array($grants)) { |
||
143 | $grants = removeSimilarGrants($grants); |
||
144 | $grant_display = ''; |
||
145 | $grant_string = ''; |
||
146 | |||
147 | foreach ($grants as $grant => $modifiers) { |
||
148 | if (!is_array($modifiers)) { |
||
149 | $grant_type=arGetGrantType($modifiers); |
||
150 | $grant_display .= htmlspecialchars($grant_type); // echo |
||
151 | } else { |
||
152 | $grant_type=''; |
||
153 | } |
||
154 | |||
155 | if (!$grey) { |
||
156 | $grant_display .= "<a href=\"javascript:selectGrant('$type', '$id', '$grant');\">"; |
||
157 | } else { |
||
158 | $grant_display .= "<span class='grey'>"; |
||
159 | } |
||
160 | |||
161 | $grant_display .= $grant; |
||
162 | if (is_array($grants_eq[$grant])) { |
||
0 ignored issues
–
show
The variable
$grants_eq does not exist. Did you mean $grants ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
163 | foreach ($grants_eq[$grant] as $g_add) { |
||
0 ignored issues
–
show
The variable
$grants_eq does not exist. Did you mean $grants ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
164 | $grant .= ", ".$grant_type."$g_add"; |
||
165 | } |
||
166 | $grant_display .= "[$grant]"; |
||
167 | $grant_string .= "[$grant]"; |
||
168 | } else { |
||
169 | $grant_string .= "$grant_type$grant "; |
||
170 | } |
||
171 | if (is_array($modifiers)) { |
||
172 | $grant_string .= "( "; |
||
173 | $grant_display .= "( "; |
||
174 | foreach ($modifiers as $modifier => $value) { |
||
175 | $grant_type=arGetGrantType($value); |
||
176 | $grant_display .= htmlspecialchars($grant_type); |
||
177 | $grant_display .= $modifier." "; |
||
178 | $grant_string .= $grant_type.$modifier." "; |
||
179 | } |
||
180 | $grant_display .= ") "; |
||
181 | $grant_string .= ") "; |
||
182 | } |
||
183 | if (!$grey) { |
||
184 | $grant_display .= "</a>"; |
||
185 | } else { |
||
186 | $grant_display .= "</span>"; |
||
187 | } |
||
188 | } |
||
189 | $grant_display .= " "; |
||
190 | $grant_string .= " "; |
||
191 | } |
||
192 | return array($grant_string, $grant_display); |
||
0 ignored issues
–
show
The variable
$grant_string does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() The variable
$grant_display does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
193 | } |
||
194 | } |
||
195 | |||
196 | if( !function_exists("DisplayGrants") ) { |
||
197 | function DisplayGrants(&$grantslist, $type, $grey=false) { |
||
198 | global $AR, $ARCurrent; |
||
199 | if ($grantslist[$type] && is_array($grantslist[$type])) { |
||
200 | ksort($grantslist[$type]); |
||
201 | while (list($id, $grants)=each($grantslist[$type])) { // path was login en is weer login |
||
202 | $grant_string = ""; |
||
0 ignored issues
–
show
$grant_string is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
203 | if (!$ARCurrent->donelist[$type][$id]) { |
||
204 | $ARCurrent->donelist[$type][$id]=true; |
||
205 | $row_id = "grants-$type-$id"; |
||
206 | $row_class = getClass($grey); |
||
207 | $path = getPathByType($type, $id); |
||
208 | $grant_strings = getGrantString($id, $type, $grants, $grey); |
||
209 | $grant_string = $grant_strings[0]; |
||
210 | $grant_html = $grant_strings[1]; |
||
211 | $icon = $AR->dir->images . "icons/small/" . $type . ".png"; |
||
212 | |||
213 | ?> |
||
214 | <script type="text/javascript"> |
||
215 | id2path['<?php echo $type; ?>']['<?php echo $id; ?>'] = '<?php echo $path; ?>'; |
||
216 | grant_strings['<?php echo $type; ?>']['<?php echo $id; ?>']='<?php echo $grant_string; ?>'; |
||
217 | </script> |
||
218 | <tr class='<?php echo $row_class; ?>' id="<?php echo $row_id; ?>"> |
||
219 | <td> |
||
220 | <img alt="<?php echo $type; ?>" src="<?php echo $icon; ?>"> |
||
221 | </td> |
||
222 | <td> |
||
223 | <a href="javascript:loadUser('<?php echo $type; ?>', '<?php echo $id; ?>');"><?php echo $id; ?></a> |
||
224 | </td> |
||
225 | <td> |
||
226 | <?php echo $grant_html; ?> |
||
227 | </td> |
||
228 | </tr> |
||
229 | <?php |
||
230 | } |
||
231 | } |
||
232 | } |
||
233 | } |
||
234 | } |
||
235 | ?> |
||
236 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.