Passed
Push — master ( f62223...75b16c )
by Michael
02:33
created
admin/event.php 1 patch
Switch Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -75,178 +75,196 @@  discard block
 block discarded – undo
75 75
 
76 76
 switch ($op) {
77 77
 
78
-    case 'enreg':
79
-
80
-        $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
81
-        $fileHandler  = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE);
82
-        // $t = print_r($_POST,true);
83
-        // echo "<pre>{$t}</pre><br>";
84
-        // exit;
85
-        // If the date format is wrong
86
-        //        if (
87
-        //            !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date'])
88
-        //                || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date'])
89
-        //        ) {
90
-        //            redirect_header(
91
-        //                'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>"
92
-        //                . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
93
-        //            );
94
-        //            exit;
95
-        //        }
96
-
97
-        //exit;
98
-        ///////////////////////////////////////////////////////////////////////////////
99
-        Extcal\Utility::loadImg($_REQUEST, $event_picture1, $event_picture2);
100
-        ///////////////////////////////////////////////////////////////////////////////
101
-        $data = [
102
-            'event_title'         => $_POST['event_title'],
103
-            'cat_id'              => $_POST['cat_id'],
104
-            'event_desc'          => $_POST['event_desc'],
105
-            'event_nbmember'      => $_POST['event_nbmember'],
106
-            'event_organisateur'  => $_POST['event_organisateur'],
107
-            'event_contact'       => $_POST['event_contact'],
108
-            'event_url'           => $_POST['event_url'],
109
-            'event_email'         => $_POST['event_email'],
110
-            'event_address'       => $_POST['event_address'],
111
-            'event_approved'      => 1,
112
-            'event_start'         => $_POST['event_start'],
113
-            'have_end'            => $_POST['have_end'],
114
-            'event_end'           => $_POST['event_end'],
115
-            'event_picture1'      => @$event_picture1,
116
-            'event_picture2'      => @$event_picture2,
117
-            'event_price'         => @$_POST['event_price'],
118
-            'event_location' => $_POST['event_location'],
119
-            'dohtml'              => $extcalConfig['allow_html'],
120
-            'event_icone'         => $_POST['event_icone'],
121
-        ];
122
-
123
-        // Event edited
124
-        if (\Xmf\Request::hasVar('event_id', 'POST')) {
125
-            if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) {
126
-                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false);
78
+        case 'enreg':
79
+
80
+            $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
81
+            $fileHandler  = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE);
82
+            // $t = print_r($_POST,true);
83
+            // echo "<pre>{$t}</pre><br>";
84
+            // exit;
85
+            // If the date format is wrong
86
+            //        if (
87
+            //            !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date'])
88
+            //                || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date'])
89
+            //        ) {
90
+            //            redirect_header(
91
+            //                'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>"
92
+            //                . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
93
+            //            );
94
+            //            exit;
95
+            //        }
96
+
97
+            //exit;
98
+            ///////////////////////////////////////////////////////////////////////////////
99
+            Extcal\Utility::loadImg($_REQUEST, $event_picture1, $event_picture2);
100
+            ///////////////////////////////////////////////////////////////////////////////
101
+            $data = [
102
+                'event_title'         => $_POST['event_title'],
103
+                'cat_id'              => $_POST['cat_id'],
104
+                'event_desc'          => $_POST['event_desc'],
105
+                'event_nbmember'      => $_POST['event_nbmember'],
106
+                'event_organisateur'  => $_POST['event_organisateur'],
107
+                'event_contact'       => $_POST['event_contact'],
108
+                'event_url'           => $_POST['event_url'],
109
+                'event_email'         => $_POST['event_email'],
110
+                'event_address'       => $_POST['event_address'],
111
+                'event_approved'      => 1,
112
+                'event_start'         => $_POST['event_start'],
113
+                'have_end'            => $_POST['have_end'],
114
+                'event_end'           => $_POST['event_end'],
115
+                'event_picture1'      => @$event_picture1,
116
+                'event_picture2'      => @$event_picture2,
117
+                'event_price'         => @$_POST['event_price'],
118
+                'event_location' => $_POST['event_location'],
119
+                'dohtml'              => $extcalConfig['allow_html'],
120
+                'event_icone'         => $_POST['event_icone'],
121
+            ];
122
+
123
+            // Event edited
124
+            if (\Xmf\Request::hasVar('event_id', 'POST')) {
125
+                if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) {
126
+                    redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false);
127
+                } else {
128
+                    $fileHandler->createFile(\Xmf\Request::getInt('event_id', 0, 'POST'));
129
+                    redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDITED, false);
130
+                }
131
+
132
+                // New event
127 133
             } else {
128
-                $fileHandler->createFile(\Xmf\Request::getInt('event_id', 0, 'POST'));
129
-                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDITED, false);
134
+                /** @var \XoopsNotificationHandler $notificationHandler */
135
+                $notificationHandler = xoops_getHandler('notification');
136
+                /** @var Extcal\CategoryHandler $catHandler */
137
+                //            $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
138
+                $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
139
+
140
+                $data['event_submitter']  = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
141
+                $data['event_submitdate'] = time();
142
+
143
+                if ($eventHandler->createEvent($data, $_POST)) {
144
+                    $fileHandler->createFile($eventHandler->getInsertId());
145
+                    $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all');
146
+                    $notificationHandler->triggerEvent('global', 0, 'new_event', ['EVENT_TITLE' => $_POST['event_title']]);
147
+                    $notificationHandler->triggerEvent('category', $_POST['cat_id'], 'new_event_cat', [
148
+                        'EVENT_TITLE' => $_POST['event_title'],
149
+                        'CAT_NAME'    => $cat->getVar('cat_name'),
150
+                    ]);
151
+                    redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATED, false);
152
+                } else {
153
+                    redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false);
154
+                }
130 155
             }
156
+            break;
131 157
 
132
-            // New event
133
-        } else {
134
-            /** @var \XoopsNotificationHandler $notificationHandler */
135
-            $notificationHandler = xoops_getHandler('notification');
136
-            /** @var Extcal\CategoryHandler $catHandler */
137
-            //            $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
138
-            $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
139
-
140
-            $data['event_submitter']  = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
141
-            $data['event_submitdate'] = time();
142
-
143
-            if ($eventHandler->createEvent($data, $_POST)) {
144
-                $fileHandler->createFile($eventHandler->getInsertId());
145
-                $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all');
146
-                $notificationHandler->triggerEvent('global', 0, 'new_event', ['EVENT_TITLE' => $_POST['event_title']]);
147
-                $notificationHandler->triggerEvent('category', $_POST['cat_id'], 'new_event_cat', [
148
-                    'EVENT_TITLE' => $_POST['event_title'],
149
-                    'CAT_NAME'    => $cat->getVar('cat_name'),
150
-                ]);
151
-                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATED, false);
152
-            } else {
153
-                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false);
158
+        case 'clone': /* sur validation du formulaire */
159
+        case 'modify':
160
+            $action = (('clone' === $op) ? 'clone' : 'edit');
161
+            xoops_cp_header();
162
+            //================================================
163
+            // require_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php');
164
+            //
165
+            //        // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com
166
+            //        $dateBirthday = new \XoopsTcCalendar("datez1", true, false);
167
+            //        //$dateBirthday->setIcon("/images/iconCalendar.gif");
168
+            //        $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif");
169
+            //        //$dateBirthday->rtl=false;
170
+            //        $dateBirthday->setAutoHide(false);
171
+            //
172
+            //       //$myCalendar->setDate(date('d'), date('m'), date('Y'));
173
+            //       //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']);
174
+            //        $dateBirthday->setDate(date('d'), date('m'), date('Y'));
175
+            //
176
+            //        $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/");
177
+            //        $dateBirthday->zindex = 150; //default 1
178
+            //        $dateBirthday->setYearInterval(1995, date('Y'));
179
+            //        $dateBirthday->dateAllow('1960-03-01', date('Y-m-d'));
180
+            //        //$dateBirthday->autoSubmit(true, "calendar");
181
+            //        $dateBirthday->disabledDay("sat");
182
+            //        $dateBirthday->disabledDay("sun");
183
+            //        $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month');
184
+            //        $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year');
185
+            //        $dateBirthday->setAlignment('right', 'bottom'); //optional
186
+            // echo "<table><tr><td>zzzzz</td><td></td><td>";
187
+            // echo $dateBirthday->render();
188
+            // echo "</td></tr></table>";
189
+            //echo $dateBirthday->render();
190
+            //================================================
191
+            // @author      Gregory Mage (Aka Mage)
192
+            //***************************************************************************************
193
+            //         require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
194
+            $adminObject = \Xmf\Module\Admin::getInstance();
195
+            $adminObject->displayNavigation(basename(__FILE__));
196
+            //***************************************************************************************
197
+
198
+            $eventId      = $_GET['event_id'];
199
+            $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
200
+
201
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>';
202
+
203
+            if ($form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId])) {
204
+                $form->display();
154 205
             }
155
-        }
156
-        break;
157
-
158
-    case 'clone': /* sur validation du formulaire */
159
-    case 'modify':
160
-        $action = (('clone' === $op) ? 'clone' : 'edit');
161
-        xoops_cp_header();
162
-        //================================================
163
-        // require_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php');
164
-        //
165
-        //        // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com
166
-        //        $dateBirthday = new \XoopsTcCalendar("datez1", true, false);
167
-        //        //$dateBirthday->setIcon("/images/iconCalendar.gif");
168
-        //        $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif");
169
-        //        //$dateBirthday->rtl=false;
170
-        //        $dateBirthday->setAutoHide(false);
171
-        //
172
-        //       //$myCalendar->setDate(date('d'), date('m'), date('Y'));
173
-        //       //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']);
174
-        //        $dateBirthday->setDate(date('d'), date('m'), date('Y'));
175
-        //
176
-        //        $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/");
177
-        //        $dateBirthday->zindex = 150; //default 1
178
-        //        $dateBirthday->setYearInterval(1995, date('Y'));
179
-        //        $dateBirthday->dateAllow('1960-03-01', date('Y-m-d'));
180
-        //        //$dateBirthday->autoSubmit(true, "calendar");
181
-        //        $dateBirthday->disabledDay("sat");
182
-        //        $dateBirthday->disabledDay("sun");
183
-        //        $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month');
184
-        //        $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year');
185
-        //        $dateBirthday->setAlignment('right', 'bottom'); //optional
186
-        // echo "<table><tr><td>zzzzz</td><td></td><td>";
187
-        // echo $dateBirthday->render();
188
-        // echo "</td></tr></table>";
189
-        //echo $dateBirthday->render();
190
-        //================================================
191
-        // @author      Gregory Mage (Aka Mage)
192
-        //***************************************************************************************
193
-        //         require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
194
-        $adminObject = \Xmf\Module\Admin::getInstance();
195
-        $adminObject->displayNavigation(basename(__FILE__));
196
-        //***************************************************************************************
197
-
198
-        $eventId      = $_GET['event_id'];
199
-        $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
200
-
201
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>';
202
-
203
-        if ($form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId])) {
204
-            $form->display();
205
-        }
206 206
 
207
-        echo '</fieldset><br>';
207
+            echo '</fieldset><br>';
208 208
 
209
-        xoops_cp_footer();
209
+            xoops_cp_footer();
210 210
 
211
-        break;
211
+            break;
212 212
 
213
-    case 'clone2': /* sur clique de l'icone du formulaire*/
213
+        case 'clone2': /* sur clique de l'icone du formulaire*/
214 214
 
215
-        //$newEventId = 1;
216
-        $eventId      = $_GET['event_id'];
217
-        $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
218
-        $event        = $eventHandler->getEvent($eventId);
219
-        $t            = $event->getVars();
220
-        $data         = [];
221
-        //        while (list($key, $val) = each($t)) {
222
-        foreach ($t as $key => $val) {
223
-            $data[$key] = $val['value'];
224
-        }
215
+            //$newEventId = 1;
216
+            $eventId      = $_GET['event_id'];
217
+            $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
218
+            $event        = $eventHandler->getEvent($eventId);
219
+            $t            = $event->getVars();
220
+            $data         = [];
221
+            //        while (list($key, $val) = each($t)) {
222
+            foreach ($t as $key => $val) {
223
+                $data[$key] = $val['value'];
224
+            }
225 225
 
226
-        $data['event_id']    = 0;
227
-        $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')';
226
+            $data['event_id']    = 0;
227
+            $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')';
228 228
 
229
-        $newEvent = $eventHandler->create();
230
-        $newEvent->setVars($data);
231
-        $t = $eventHandler->insert($newEvent, true);
229
+            $newEvent = $eventHandler->create();
230
+            $newEvent->setVars($data);
231
+            $t = $eventHandler->insert($newEvent, true);
232 232
 
233
-        $newEventId = $newEvent->getVar('event_id');
234
-        $ts         = print_r($newEventId, true);
233
+            $newEventId = $newEvent->getVar('event_id');
234
+            $ts         = print_r($newEventId, true);
235 235
 
236
-        redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false);
237
-        break;
236
+            redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false);
237
+            break;
238 238
 
239
-    case 'delete':
239
+        case 'delete':
240 240
 
241
-        if (\Xmf\Request::hasVar('confirm', 'POST')) {
242
-            if (!$GLOBALS['xoopsSecurity']->check()) {
243
-                redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
241
+            if (\Xmf\Request::hasVar('confirm', 'POST')) {
242
+                if (!$GLOBALS['xoopsSecurity']->check()) {
243
+                    redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
244
+                }
245
+                //             $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
246
+                //             $eventHandler->deleteEvent($_POST['event_id']);
247
+                deleteEvents($_POST['event_id']);
248
+                redirect_header('event.php', 3, _AM_EXTCAL_EVENT_DELETED, false);
249
+            } else {
250
+                xoops_cp_header();
251
+                // @author      Gregory Mage (Aka Mage)
252
+                //***************************************************************************************
253
+                //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
254
+                $adminObject = \Xmf\Module\Admin::getInstance();
255
+                $adminObject->displayNavigation(basename(__FILE__));
256
+                //***************************************************************************************
257
+
258
+                $hiddens = ['event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1];
259
+                xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php');
260
+
261
+                xoops_cp_footer();
244 262
             }
245
-            //             $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
246
-            //             $eventHandler->deleteEvent($_POST['event_id']);
247
-            deleteEvents($_POST['event_id']);
248
-            redirect_header('event.php', 3, _AM_EXTCAL_EVENT_DELETED, false);
249
-        } else {
263
+
264
+            break;
265
+
266
+        case 'deleteSelection':
267
+
250 268
             xoops_cp_header();
251 269
             // @author      Gregory Mage (Aka Mage)
252 270
             //***************************************************************************************
@@ -254,184 +272,166 @@  discard block
 block discarded – undo
254 272
             $adminObject = \Xmf\Module\Admin::getInstance();
255 273
             $adminObject->displayNavigation(basename(__FILE__));
256 274
             //***************************************************************************************
275
+            if (isset($_POST['deleteSelection'][0])) {
276
+                $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL;
277
+                $ids = array_keys($_POST['deleteAllEvents']);
278
+            } else {
279
+                $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION;
280
+                $ids = array_keys($_POST['deleteEvents']);
281
+            }
257 282
 
258
-            $hiddens = ['event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1];
259
-            xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php');
283
+            //           $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION);
284
+            //           $ids = array_keys($_POST['deleteEvents']);
285
+            $ids = implode(',', $ids);
286
+            //echo $ids.'<br>';
287
+            $hiddens = ['event_ids' => $ids, 'form_delete' => '', 'confirm' => 1];
288
+            //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1);
289
+            xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php');
260 290
 
261 291
             xoops_cp_footer();
262
-        }
263 292
 
264
-        break;
265
-
266
-    case 'deleteSelection':
267
-
268
-        xoops_cp_header();
269
-        // @author      Gregory Mage (Aka Mage)
270
-        //***************************************************************************************
271
-        //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
272
-        $adminObject = \Xmf\Module\Admin::getInstance();
273
-        $adminObject->displayNavigation(basename(__FILE__));
274
-        //***************************************************************************************
275
-        if (isset($_POST['deleteSelection'][0])) {
276
-            $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL;
277
-            $ids = array_keys($_POST['deleteAllEvents']);
278
-        } else {
279
-            $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION;
280
-            $ids = array_keys($_POST['deleteEvents']);
281
-        }
293
+            break;
282 294
 
283
-        //           $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION);
284
-        //           $ids = array_keys($_POST['deleteEvents']);
285
-        $ids = implode(',', $ids);
286
-        //echo $ids.'<br>';
287
-        $hiddens = ['event_ids' => $ids, 'form_delete' => '', 'confirm' => 1];
288
-        //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1);
289
-        xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php');
290
-
291
-        xoops_cp_footer();
292
-
293
-        break;
294
-
295
-    case 'deleteSelectionOK':
296
-        //-----------------------------------------
297
-        // $t = print_r($_GET,true);
298
-        // echo "<hr><pre>{$t}</pre><hr>";
299
-        //
300
-        // $t = print_r($_POST,true);
301
-        // echo "<hr><pre>{$t}</pre><hr>";
302
-        // exit;
303
-        //-----------------------------------------
304
-
305
-        if (isset($_POST['deleteSelection'][0])) {
306
-        } else {
307
-            if (!$GLOBALS['xoopsSecurity']->check()) {
308
-                redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
309
-            }
295
+        case 'deleteSelectionOK':
296
+            //-----------------------------------------
297
+            // $t = print_r($_GET,true);
298
+            // echo "<hr><pre>{$t}</pre><hr>";
299
+            //
300
+            // $t = print_r($_POST,true);
301
+            // echo "<hr><pre>{$t}</pre><hr>";
302
+            // exit;
303
+            //-----------------------------------------
310 304
 
311
-            deleteEvents($_POST['event_ids']);
305
+            if (isset($_POST['deleteSelection'][0])) {
306
+            } else {
307
+                if (!$GLOBALS['xoopsSecurity']->check()) {
308
+                    redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
309
+                }
312 310
 
313
-            redirect_header('event.php', 3, _AM_EXTCAL_EVENTS_DELETED, false);
314
-        }
311
+                deleteEvents($_POST['event_ids']);
315 312
 
316
-        break;
313
+                redirect_header('event.php', 3, _AM_EXTCAL_EVENTS_DELETED, false);
314
+            }
317 315
 
318
-    case 'default':
319
-    default:
316
+            break;
320 317
 
321
-        //global $extcalConfig;
322
-        $extcalConfig      = Extcal\Config::getHandler();
318
+        case 'default':
319
+        default:
323 320
 
324
-        $start          = \Xmf\Request::getInt('start', 0, 'GET');
325
-        $nbEventsByPage = $helper->getConfig('nbEventsByPage');
321
+            //global $extcalConfig;
322
+            $extcalConfig      = Extcal\Config::getHandler();
326 323
 
327
-        xoops_cp_header();
328
-        // @author      Gregory Mage (Aka Mage)
329
-        //***************************************************************************************
324
+            $start          = \Xmf\Request::getInt('start', 0, 'GET');
325
+            $nbEventsByPage = $helper->getConfig('nbEventsByPage');
330 326
 
331
-        $adminObject = \Xmf\Module\Admin::getInstance();
332
-        $adminObject->displayNavigation(basename(__FILE__));
333
-        //***************************************************************************************
327
+            xoops_cp_header();
328
+            // @author      Gregory Mage (Aka Mage)
329
+            //***************************************************************************************
334 330
 
335
-        $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
336
-        $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']);
337
-        $eventHandler->formatEventsDate($events, _SHORTDATESTRING);
331
+            $adminObject = \Xmf\Module\Admin::getInstance();
332
+            $adminObject->displayNavigation(basename(__FILE__));
333
+            //***************************************************************************************
338 334
 
339
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>';
340
-        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
341
-        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
342
-        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;>&nbsp;&nbsp;". _AM_EXTCAL_INFO_DELETE;
335
+            $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
336
+            $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']);
337
+            $eventHandler->formatEventsDate($events, _SHORTDATESTRING);
343 338
 
344
-        echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
345
-        echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE . '<br>';
339
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>';
340
+            echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
341
+            //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
342
+            //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;>&nbsp;&nbsp;". _AM_EXTCAL_INFO_DELETE;
346 343
 
347
-        echo '</fieldset><br>';
344
+            echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br>';
345
+            echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE . '<br>';
348 346
 
349
-        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>';
347
+            echo '</fieldset><br>';
350 348
 
351
-        echo '<form method="POST" action="event.php">';
352
-        echo '<input type="hidden" name="op" value="deleteSelection">';
349
+            echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>';
353 350
 
354
-        echo '<table class="outer" style="width:100%;">';
355
-        echo '<tr style="text-align:center;">';
356
-        echo '<th>' . _AM_EXTCAL_DELETE . '</th>';
357
-        echo '<th>#</th>';
358
-        echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
359
-        echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
360
-        echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
361
-        echo '<th>' . _AM_EXTCAL_END_DATE . '</th>';
362
-        echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>';
363
-        echo '<th>' . _AM_EXTCAL_START_RULES . '</th>';
364
-        echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
351
+            echo '<form method="POST" action="event.php">';
352
+            echo '<input type="hidden" name="op" value="deleteSelection">';
365 353
 
366
-        echo '</tr>';
354
+            echo '<table class="outer" style="width:100%;">';
355
+            echo '<tr style="text-align:center;">';
356
+            echo '<th>' . _AM_EXTCAL_DELETE . '</th>';
357
+            echo '<th>#</th>';
358
+            echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
359
+            echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
360
+            echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
361
+            echo '<th>' . _AM_EXTCAL_END_DATE . '</th>';
362
+            echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>';
363
+            echo '<th>' . _AM_EXTCAL_START_RULES . '</th>';
364
+            echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
367 365
 
368
-        if (count($events) > 0) {
369
-            $i = 0;
370
-            foreach ($events as $event) {
371
-                $class = (0 == ++$i % 2) ? 'even' : 'odd';
372
-                echo '<tr style="text-align:left;" class="' . $class . '">';
373
-                echo "<td width='10%' align='center'>";
374
-                echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >";
375
-                echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1'>";
376
-                echo '</td>';
377
-                echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>';
378
-                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>';
379
-
380
-                echo '<td>' . '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>';
381
-
382
-                //                 if ($event['event_isrecur']) {
383
-                //                     echo '<td>' . $event['formated_reccur_rule'] . '</td>';
384
-                //                 } else {
385
-                //                     echo '<td>' . $event['formated_event_start'] . '</td>';
386
-                //                 }
387
-
388
-                echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>';
389
-                echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>';
390
-                echo '<td align="center">' . ((1 == $event['event_isrecur']) ? _YES : _NO) . '</td>';
391
-                if (!isset($event['formated_reccur_rule'])) {
392
-                    $event['formated_reccur_rule'] = '';
366
+            echo '</tr>';
367
+
368
+            if (count($events) > 0) {
369
+                $i = 0;
370
+                foreach ($events as $event) {
371
+                    $class = (0 == ++$i % 2) ? 'even' : 'odd';
372
+                    echo '<tr style="text-align:left;" class="' . $class . '">';
373
+                    echo "<td width='10%' align='center'>";
374
+                    echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >";
375
+                    echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1'>";
376
+                    echo '</td>';
377
+                    echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>';
378
+                    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>';
379
+
380
+                    echo '<td>' . '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>';
381
+
382
+                    //                 if ($event['event_isrecur']) {
383
+                    //                     echo '<td>' . $event['formated_reccur_rule'] . '</td>';
384
+                    //                 } else {
385
+                    //                     echo '<td>' . $event['formated_event_start'] . '</td>';
386
+                    //                 }
387
+
388
+                    echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>';
389
+                    echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>';
390
+                    echo '<td align="center">' . ((1 == $event['event_isrecur']) ? _YES : _NO) . '</td>';
391
+                    if (!isset($event['formated_reccur_rule'])) {
392
+                        $event['formated_reccur_rule'] = '';
393
+                    }
394
+                    echo '<td>' . $event['formated_reccur_rule'] . '</td>';
395
+
396
+                    echo '<td style="width:10%; text-align:center;">';
397
+                    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;";
398
+                    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;";
399
+                    echo '<a href=event.php?op=clone&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "'></a>";
400
+                    echo '</td>';
401
+
402
+                    echo '</tr>';
393 403
                 }
394
-                echo '<td>' . $event['formated_reccur_rule'] . '</td>';
404
+                //---------------------------------------------------------
405
+                $pageNav = new \XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start);
395 406
 
396
-                echo '<td style="width:10%; text-align:center;">';
397
-                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;";
398
-                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;";
399
-                echo '<a href=event.php?op=clone&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "'></a>";
407
+                echo '<tr><td colspan="2" style="text-align: right;">';
408
+                echo $pageNav->renderNav(2);
400 409
                 echo '</td>';
401 410
 
402
-                echo '</tr>';
403
-            }
404
-            //---------------------------------------------------------
405
-            $pageNav = new \XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start);
411
+                echo '<td colspan="2" style="text-align: right;">';
406 412
 
407
-            echo '<tr><td colspan="2" style="text-align: right;">';
408
-            echo $pageNav->renderNav(2);
409
-            echo '</td>';
413
+                echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">';
414
+                echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">';
410 415
 
411
-            echo '<td colspan="2" style="text-align: right;">';
412
-
413
-            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">';
414
-            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">';
415
-
416
-            echo '</td>';
417
-            echo '</tr>';
418
-        } else {
419
-            echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
420
-        }
421
-        echo '</table>';
422
-        echo '</form>';
416
+                echo '</td>';
417
+                echo '</tr>';
418
+            } else {
419
+                echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
420
+            }
421
+            echo '</table>';
422
+            echo '</form>';
423 423
 
424
-        echo '</fieldset>';
425
-        echo '</fieldset><br><br>';
426
-        //Fin de la liste des evennement -------------------------------------
427
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>';
424
+            echo '</fieldset>';
425
+            echo '</fieldset><br><br>';
426
+            //Fin de la liste des evennement -------------------------------------
427
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>';
428 428
 
429
-        $form = $eventHandler->getEventForm('admin');
430
-        $form->display();
429
+            $form = $eventHandler->getEventForm('admin');
430
+            $form->display();
431 431
 
432
-        echo '</fieldset>';
432
+            echo '</fieldset>';
433 433
 
434
-        require_once __DIR__ . '/admin_footer.php';
434
+            require_once __DIR__ . '/admin_footer.php';
435 435
 
436
-        break;
436
+            break;
437 437
 }
Please login to merge, or discard this patch.