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.

include/agenda_fnc.php (6 issues)

1
<?php
2
/**
3
 * classGenerator
4
 * walls_watermarks.
5
 *
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 *
13
 *
14
 *
15
 * L'utilisation de ce formulaire d'adminitration suppose
16
 * que la classe correspondante de la table a été générées avec classGenerator
17
 **/
18
19
use XoopsModules\Extcal\{Helper,
20
    Time,
21
    CategoryHandler
22
23
};
24
25
/** @var Helper $helper */
26
define('_EXTCAL_FORMAT_AGENDA_KEYD', 'Y-m-d');
27
define('_EXTCAL_FORMAT_AGENDA_KEYT', 'H:i');
28
29
require_once __DIR__ . '/constantes.php';
30
31
$moduleDirName = basename(dirname(__DIR__));
32
Helper::getInstance()->loadLanguage('main');
33
34
/*******************************************************************
35
 *
36
 ******************************************************************
37
 * @param        $ts
38
 * @param        $hStart
39
 * @param        $hEnd
40
 * @param int    $mPlage
41
 * @param int    $nbJours
42
 * @param        $formatDate
43
 * @param string $formatJour
44
 *
45
 * @return array
46
 */
47
48
function agenda_getCanevas($ts, $hStart, $hEnd, $mPlage = 15, $nbJours = 1, $formatDate = '', $formatJour = 'H:i')
49
{
50
    $helper = Helper::getInstance();
51
    $jour   = date('d', $ts);
52
    $mois   = date('m', $ts);
53
    $an     = date('Y', $ts);
54
    if (!isset($formatDate)) {
55
        $formatDate = $helper->getConfig('event_date_week');
56
    }
57
58
    //echo "agenda_getCanevas : {$jour}-{$mois}-{$an}-{$ts}<br>";
59
    //$tsStart = mktime($heure, $minute, $seconde, $mois, $jour, $an);
60
    $jName = [
61
        _MD_EXTCAL_DAY_SUNDAY,
62
        _MD_EXTCAL_DAY_MONDAY,
63
        _MD_EXTCAL_DAY_TUESDAY,
64
        _MD_EXTCAL_DAY_WEDNESDAY,
65
        _MD_EXTCAL_DAY_THURSDAY,
66
        _MD_EXTCAL_DAY_FRIDAY,
67
        _MD_EXTCAL_DAY_SATURDAY,
68
    ];
69
70
    $tj = [];
71
    for ($j = 0; $j < $nbJours; ++$j) {
72
        $tsj                = mktime(0, 0, 0, $mois, $jour + $j, $an);
0 ignored issues
show
$mois of type string is incompatible with the type integer expected by parameter $month of mktime(). ( Ignorable by Annotation )

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

72
        $tsj                = mktime(0, 0, 0, /** @scrutinizer ignore-type */ $mois, $jour + $j, $an);
Loading history...
$an of type string is incompatible with the type integer expected by parameter $year of mktime(). ( Ignorable by Annotation )

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

72
        $tsj                = mktime(0, 0, 0, $mois, $jour + $j, /** @scrutinizer ignore-type */ $an);
Loading history...
73
        $kj                 = date(_EXTCAL_FORMAT_AGENDA_KEYD, $tsj);
74
        $tj[$kj]['caption'] = date($formatDate, $tsj);
75
76
        $tj[$kj]['events'] = [];
77
78
        $tj[$kj]['dayWeek'] = date('w', $tsj);
79
        $tj[$kj]['jour']    = $jName[$tj[$kj]['dayWeek']]; //date('l', $tsj);
80
        if (0 == $tj[$kj]['dayWeek']) {
81
            $tj[$kj]['bg'] = "background='" . XOOPS_URL . "/modules/extcal/assets/images/trame.png'";
82
        } else {
83
            $tj[$kj]['bg'] = '';
84
        }
85
    }
86
87
    //echo "{$hStart}-{$hEnd}-{$mPlage}<br>";
88
    $sPlage  = $mPlage * _EXTCAL_TS_MINUTE; // en secondes
89
    $tsStart = mktime($hStart, 0, 0, 1, 1, 2000);
90
    $tsEnd   = mktime($hEnd + 1, 0, 0, 1, 1, 2000);
91
92
    $ta = [];
93
    if ($hStart > 0) {
94
        $tsCurent          = mktime(0, 0, 0, 1, 1, 2000);
95
        $k                 = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
96
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
97
        $ta[$k]['jours']   = $tj;
98
        $ta[$k]['class']   = 'head';
99
    }
100
101
    $tsCurent = $tsStart;
102
    $h        = 0;
103
    while ($tsCurent < $tsEnd) {
104
        $k = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
105
        //echo "{$k}-$tsCurent-";
106
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
107
        $ta[$k]['jours']   = $tj;
108
        $ta[$k]['class']   = ((0 == ($h % 2)) ? 'odd' : 'even');
109
110
        //----------------------------------------------
111
        ++$h;
112
        $tsCurent += $sPlage;
113
    }
114
115
    if ($hEnd < 23) {
116
        $tsCurent          = mktime($hEnd + 1, 0, 0, 1, 1, 2000);
117
        $k                 = date(_EXTCAL_FORMAT_AGENDA_KEYT, $tsCurent);
118
        $ta[$k]['caption'] = date($formatJour, $tsCurent);
119
        $ta[$k]['jours']   = $tj;
120
        $ta[$k]['class']   = 'foot';
121
    }
122
123
    return $ta;
124
}
125
126
/*******************************************************************
127
 *
128
 ******************************************************************
129
 * @param        $eventsArray
130
 * @param        $ts
131
 * @param        $hStart
132
 * @param        $hEnd
133
 * @param int    $mPlage
134
 * @param int    $nbJours
135
 * @param string $formatDate
136
 * @param string $formatJour
137
 * @return array
138
 */
139
function agenda_getEvents(
140
    $eventsArray,
141
    $ts,
142
    $hStart,
143
    $hEnd,
144
    $mPlage = 15,
145
    $nbJours = 1,
146
    $formatDate = 'd-m-Y',
147
    $formatJour = 'H:i'
148
) {
149
    //    $tAgenda = agenda_getCanevas($ts, 8, 20, $mPlage, $nbJours);
150
    $tAgenda = agenda_getCanevas($ts, $hStart, $hEnd - 1, $mPlage, $nbJours, $formatDate, $formatJour);
151
    $tk      = array_keys($tAgenda);
152
    $tk0     = $tk[0];
153
    $tk1     = $tk[count($tk) - 1];
154
155
    foreach ($eventsArray as $e) {
156
        $ts     = $e['event_start'];
157
        $kd     = date(_EXTCAL_FORMAT_AGENDA_KEYD, $ts);
158
        $hour   = date('H', $ts);
159
        $minute = date('i', $ts);
160
        $m      = (int)($minute / $mPlage) * $mPlage;
161
        //      echo "--->{$minute} / {$mPlage} = {$m}<br>";
162
        $sMinute = (($m < 10) ? '0' . $m : $m);
163
        //$kt = date(_EXTCAL_FORMAT_AGENDA_KEYT, $ts);
164
        if ($hour < $hStart) {
165
            $kt = $tk0;
166
        } elseif ($hour >= ($hEnd + 1)) {
167
            $kt = $tk1;
168
        } else {
169
            $kt = $hour . ':' . $sMinute;
170
        }
171
172
        $tAgenda[$kt]['jours'][$kd]['events'][] = $e;
173
    }
174
175
    return $tAgenda;
176
}
177
178
/*******************************************************************
179
 *
180
 *******************************************************************/
181
function test_getAgenda()
182
{
183
    $tsD1 = mktime(0, 0, 0, 01, 25, 1954);
184
    $t    = getAgenda($tsD1, 8, 21, 30, 7);
0 ignored issues
show
The function getAgenda was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

184
    $t    = /** @scrutinizer ignore-call */ getAgenda($tsD1, 8, 21, 30, 7);
Loading history...
185
186
    $t['10:30']['jours']['1954-01-25']['events'][1]['lib'] = 'Jean';
187
    $t['10:30']['jours']['1954-01-25']['events'][1]['dsc'] = 'bobo';
188
189
    $t['10:30']['jours']['1954-01-25']['events'][7]['lib'] = 'polo';
190
    $t['10:30']['jours']['1954-01-25']['events'][7]['dsc'] = 'haribo';
191
192
    $t['11:30']['jours']['1954-01-28']['events'][5]['lib'] = 'Jean';
193
    $t['11:30']['jours']['1954-01-28']['events'][5]['dsc'] = 'bibi';
194
195
    $exp = print_r($t, true);
196
    echo "<pre>{$exp}</pre>";
197
}
198
199
/*******************************************************************
200
 *
201
 ******************************************************************
202
 * @param $event1
203
 * @param $event2
204
 * @return int
205
 */
206
function orderEvents($event1, $event2)
207
{
208
    if ($event1['event_start'] == $event2['event_start']) {
209
        return 0;
210
    }
211
    if ('ASC' === $GLOBALS['xoopsModuleConfig']['sort_order']) {
212
        $opt1 = -1;
213
        $opt2 = 1;
214
    } else {
215
        $opt1 = 1;
216
        $opt2 = -1;
217
    }
218
219
    return ($event1['event_start'] < $event2['event_start']) ? $opt1 : $opt2;
220
}
221
222
/*******************************************************************
223
 *
224
 ******************************************************************
225
 * @param        $year
226
 * @param int    $nbYearsBefore
227
 * @param int    $nbYearsAfter
228
 * @param bool   $addNone
229
 * @param string $name
230
 * @return \XoopsFormSelect
231
 */
232
function getListYears($year, $nbYearsBefore = 0, $nbYearsAfter = 5, $addNone = false, $name = 'year')
233
{
234
    // Year selectbox
235
    $select = new \XoopsFormSelect('', $name, $year);
236
    if ($addNone) {
237
        $select->addOption(0, ' ');
238
    }
239
    if (0 == $year) {
240
        $year = date('Y');
241
    }
242
243
    for ($i = $year - $nbYearsBefore; $i < ($year + $nbYearsAfter); ++$i) {
244
        $select->addOption($i);
245
    }
246
247
    return $select;
248
}
249
250
/*******************************************************************
251
 *
252
 ******************************************************************
253
 * @param        $month
254
 * @param bool   $addNone
255
 * @param string $name
256
 * @return \XoopsFormSelect
257
 */
258
function getListMonths($month, $addNone = false, $name = 'month')
259
{
260
    // Month selectbox
261
    $timeHandler = Time::getHandler();
262
263
    $select = new \XoopsFormSelect('', $name, $month);
264
    if ($addNone) {
265
        $select->addOption(0, ' ');
266
    }
267
268
    for ($i = 1; $i < 13; ++$i) {
269
        $select->addOption($i, $timeHandler->getMonthName($i));
270
    }
271
272
    return $select;
273
}
274
275
/*******************************************************************
276
 *
277
 ******************************************************************
278
 * @param      $day
279
 * @param bool $addNone
280
 * @return \XoopsFormSelect
281
 */
282
function getListDays($day, $addNone = false)
283
{
284
    // Day selectbox
285
    $select = new \XoopsFormSelect('', 'day', $day);
286
    if ($addNone) {
287
        $select->addOption(0, ' ');
288
    }
289
290
    for ($i = 1; $i < 32; ++$i) {
291
        $select->addOption($i);
292
    }
293
294
    return $select;
295
}
296
297
/*******************************************************************
298
 *
299
 ******************************************************************
300
 * @param $name
301
 * @return bool
302
 */
303
function ext_loadLanguage($name)
304
{
305
    global $xoopsConfig;
306
    $prefix = mb_substr($name, 4);
307
    switch ($prefix) {
308
        case '_MI_':
309
            $f = '';
310
            break;
311
        case '_MD_':
312
            $f = '';
313
            break;
314
        default:
315
            return false;
316
    }
317
318
    $file   = XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/' . $f;
319
    $prefix = (defined($name) ? '_MI' : '_MD');
0 ignored issues
show
The assignment to $prefix is dead and can be removed.
Loading history...
320
    require_once $file;
321
}
322
323
/*******************************************************************
324
 *
325
 ******************************************************************
326
 * @param string $currentTab
327
 * @return array
328
 */
329
330
function getNavBarTabs($currentTab = '')
331
{
332
    /** @var Helper $helper */
333
    $helper = Helper::getInstance();
334
335
    ext_loadLanguage('_MD_');
336
337
    $visibleTabs = $helper->getConfig('visible_tabs');
338
    $tNavBar     = $ordre = [];
339
340
    $sep     = '=';
341
    $tabs    = str_replace("\n", $sep, $helper->getConfig('weight_tabs'));
342
    $tabs    = str_replace("\r", '', $tabs);
343
    $tabs    = str_replace(' ', '', $tabs);
344
    $t       = explode($sep, $tabs);
345
    $tWeight = array_flip($t);
346
347
    if (is_array($visibleTabs)) {
348
        //-----------------------------------------------------------------
349
        $view = _EXTCAL_NAV_CALMONTH;
350
        //   echo "{$view} - {$currentTab}<br>";
351
        //   echoArray($visibleTabs,true);
352
    if (in_array($view, $visibleTabs)) {
353
            $tNavBar[$view] = [
354
                'href'    => _EXTCAL_FILE_CALMONTH,
355
                'name'    => _MD_EXTCAL_NAV_CALMONTH,
356
                'current' => ($view == $currentTab) ? 1 : 0,
357
                'weight'  => 110,
358
            ];
359
        }
360
361
        $view = _EXTCAL_NAV_CALWEEK;
362
    if (in_array($view, $visibleTabs)) {
363
            $tNavBar[$view] = [
364
                'href'    => _EXTCAL_FILE_CALWEEK,
365
                'name'    => _MD_EXTCAL_NAV_CALWEEK,
366
                'current' => ($view == $currentTab) ? 1 : 0,
367
                'weight'  => 120,
368
            ];
369
        }
370
371
        $view = _EXTCAL_NAV_YEAR;
372
        if (in_array($view, $visibleTabs)) {
373
            $tNavBar[$view] = [
374
                'href'    => _EXTCAL_FILE_YEAR,
375
                'name'    => _MD_EXTCAL_NAV_YEAR,
376
                'current' => ($view == $currentTab) ? 1 : 0,
377
                'weight'  => 130,
378
            ];
379
        }
380
381
        $view = _EXTCAL_NAV_MONTH;
382
        if (in_array($view, $visibleTabs)) {
383
            $tNavBar[$view] = [
384
                'href'    => _EXTCAL_FILE_MONTH,
385
                'name'    => _MD_EXTCAL_NAV_MONTH,
386
                'current' => ($view == $currentTab) ? 1 : 0,
387
                'weight'  => 140,
388
            ];
389
        }
390
391
        $view = _EXTCAL_NAV_WEEK;
392
        if (in_array($view, $visibleTabs)) {
393
            $tNavBar[$view] = [
394
                'href'    => _EXTCAL_FILE_WEEK,
395
                'name'    => _MD_EXTCAL_NAV_WEEK,
396
                'current' => ($view == $currentTab) ? 1 : 0,
397
                'weight'  => 150,
398
            ];
399
        }
400
401
        $view = _EXTCAL_NAV_DAY;
402
        if (in_array($view, $visibleTabs)) {
403
            $tNavBar[$view] = [
404
                'href'    => _EXTCAL_FILE_DAY,
405
                'name'    => _MD_EXTCAL_NAV_DAY,
406
                'current' => ($view == $currentTab) ? 1 : 0,
407
                'weight'  => 160,
408
            ];
409
        }
410
411
        $view = _EXTCAL_NAV_AGENDA_WEEK;
412
        if (in_array($view, $visibleTabs)) {
413
            $tNavBar[$view] = [
414
                'href'    => _EXTCAL_FILE_AGENDA_WEEK,
415
                'name'    => _MD_EXTCAL_NAV_AGENDA_WEEK,
416
                'current' => ($view == $currentTab) ? 1 : 0,
417
                'weight'  => 170,
418
            ];
419
        }
420
421
        $view = _EXTCAL_NAV_AGENDA_DAY;
422
        if (in_array($view, $visibleTabs)) {
423
            $tNavBar[$view] = [
424
                'href'    => _EXTCAL_FILE_AGENDA_DAY,
425
                'name'    => _MD_EXTCAL_NAV_AGENDA_DAY,
426
                'current' => ($view == $currentTab) ? 1 : 0,
427
                'weight'  => 180,
428
            ];
429
        }
430
431
        $view = _EXTCAL_NAV_SEARCH;
432
        if (in_array($view, $visibleTabs)) {
433
            $tNavBar[$view] = [
434
                'href'    => _EXTCAL_FILE_SEARCH,
435
                'name'    => _MD_EXTCAL_NAV_SEARCH,
436
                'current' => ($view == $currentTab) ? 1 : 0,
437
                'weight'  => 200,
438
            ];
439
        }
440
441
        $user = $GLOBALS['xoopsUser'] ?? null;
442
        /** @var CategoryHandler $categoryHandler */
443
        $categoryHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
444
        if ($categoryHandler->haveSubmitRight($user)) {
445
            $view = _EXTCAL_NAV_NEW_EVENT;
446
            if (in_array($view, $visibleTabs)) {
447
                $tNavBar[$view] = [
448
                    'href'    => _EXTCAL_FILE_NEW_EVENT,
449
                    'name'    => _MD_EXTCAL_NAV_NEW_EVENT,
450
                    'current' => ($view == $currentTab) ? 1 : 0,
451
                    'weight'  => 100,
452
                ];
453
            }
454
        }
455
    }
456
    //----------------------------------------------------------------
457
    //    $ordre = [];
458
    //    while (list($k, $v) = each($tNavBar)) {
459
    foreach ($tNavBar as $k => $v) {
460
        if (isset($tWeight[$k])) {
461
            $ordre[] = (int)$tWeight[$k]; //order defined in the module options
462
        } else {
463
            $ordre[] = $v['weight']; // default order defined in the $ tNavBar table
464
        }
465
    }
466
467
    array_multisort($tNavBar, SORT_ASC, SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC);
0 ignored issues
show
SORT_ASC cannot be passed to array_multisort() as the parameter $rest expects a reference. ( Ignorable by Annotation )

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

467
    array_multisort($tNavBar, /** @scrutinizer ignore-type */ SORT_ASC, SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC);
Loading history...
SORT_NUMERIC cannot be passed to array_multisort() as the parameter $rest expects a reference. ( Ignorable by Annotation )

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

467
    array_multisort($tNavBar, SORT_ASC, /** @scrutinizer ignore-type */ SORT_NUMERIC, $ordre, SORT_ASC, SORT_NUMERIC);
Loading history...
468
469
    return $tNavBar;
470
}
471
472
/*----------------------------------------------------------------------*/
473