Issues (733)

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.

class/Time.php (1 issue)

1
<?php
2
3
namespace XoopsModules\Extcal;
4
5
use XoopsModules\Extcal\{Helper
6
};
7
8
require_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/calendar.php';
9
10
$moduleDirName = \basename(\dirname(__DIR__));
11
Helper::getInstance()->loadLanguage('main');
12
13
/**
14
 * Class Time.
15
 */
16
class Time
17
{
18
    /**
19
     * @return Time
20
     */
21
    public static function getHandler()
22
    {
23
        static $timeHandler;
24
        if (!isset($timeHandler)) {
25
            $timeHandler = new self();
26
        }
27
28
        return $timeHandler;
29
    }
30
31
    /**
32
     * @param \XoopsUser|string $user
33
     *
34
     * @return mixed
35
     */
36
    public function getUserTimeZone($user)
37
    {
38
        global $xoopsConfig;
39
40
        return $user ? $user->timezone() : $xoopsConfig['default_TZ'];
41
    }
42
43
    /**
44
     * @param $id
45
     *
46
     * @return mixed
47
     */
48
    public function getMonthName($id)
49
    {
50
        $monthName = [
51
            '1'  => _CAL_JANUARY,
52
            '2'  => _CAL_FEBRUARY,
53
            '3'  => _CAL_MARCH,
54
            '4'  => _CAL_APRIL,
55
            '5'  => _CAL_MAY,
56
            '6'  => _CAL_JUNE,
57
            '7'  => _CAL_JULY,
58
            '8'  => _CAL_AUGUST,
59
            '9'  => _CAL_SEPTEMBER,
60
            '10' => _CAL_OCTOBER,
61
            '11' => _CAL_NOVEMBER,
62
            '12' => _CAL_DECEMBER,
63
        ];
64
65
        return $monthName[$id];
66
    }
67
68
    /**
69
     * @param $id
70
     *
71
     * @return mixed
72
     */
73
    public function getDayName($id)
74
    {
75
        $dayName = [
76
            _CAL_SUNDAY,
77
            _CAL_MONDAY,
78
            _CAL_TUESDAY,
79
            _CAL_WEDNESDAY,
80
            _CAL_THURSDAY,
81
            _CAL_FRIDAY,
82
            _CAL_SATURDAY,
83
        ];
84
85
        return $dayName[$id];
86
    }
87
88
    /**
89
     * @param $format
90
     * @param $timestamp
91
     *
92
     * @return mixed
93
     */
94
    public function getFormatedDate($format, $timestamp)
95
    {
96
        $patterns     = [
97
            '/January/',
98
            '/February/',
99
            '/March/',
100
            '/April/',
101
            '/May/',
102
            '/June/',
103
            '/July/',
104
            '/August/',
105
            '/September/',
106
            '/October/',
107
            '/November/',
108
            '/December/',
109
            '/Jan /',
110
            '/Feb /',
111
            '/Mar /',
112
            '/Apr /',
113
            '/May /',
114
            '/Jun /',
115
            '/Jul /',
116
            '/Aug /',
117
            '/Sep /',
118
            '/Oct /',
119
            '/Nov /',
120
            '/Dec /',
121
            '/Sunday/',
122
            '/Monday/',
123
            '/Tuesday/',
124
            '/Wednesday/',
125
            '/Thursday/',
126
            '/Friday/',
127
            '/Saturday/',
128
            '/Sun /',
129
            '/Mon /',
130
            '/Tue /',
131
            '/Wed /',
132
            '/Thu /',
133
            '/Fri /',
134
            '/Sat /',
135
        ];
136
        $replacements = [
137
            _CAL_JANUARY,
138
            _CAL_FEBRUARY,
139
            _CAL_MARCH,
140
            _CAL_APRIL,
141
            _CAL_MAY,
142
            _CAL_JUNE,
143
            _CAL_JULY,
144
            _CAL_AUGUST,
145
            _CAL_SEPTEMBER,
146
            _CAL_OCTOBER,
147
            _CAL_NOVEMBER,
148
            _CAL_DECEMBER,
149
            mb_substr(_CAL_JANUARY, 0, 3) . ' ',
150
            mb_substr(_CAL_FEBRUARY, 0, 3) . ' ',
151
            mb_substr(_CAL_MARCH, 0, 3) . ' ',
152
            mb_substr(_CAL_APRIL, 0, 3) . ' ',
153
            mb_substr(_CAL_MAY, 0, 3) . ' ',
154
            mb_substr(_CAL_JUNE, 0, 3) . ' ',
155
            mb_substr(_CAL_JULY, 0, 3) . ' ',
156
            mb_substr(_CAL_AUGUST, 0, 3) . ' ',
157
            mb_substr(_CAL_SEPTEMBER, 0, 3) . ' ',
158
            mb_substr(_CAL_OCTOBER, 0, 3) . ' ',
159
            mb_substr(_CAL_NOVEMBER, 0, 3) . ' ',
160
            mb_substr(_CAL_DECEMBER, 0, 3) . ' ',
161
            _CAL_SUNDAY,
162
            _CAL_MONDAY,
163
            _CAL_TUESDAY,
164
            _CAL_WEDNESDAY,
165
            _CAL_THURSDAY,
166
            _CAL_FRIDAY,
167
            _CAL_SATURDAY,
168
            mb_substr(_CAL_SUNDAY, 0, 3) . ' ',
169
            mb_substr(_CAL_MONDAY, 0, 3) . ' ',
170
            mb_substr(_CAL_TUESDAY, 0, 3) . ' ',
171
            mb_substr(_CAL_WEDNESDAY, 0, 3) . ' ',
172
            mb_substr(_CAL_THURSDAY, 0, 3) . ' ',
173
            mb_substr(_CAL_FRIDAY, 0, 3) . ' ',
174
            mb_substr(_CAL_SATURDAY, 0, 3) . ' ',
175
        ];
176
177
        return \preg_replace($patterns, $replacements, \date($format, $timestamp));
178
    }
179
180
    /**
181
     * @param $event_recur_rules
182
     *
183
     * @return string
184
     */
185
    public function getFormatedReccurRule($event_recur_rules)
186
    {
187
        $eventOptions = \explode('|', $event_recur_rules);
188
189
        switch ($eventOptions[0]) {
190
            case 'daily':
191
192
                $interval = $eventOptions[1];
193
194
                return \sprintf(\_MD_EXTCAL_RR_DAILY, $interval);
195
                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
196
            case 'weekly':
197
198
                $daysName = [
199
                    'MO' => _CAL_MONDAY,
200
                    'TU' => _CAL_TUESDAY,
201
                    'WE' => _CAL_WEDNESDAY,
202
                    'TH' => _CAL_THURSDAY,
203
                    'FR' => _CAL_FRIDAY,
204
                    'SA' => _CAL_SATURDAY,
205
                    'SU' => _CAL_SUNDAY,
206
                ];
207
208
                $interval = $eventOptions[1];
209
                \array_shift($eventOptions);
210
                \array_shift($eventOptions);
211
                $day = '';
212
                foreach ($eventOptions as $option) {
213
                    $day .= ' ' . $daysName[$option] . ', ';
214
                }
215
                $ret = \sprintf(\_MD_EXTCAL_RR_WEEKLY, $day, $interval);
216
217
                return $ret;
218
                break;
219
            case 'monthly':
220
221
                $monthDays = [
222
                    '1MO'  => \_MD_EXTCAL_1_MO,
223
                    '1TU'  => \_MD_EXTCAL_1_TU,
224
                    '1WE'  => \_MD_EXTCAL_1_WE,
225
                    '1TH'  => \_MD_EXTCAL_1_TH,
226
                    '1FR'  => \_MD_EXTCAL_1_FR,
227
                    '1SA'  => \_MD_EXTCAL_1_SA,
228
                    '1SU'  => \_MD_EXTCAL_1_SU,
229
                    '2MO'  => \_MD_EXTCAL_2_MO,
230
                    '2TU'  => \_MD_EXTCAL_2_TU,
231
                    '2WE'  => \_MD_EXTCAL_2_WE,
232
                    '2TH'  => \_MD_EXTCAL_2_TH,
233
                    '2FR'  => \_MD_EXTCAL_2_FR,
234
                    '2SA'  => \_MD_EXTCAL_2_SA,
235
                    '2SU'  => \_MD_EXTCAL_2_SU,
236
                    '3MO'  => \_MD_EXTCAL_3_MO,
237
                    '3TU'  => \_MD_EXTCAL_3_TU,
238
                    '3WE'  => \_MD_EXTCAL_3_WE,
239
                    '3TH'  => \_MD_EXTCAL_3_TH,
240
                    '3FR'  => \_MD_EXTCAL_3_FR,
241
                    '3SA'  => \_MD_EXTCAL_3_SA,
242
                    '3SU'  => \_MD_EXTCAL_3_SU,
243
                    '4MO'  => \_MD_EXTCAL_4_MO,
244
                    '4TU'  => \_MD_EXTCAL_4_TU,
245
                    '4WE'  => \_MD_EXTCAL_4_WE,
246
                    '4TH'  => \_MD_EXTCAL_4_TH,
247
                    '4FR'  => \_MD_EXTCAL_4_FR,
248
                    '4SA'  => \_MD_EXTCAL_4_SA,
249
                    '4SU'  => \_MD_EXTCAL_4_SU,
250
                    '-1MO' => \_MD_EXTCAL_LAST_MO,
251
                    '-1TU' => \_MD_EXTCAL_LAST_TU,
252
                    '-1WE' => \_MD_EXTCAL_LAST_WE,
253
                    '-1TH' => \_MD_EXTCAL_LAST_TH,
254
                    '-1FR' => \_MD_EXTCAL_LAST_FR,
255
                    '-1SA' => \_MD_EXTCAL_LAST_SA,
256
                    '-1SU' => \_MD_EXTCAL_LAST_SU,
257
                ];
258
259
                $interval = $eventOptions[1];
260
                if (0 === mb_strpos($eventOptions[2], 'MD')) {
261
                    return \sprintf(\_MD_EXTCAL_RR_MONTHLY, mb_substr($eventOptions[2], 2), $interval);
262
                }
263
264
                return \sprintf(\_MD_EXTCAL_RR_MONTHLY, $monthDays[$eventOptions[2]], $interval);
265
                break;
266
            case 'yearly':
267
268
                $monthDays = [
269
                    '1MO'  => \_MD_EXTCAL_1_MO,
270
                    '1TU'  => \_MD_EXTCAL_1_TU,
271
                    '1WE'  => \_MD_EXTCAL_1_WE,
272
                    '1TH'  => \_MD_EXTCAL_1_TH,
273
                    '1FR'  => \_MD_EXTCAL_1_FR,
274
                    '1SA'  => \_MD_EXTCAL_1_SA,
275
                    '1SU'  => \_MD_EXTCAL_1_SU,
276
                    '2MO'  => \_MD_EXTCAL_2_MO,
277
                    '2TU'  => \_MD_EXTCAL_2_TU,
278
                    '2WE'  => \_MD_EXTCAL_2_WE,
279
                    '2TH'  => \_MD_EXTCAL_2_TH,
280
                    '2FR'  => \_MD_EXTCAL_2_FR,
281
                    '2SA'  => \_MD_EXTCAL_2_SA,
282
                    '2SU'  => \_MD_EXTCAL_2_SU,
283
                    '3MO'  => \_MD_EXTCAL_3_MO,
284
                    '3TU'  => \_MD_EXTCAL_3_TU,
285
                    '3WE'  => \_MD_EXTCAL_3_WE,
286
                    '3TH'  => \_MD_EXTCAL_3_TH,
287
                    '3FR'  => \_MD_EXTCAL_3_FR,
288
                    '3SA'  => \_MD_EXTCAL_3_SA,
289
                    '3SU'  => \_MD_EXTCAL_3_SU,
290
                    '4MO'  => \_MD_EXTCAL_4_MO,
291
                    '4TU'  => \_MD_EXTCAL_4_TU,
292
                    '4WE'  => \_MD_EXTCAL_4_WE,
293
                    '4TH'  => \_MD_EXTCAL_4_TH,
294
                    '4FR'  => \_MD_EXTCAL_4_FR,
295
                    '4SA'  => \_MD_EXTCAL_4_SA,
296
                    '4SU'  => \_MD_EXTCAL_4_SU,
297
                    '-1MO' => \_MD_EXTCAL_LAST_MO,
298
                    '-1TU' => \_MD_EXTCAL_LAST_TU,
299
                    '-1WE' => \_MD_EXTCAL_LAST_WE,
300
                    '-1TH' => \_MD_EXTCAL_LAST_TH,
301
                    '-1FR' => \_MD_EXTCAL_LAST_FR,
302
                    '-1SA' => \_MD_EXTCAL_LAST_SA,
303
                    '-1SU' => \_MD_EXTCAL_LAST_SU,
304
                ];
305
306
                $monthName = [
307
                    1  => _CAL_JANUARY,
308
                    2  => _CAL_FEBRUARY,
309
                    3  => _CAL_MARCH,
310
                    4  => _CAL_APRIL,
311
                    5  => _CAL_MAY,
312
                    6  => _CAL_JUNE,
313
                    7  => _CAL_JULY,
314
                    8  => _CAL_AUGUST,
315
                    9  => _CAL_SEPTEMBER,
316
                    10 => _CAL_OCTOBER,
317
                    11 => _CAL_NOVEMBER,
318
                    12 => _CAL_DECEMBER,
319
                ];
320
321
                $interval = $eventOptions[1];
322
                $day      = $eventOptions[2];
323
                \array_shift($eventOptions);
324
                \array_shift($eventOptions);
325
                \array_shift($eventOptions);
326
                $month = '';
327
                foreach ($eventOptions as $option) {
328
                    $month .= ' ' . $monthName[$option] . ', ';
329
                }
330
                $dayString = $day;
331
                if (\array_key_exists($day, $monthDays)) {
332
                    $dayString = $monthDays[$day];
333
                }
334
                $ret = \sprintf(\_MD_EXTCAL_RR_YEARLY, $month, $dayString, $interval);
335
336
                return $ret;
337
                break;
338
        }
339
340
        return false;
341
    }
342
}
343