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.

admin/event.php (10 issues)

1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
use XoopsModules\Extcal\{Helper,
21
    EventHandler,
22
    FileHandler,
23
    Utility,
24
    CategoryHandler,
25
    EventmemberHandler,
26
    LocationHandler
27
};
28
use Xmf\Module\Admin;
29
use Xmf\Request;
30
31
require_once __DIR__ . '/admin_header.php';
32
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
33
// require_once  dirname(__DIR__) . '/class/form/extcalform.php';
34
35
// require_once  dirname(__DIR__) . '/class/Utility.php';
36
37
/** @var Helper $helper */
38
$helper = Helper::getInstance();
39
40
//TODO get individual variables
41
$gepeto = array_merge($_GET, $_POST);
42
//while (list($k, $v) = each($gepeto)) {
43
foreach ($gepeto as $k => $v) {
44
    ${$k} = $v;
45
}
46
47
$op = Request::getCmd('op', '');
48
49
//--------------------------------------------------------------------
50
/**
51
 * @param $ids
52
 *
53
 * @return bool
54
 */
55
function deleteEvents($ids)
56
{
57
    /** @var EventHandler $eventHandler */
58
    $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
59
    $criteria     = new \Criteria('event_id', "($ids)", 'IN');
60
61
    //Supression des images
62
    $rst = $eventHandler->getAllEvents($criteria);
63
64
    //    while (list($k, $t) = each($rst)) {
65
    foreach ($rst as $k => $t) {
66
        if ('' != $t['event_picture1']) {
67
            $f = XOOPS_ROOT_PATH . '/uploads/extcal/' . $t['event_picture1'];
68
            unlink($f);
69
            echo $f . '<br>';
70
        }
71
72
        if ('' != $t['event_picture2']) {
73
            $f = XOOPS_ROOT_PATH . '/uploads/extcal/' . $t['event_picture1'];
74
            unlink($f);
75
            echo $f . '<br>';
76
        }
77
    }
78
79
    //Supression des enregistrements
80
    $eventHandler->deleteAllEvents($criteria);
81
82
    return true;
83
}
84
85
switch ($op) {
86
    case 'enreg':
87
88
        $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
89
        $fileHandler  = Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE);
90
        // $t = print_r($_POST,true);
91
        // echo "<pre>{$t}</pre><br>";
92
        // exit;
93
        // If the date format is wrong
94
        //        if (
95
        //            !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date'])
96
        //                || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date'])
97
        //        ) {
98
        //            redirect_header(
99
        //                'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>"
100
        //                . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
101
        //            );
102
        //            exit;
103
        //        }
104
105
        //exit;
106
        ///////////////////////////////////////////////////////////////////////////////
107
        Utility::loadImg($_REQUEST, $event_picture1, $event_picture2);
108
        ///////////////////////////////////////////////////////////////////////////////
109
        $data = [
110
            'event_title'        => Request::getString('event_title', '', 'POST'),
111
            'cat_id'             => Request::getInt('cat_id', 0, 'POST'),
112
            'event_desc'         => Request::getString('event_desc', '', 'POST'),
113
            'event_nbmember'     => Request::getInt('event_nbmember', 0, 'POST'),
114
            'event_organisateur' => Request::getString('event_organisateur', '', 'POST'),
115
            'event_contact'      => Request::getString('event_contact', '', 'POST'),
116
            'event_url'          => Request::getString('event_url', '', 'POST'),
117
            'event_email'        => Request::getString('event_email', '', 'POST'),
118
            'event_address'      => Request::getString('event_address', '', 'POST'),
119
            'event_approved'     => 1,
120
            'event_start'        => Request::getArray('event_start', [], 'POST'),
121
            'have_end'           => Request::getInt('have_end', 0, 'POST'),
122
            'event_end'          => Request::getArray('event_end', [], 'POST'),
123
            'event_picture1'     => @$event_picture1,
124
            'event_picture2'     => @$event_picture2,
125
            'event_price'        => @Request::getString('event_price', '', 'POST'),
126
            'event_location'     => Request::getInt('event_location', 0, 'POST'),
127
            'dohtml'             => $helper->getConfig('allow_html'),
128
            'event_icone'        => Request::getString('event_icone', '', 'POST'),
129
        ];
130
131
        // Event edited
132
        if (Request::hasVar('event_id', 'POST')) {
133
            if (!$eventHandler->modifyEvent(Request::getInt('event_id', 0, 'POST'), $data)) {
0 ignored issues
show
The method modifyEvent() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

133
            if (!$eventHandler->/** @scrutinizer ignore-call */ modifyEvent(Request::getInt('event_id', 0, 'POST'), $data)) {
Loading history...
134
                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false);
135
            } else {
136
                $fileHandler->createFile(Request::getInt('event_id', 0, 'POST'));
0 ignored issues
show
The method createFile() does not exist on XoopsObjectHandler. Did you maybe mean create()? ( Ignorable by Annotation )

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

136
                $fileHandler->/** @scrutinizer ignore-call */ 
137
                              createFile(Request::getInt('event_id', 0, 'POST'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDITED, false);
138
            }
139
            // New event
140
        } else {
141
            /** @var \XoopsNotificationHandler $notificationHandler */
142
            $notificationHandler = xoops_getHandler('notification');
143
            /** @var CategoryHandler $categoryHandler */
144
            $categoryHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
145
146
            $data['event_submitter']  = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
147
            $data['event_submitdate'] = time();
148
149
            if ($eventHandler->createEvent($data)) {
0 ignored issues
show
The method createEvent() does not exist on XoopsObjectHandler. Did you maybe mean create()? ( Ignorable by Annotation )

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

149
            if ($eventHandler->/** @scrutinizer ignore-call */ createEvent($data)) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
150
                $fileHandler->createFile($eventHandler->getInsertId());
0 ignored issues
show
The method getInsertId() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

150
                $fileHandler->createFile($eventHandler->/** @scrutinizer ignore-call */ getInsertId());
Loading history...
151
                $cat = $categoryHandler->getCat(Request::getInt('cat_id', 0, 'POST'), $xoopsUser, 'all');
152
                $notificationHandler->triggerEvent('global', 0, 'new_event', ['EVENT_TITLE' => Request::getString('event_title', '', 'POST')]);
153
                $notificationHandler->triggerEvent(
154
                    'category',
155
                    Request::getInt('cat_id', 0, 'POST'),
156
                    'new_event_cat',
157
                    [
158
                        'EVENT_TITLE' => Request::getString('event_title', '', 'POST'),
159
                        'CAT_NAME'    => $cat->getVar('cat_name'),
160
                    ]
161
                );
162
                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATED, false);
163
            } else {
164
                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false);
165
            }
166
        }
167
        break;
168
    case 'clone': /* sur validation du formulaire */
169
    case 'modify':
170
        $action = (('clone' === $op) ? 'clone' : 'edit');
171
        xoops_cp_header();
172
        //================================================
173
        // require_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php');
174
        //
175
        //        // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com
176
        //        $dateBirthday = new \XoopsTcCalendar("datez1", true, false);
177
        //        //$dateBirthday->setIcon("/images/iconCalendar.gif");
178
        //        $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif");
179
        //        //$dateBirthday->rtl=false;
180
        //        $dateBirthday->setAutoHide(false);
181
        //
182
        //       //$myCalendar->setDate(date('d'), date('m'), date('Y'));
183
        //       //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']);
184
        //        $dateBirthday->setDate(date('d'), date('m'), date('Y'));
185
        //
186
        //        $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/");
187
        //        $dateBirthday->zindex = 150; //default 1
188
        //        $dateBirthday->setYearInterval(1995, date('Y'));
189
        //        $dateBirthday->dateAllow('1960-03-01', date('Y-m-d'));
190
        //        //$dateBirthday->autoSubmit(true, "calendar");
191
        //        $dateBirthday->disabledDay("sat");
192
        //        $dateBirthday->disabledDay("sun");
193
        //        $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month');
194
        //        $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year');
195
        //        $dateBirthday->setAlignment('right', 'bottom'); //optional
196
        // echo "<table><tr><td>zzzzz</td><td></td><td>";
197
        // echo $dateBirthday->render();
198
        // echo "</td></tr></table>";
199
        //echo $dateBirthday->render();
200
        //================================================
201
        // @author      Gregory Mage (Aka Mage)
202
        //***************************************************************************************
203
        //         require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
204
        $adminObject = Admin::getInstance();
205
        $adminObject->displayNavigation(basename(__FILE__));
206
        //***************************************************************************************
207
208
        $eventId      = $_GET['event_id'];
209
        $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
210
211
        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>';
212
213
        /** @var \XoopsThemeForm $form */
214
        $form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId]);
0 ignored issues
show
The method getEventForm() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

214
        /** @scrutinizer ignore-call */ 
215
        $form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId]);
Loading history...
215
        if ($form) {
216
            $form->display();
217
        }
218
219
        echo '</fieldset><br>';
220
221
        xoops_cp_footer();
222
223
        break;
224
    case 'clone2': /* sur clique de l'icone du formulaire*/
225
226
        //$newEventId = 1;
227
        $eventId      = Request::getInt('event_id', 0, 'GET');
228
        $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
229
        $event        = $eventHandler->getEvent($eventId);
0 ignored issues
show
The method getEvent() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

229
        /** @scrutinizer ignore-call */ 
230
        $event        = $eventHandler->getEvent($eventId);
Loading history...
230
        $t            = $event->getVars();
231
        $data         = [];
232
        //        while (list($key, $val) = each($t)) {
233
        foreach ($t as $key => $val) {
234
            $data[$key] = $val['value'];
235
        }
236
237
        $data['event_id']    = 0;
238
        $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')';
239
240
        $newEvent = $eventHandler->create();
241
        $newEvent->setVars($data);
242
        $t = $eventHandler->insert($newEvent, true);
243
244
        $newEventId = $newEvent->getVar('event_id');
245
        $ts         = print_r($newEventId, true);
246
247
        redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false);
248
        break;
249
    case 'delete':
250
251
        if (Request::hasVar('confirm', 'POST')) {
252
            if (!$GLOBALS['xoopsSecurity']->check()) {
253
                redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
254
            }
255
            //             $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
256
            //             $eventHandler->deleteEvent($_POST['event_id']);
257
            deleteEvents(Request::getInt('event_id', 0, 'POST'));
258
            redirect_header('event.php', 3, _AM_EXTCAL_EVENT_DELETED, false);
259
        } else {
260
            xoops_cp_header();
261
            // @author      Gregory Mage (Aka Mage)
262
            //***************************************************************************************
263
            //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
264
            $adminObject = Admin::getInstance();
265
            $adminObject->displayNavigation(basename(__FILE__));
266
            //***************************************************************************************
267
268
            $hiddens = ['event_id' => Request::getInt('event_id', 0, 'GET'), 'form_delete' => '', 'confirm' => 1];
269
            xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php');
270
271
            xoops_cp_footer();
272
        }
273
274
        break;
275
    case 'deleteSelection':
276
277
        xoops_cp_header();
278
        // @author      Gregory Mage (Aka Mage)
279
        //***************************************************************************************
280
        //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
281
        $adminObject = Admin::getInstance();
282
        $adminObject->displayNavigation(basename(__FILE__));
283
        //***************************************************************************************
284
        if (isset($_POST['deleteSelection'][0])) {
285
            $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL;
286
            $ids = array_keys($_POST['deleteAllEvents']);
287
        } else {
288
            $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION;
289
            $ids = array_keys($_POST['deleteEvents']);
290
        }
291
292
        //           $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION);
293
        //           $ids = array_keys($_POST['deleteEvents']);
294
        $ids = implode(',', $ids);
295
        //echo $ids.'<br>';
296
        $hiddens = ['event_ids' => $ids, 'form_delete' => '', 'confirm' => 1];
297
        //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1);
298
        xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php');
299
300
        xoops_cp_footer();
301
302
        break;
303
    case 'deleteSelectionOK':
304
        //-----------------------------------------
305
        // $t = print_r($_GET,true);
306
        // echo "<hr><pre>{$t}</pre><hr>";
307
        //
308
        // $t = print_r($_POST,true);
309
        // echo "<hr><pre>{$t}</pre><hr>";
310
        // exit;
311
        //-----------------------------------------
312
313
        if (isset($_POST['deleteSelection'][0])) {
314
        } else {
315
            if (!$GLOBALS['xoopsSecurity']->check()) {
316
                redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
317
            }
318
319
            deleteEvents($_POST['event_ids']);
320
321
            redirect_header('event.php', 3, _AM_EXTCAL_EVENTS_DELETED, false);
322
        }
323
324
        break;
325
    case 'default':
326
    default:
327
328
        $start          = Request::getInt('start', 0, 'GET');
329
        $nbEventsByPage = $helper->getConfig('nbEventsByPage');
330
331
        xoops_cp_header();
332
        // @author      Gregory Mage (Aka Mage)
333
        //***************************************************************************************
334
335
        $adminObject = Admin::getInstance();
336
        $adminObject->displayNavigation(basename(__FILE__));
337
        //***************************************************************************************
338
339
        $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
340
        $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']);
0 ignored issues
show
The method getNewEvent() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

340
        $events       = $eventHandler->objectToArray($eventHandler->/** @scrutinizer ignore-call */ getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']);
Loading history...
The method objectToArray() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

340
        /** @scrutinizer ignore-call */ 
341
        $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']);
Loading history...
341
        $eventHandler->formatEventsDate($events, _SHORTDATESTRING);
0 ignored issues
show
The method formatEventsDate() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

341
        $eventHandler->/** @scrutinizer ignore-call */ 
342
                       formatEventsDate($events, _SHORTDATESTRING);
Loading history...
342
343
        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>';
344
        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
345
        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
346
        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;>&nbsp;&nbsp;". _AM_EXTCAL_INFO_DELETE;
347
348
        echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
349
        echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE . '<br>';
350
351
        echo '</fieldset><br>';
352
353
        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>';
354
355
        echo '<form method="POST" action="event.php">';
356
        echo '<input type="hidden" name="op" value="deleteSelection">';
357
358
        echo '<table class="outer" style="width:100%;">';
359
        echo '<tr style="text-align:center;">';
360
        echo '<th>' . _AM_EXTCAL_DELETE . '</th>';
361
        echo '<th>#</th>';
362
        echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
363
        echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
364
        echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
365
        echo '<th>' . _AM_EXTCAL_END_DATE . '</th>';
366
        echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>';
367
        echo '<th>' . _AM_EXTCAL_START_RULES . '</th>';
368
        echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
369
370
        echo '</tr>';
371
372
        if (count($events) > 0) {
0 ignored issues
show
It seems like $events can also be of type null; however, parameter $value of count() does only seem to accept Countable|array, 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

372
        if (count(/** @scrutinizer ignore-type */ $events) > 0) {
Loading history...
373
            $i = 0;
374
            foreach ($events as $event) {
375
                $class = (0 == ++$i % 2) ? 'even' : 'odd';
376
                echo '<tr style="text-align:left;" class="' . $class . '">';
377
                echo "<td width='10%' align='center'>";
378
                echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >";
379
                echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1'>";
380
                echo '</td>';
381
                echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>';
382
                echo "<td  width='10%'>" . '<a href=cat.php?op=modify&amp;cat_id=' . $event['cat']['cat_id'] . '&form_modify' . '>' . $event['cat']['cat_name'] . '</a>' . '</td>';
383
384
                echo '<td>' . '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>';
385
386
                //                 if ($event['event_isrecur']) {
387
                //                     echo '<td>' . $event['formated_reccur_rule'] . '</td>';
388
                //                 } else {
389
                //                     echo '<td>' . $event['formated_event_start'] . '</td>';
390
                //                 }
391
392
                echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>';
393
                echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>';
394
                echo '<td align="center">' . ((1 == $event['event_isrecur']) ? _YES : _NO) . '</td>';
395
                if (!isset($event['formated_reccur_rule'])) {
396
                    $event['formated_reccur_rule'] = '';
397
                }
398
                echo '<td>' . $event['formated_reccur_rule'] . '</td>';
399
400
                echo '<td style="width:10%; text-align:center;">';
401
                echo '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/edit.png' title='" . _AM_EXTCAL_ICONE_EDIT . "'></a>&nbsp;&nbsp;";
402
                echo '<a href=event.php?op=delete&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/delete.png' title='" . _AM_EXTCAL_ICONE_DELETE . "'></a>&nbsp;&nbsp;";
403
                echo '<a href=event.php?op=clone&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "'></a>";
404
                echo '</td>';
405
406
                echo '</tr>';
407
            }
408
            //---------------------------------------------------------
409
            $pageNav = new \XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start);
410
411
            echo '<tr><td colspan="2" style="text-align: right;">';
412
            echo $pageNav->renderNav(2);
413
            echo '</td>';
414
415
            echo '<td colspan="2" style="text-align: right;">';
416
417
            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">';
418
            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">';
419
420
            echo '</td>';
421
            echo '</tr>';
422
        } else {
423
            echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
424
        }
425
        echo '</table>';
426
        echo '</form>';
427
428
        echo '</fieldset>';
429
        echo '</fieldset><br><br>';
430
        //Fin de la liste des evennement -------------------------------------
431
        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>';
432
433
        /** @var \XoopsThemeForm $form */
434
        $form = $eventHandler->getEventForm('admin');
435
        $form->display();
436
437
        echo '</fieldset>';
438
439
        require_once __DIR__ . '/admin_footer.php';
440
441
        break;
442
}
443