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 | |||
3 | /** |
||
4 | * Class D3LanguageManager |
||
5 | */ |
||
6 | class D3LanguageManager |
||
7 | { |
||
8 | public $default_language = 'english'; |
||
9 | |||
10 | public $language = 'english'; |
||
11 | |||
12 | public $salt; |
||
13 | |||
14 | public $cache_path; |
||
15 | |||
16 | public $cache_prefix = 'lang'; |
||
17 | |||
18 | public $my_language = false; |
||
19 | |||
20 | //HACK by domifara |
||
21 | |||
22 | //public function D3LanguageManager() |
||
23 | |||
24 | /** |
||
25 | * D3LanguageManager constructor. |
||
26 | */ |
||
27 | |||
28 | public function __construct() |
||
29 | { |
||
30 | $this->language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']); |
||
31 | |||
32 | $this->salt = mb_substr(md5(XOOPS_ROOT_PATH . XOOPS_DB_USER . XOOPS_DB_PREFIX), 0, 6); |
||
33 | |||
34 | $this->cache_path = XOOPS_TRUST_PATH . '/cache'; |
||
35 | |||
36 | if (defined('ALTSYS_MYLANGUAGE_ROOT_PATH') && file_exists(ALTSYS_MYLANGUAGE_ROOT_PATH)) { |
||
37 | $this->my_language = ALTSYS_MYLANGUAGE_ROOT_PATH; |
||
0 ignored issues
–
show
|
|||
38 | } |
||
39 | } |
||
40 | |||
41 | //HACK by domifara for php5.3+ |
||
42 | |||
43 | //function getInstance( $conn = null ) |
||
44 | |||
45 | /** |
||
46 | * @param null $conn |
||
47 | * @return \D3LanguageManager |
||
48 | */ |
||
49 | |||
50 | public static function getInstance($conn = null) |
||
51 | { |
||
52 | static $instance; |
||
53 | |||
54 | if (!isset($instance)) { |
||
55 | $instance = new self(); |
||
56 | } |
||
57 | |||
58 | return $instance; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param $resource |
||
63 | * @param $mydirname |
||
64 | * @param null $mytrustdirname |
||
65 | * @param bool $read_once |
||
66 | */ |
||
67 | |||
68 | public function read($resource, $mydirname, $mytrustdirname = null, $read_once = true) |
||
69 | { |
||
70 | $d3file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/mytrustdirname.php'; |
||
71 | |||
72 | if (empty($mytrustdirname) && is_file($d3file)) { |
||
73 | require $d3file; |
||
74 | } |
||
75 | |||
76 | if (empty($this->language)) { |
||
77 | $this->language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']); |
||
78 | } |
||
79 | |||
80 | $cache_file = $this->getCacheFileName($resource, $mydirname); |
||
81 | |||
82 | $root_file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $this->language . '/' . $resource; |
||
83 | |||
84 | // language overriding by XOOPS_ROOT_PATH/my_language |
||
85 | |||
86 | if ($this->my_language) { |
||
87 | $mylang_file = $this->my_language . '/modules/' . $mydirname . '/' . $this->language . '/' . $resource; |
||
88 | |||
89 | if (is_file($mylang_file)) { |
||
90 | require_once $mylang_file; |
||
91 | } |
||
92 | |||
93 | $original_error_level = error_reporting(); |
||
94 | |||
95 | error_reporting($original_error_level & ~E_NOTICE); |
||
96 | } |
||
97 | |||
98 | if (empty($mytrustdirname)) { |
||
99 | // conventional module |
||
100 | |||
101 | $default_file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $this->default_language . '/' . $resource; |
||
102 | |||
103 | if (is_file($cache_file)) { |
||
104 | require_once $cache_file; |
||
105 | } elseif (is_file($root_file)) { |
||
106 | require_once $root_file; |
||
107 | } elseif (is_file($default_file)) { |
||
108 | // fall back english |
||
109 | |||
110 | require_once $default_file; |
||
111 | } |
||
112 | } else { |
||
113 | // D3 modules |
||
114 | |||
115 | $trust_file = XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname . '/language/' . $this->language . '/' . $resource; |
||
116 | |||
117 | $default_file = XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname . '/language/' . $this->default_language . '/' . $resource; |
||
118 | |||
119 | if (is_file($cache_file)) { |
||
120 | require_once $cache_file; |
||
121 | } elseif (is_file($root_file)) { |
||
122 | require_once $root_file; |
||
123 | } elseif (is_file($trust_file)) { |
||
124 | if ($read_once) { |
||
125 | require_once $trust_file; |
||
126 | } else { |
||
127 | require $trust_file; |
||
128 | } |
||
129 | } elseif (is_file($default_file)) { |
||
130 | // fall back english |
||
131 | |||
132 | if ($read_once) { |
||
133 | require_once $default_file; |
||
134 | } else { |
||
135 | require $default_file; |
||
136 | } |
||
137 | } |
||
138 | } |
||
139 | |||
140 | if ($this->my_language) { |
||
141 | error_reporting($original_error_level); |
||
0 ignored issues
–
show
The variable
$original_error_level 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
Loading history...
|
|||
142 | } |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * @param $resource |
||
147 | * @param $mydirname |
||
148 | * @param null $language |
||
149 | * @return string |
||
150 | */ |
||
151 | |||
152 | public function getCacheFileName($resource, $mydirname, $language = null) |
||
153 | { |
||
154 | if (empty($language)) { |
||
155 | $language = $this->language; |
||
156 | } |
||
157 | |||
158 | return $this->cache_path . '/' . $this->cache_prefix . '_' . $this->salt . '_' . $mydirname . '_' . $language . '_' . $resource; |
||
159 | } |
||
160 | } |
||
161 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.