Issues (1210)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

ro_regonlinehandler.php (33 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Xmf\Request;
4
5
require_once __DIR__ . '/../../mainfile.php';
6
require_once XOOPS_ROOT_PATH . '/header.php';
7
//XoopsMailer
8
require_once XOOPS_ROOT_PATH . '/class/xoopsmailer.php';
9
require_once XOOPS_ROOT_PATH . '/modules/apcal/language/' . $GLOBALS['xoopsConfig']['language'] . '/apcal_constants.php';
10
11
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/apcal/assets/css/apcal.css" />' . $xoopsTpl->get_template_vars('xoops_module_header'));
12
13
//read module preferences
14
require_once XOOPS_ROOT_PATH."/modules/apcal/class/APCal.php";
15
$cal = new APCal();
16
include_once XOOPS_ROOT_PATH.'/modules/apcal/include/read_configs.php';
17
18
//images
19
$roimageedit          = XOOPS_URL . '/modules/apcal/assets/images/regonline/edit.png';
20
$roimagedelete        = XOOPS_URL . '/modules/apcal/assets/images/regonline/delete.png';
21
$roimagesave          = XOOPS_URL . '/modules/apcal/assets/images/regonline/save.png';
22
$roimagesavemore      = XOOPS_URL . '/modules/apcal/assets/images/regonline/savemore.png';
23
$roimagecancel        = XOOPS_URL . '/modules/apcal/assets/images/regonline/cancel.png';
24
$roimagesend          = XOOPS_URL . '/modules/apcal/assets/images/regonline/sendmail.png';
25
$roimageprint         = XOOPS_URL . '/modules/apcal/assets/images/regonline/print.png';
26
$roimagestatusok      = XOOPS_URL . '/modules/apcal/assets/images/regonline/status_ok.png';
27
$roimagestatuslist    = XOOPS_URL . '/modules/apcal/assets/images/regonline/status_list.png';
28
$roimagestatuspending = XOOPS_URL . '/modules/apcal/assets/images/regonline/status_pend.png';
29
$roimagedownload      = XOOPS_URL . '/modules/apcal/assets/images/regonline/download.png';
30
31
$show_form_activate = false;
32
if (isset($_POST['form_activate'])) {
33
    if (!empty($_POST['eventid'])) {
34
        //called from edit an event (activate or edit regonline)
35
        $eventid   = Request::getInt('eventid', 0, 'POST');
36
        $url       = Request::getString('url', '', 'POST');
37
        $eventurl  = Request::getString('eventurl', '', 'POST');
38
        $event     = Request::getString('title', '', 'POST');
39
        $eventdate = Request::getString('eventdate', '', 'POST');
40
        $location  = Request::getString('location', '', 'POST');
41
42
        $show_form_activate = true;
43
    }
44
}
45
if (isset($_GET['op'])) {
46
    if ($_GET['op'] === 'show_form_activate') {
47
        //called after automatically redirect after add new event
48
        if (isset($_GET['eventid'])) {
49
            $eventid = $_GET['eventid'];
50
        }
51
        if (isset($_GET['eventurl'])) {
52
            $eventurl = $_GET['eventurl'] . '?smode=' . $_GET['smode'] . '&caldate=' . $_GET['caldate'];
53
        }
54
        if (isset($_GET['title'])) {
55
            $event = $_GET['title'];
56
        }
57
        if (isset($_GET['eventdate'])) {
58
            $eventdate = $_GET['eventdate'];
59
        }
60
        $caldate = $_GET['caldate'];
61
        $show_form_activate = true;
62
    }
63
}
64
65
if ($show_form_activate) {
66
    $uid = $xoopsUser->getVar('uid');
67
68
    $email1 = '';
69
    $email2 = '';
70
    $email3 = '';
71
    $email4 = '';
72
    $email5 = '';
73
74
    //read data from apcal_ro_events
75
    $query    = 'SELECT '
76
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
77
        . '.* FROM '
78
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
79
        . ' WHERE (('
80
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
81
        . ".roe_eventid)=$eventid)";
82
    $res      = $GLOBALS['xoopsDB']->query($query);
83
    $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
84
85
    if ($num_rows == 0) {
86
        //edit new item, make preselection
87
        $email1      = $xoopsUser->getVar('email');
88
        $datelimit   = $eventdate;
89
        $number      = 0;
90
        $waitinglist = 1;
91
        $needconfirm = 0;
92
        $typeedit    = 0; //new
93
    } else {
94
        while ($ro_result = $GLOBALS['xoopsDB']->fetchObject($res)) {
95
            $roeid       = $ro_result->roe_id;
96
            $number      = (int)$ro_result->roe_number;
97
            $datelimit   = (int)$ro_result->roe_datelimit;
98
            $waitinglist = ($number > 0) ? (int)$ro_result->roe_waitinglist : 0;
99
            $needconfirm = (int)$ro_result->roe_needconfirm;
100
            $typeedit    = 1; //edit
101
        }
102
    }
103
104
    //read data from apcal_ro_notify
105
    $query    = 'SELECT '
106
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
107
        . '.* FROM '
108
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
109
        . ' WHERE (('
110
        . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
111
        . ".ron_eventid)=$eventid)";
112
    $res      = $GLOBALS['xoopsDB']->query($query);
113
    $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
114
115
    $i = 0;
116
    if ($num_rows == 0) {
117
        //no data, use email from actual user
118
    } else {
119
        while ($ron_result = $GLOBALS['xoopsDB']->fetchObject($res)) {
120
            ++$i;
121
            switch ($i) {
122
                case 1:
123
                    $email1 = $ron_result->ron_email;
124
                    break;
125
                case 2:
126
                    $email2 = $ron_result->ron_email;
127
                    break;
128
                case 3:
129
                    $email3 = $ron_result->ron_email;
130
                    break;
131
                case 4:
132
                    $email4 = $ron_result->ron_email;
133
                    break;
134
                case 5:
135
                    $email5 = $ron_result->ron_email;
136
                    break;
137
            }
138
        }
139
    }
140
141
    if ($datelimit > 0) {
142
        $datelimit = date('d.m.Y H:i:s', $datelimit);
143
    }
144
    if ($eventdate > 0) {
145
        $eventdate = date('d.m.Y H:i:s', $eventdate);
146
    }
147
148
    $ret = "
149
    <table border='0' width='100%'>
150
        <tr><td width='100%' class='itemHead'><span class='itemTitle'>" . _APCAL_RO_TITLE2 . "</span></td></tr>
151
        <tr><td width='100%'>
152
        <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformactivate' style='margin:0px;'>
153
            <input type='hidden' name='eventid' value='$eventid' />
154
            <input type='hidden' name='uid' value='$uid' />
155
            <input type='hidden' name='event_uid' value='$event_uid' />
156
            <input type='hidden' name='eventurl' value='$eventurl' />
157
            <input type='hidden' name='url' value='$url' />
158
            <input type='hidden' name='typeedit' value='$typeedit' />
159
            <table>
160
                <tr>
161
                    <td class='even' width='300px'>" . _APCAL_RO_EVENT . ":</td>
162
                    <td class='odd'><input type='text' name='event' disabled='disabled' value='$event'  size='80' /></td>
163
                </tr>";
164
    $ret .= "
165
                <tr>
166
                    <td class='even' width='120px'>" . _APCAL_RO_DATE . ":</td>
167
                    <td class='odd'><input type='text' name='eventdate' disabled='disabled' value='$eventdate'  size='80' /></td>
168
                </tr>
169
                 <tr>
170
                    <td class='even' width='120px'>" . _APCAL_RO_LOCATION . ":</td>
171
                    <td class='odd'><input type='text' name='location' disabled='disabled' value='$location'  size='80' /></td>
172
                </tr>";
173
    $ret .= "
174
                <tr>
175
                    <td class='even' width='300px'>" . _APCAL_RO_QUANTITY . ":</td>
176
                    <td class='odd'><input type='text' name='number' value='$number' size='80' /></td>
177
                </tr>
178
                <tr>
179
                    <td class='even' width='300px'>" . _APCAL_RO_DATELIMIT . ":</td>
180
                    <td class='odd'><input type='text' name='datelimit' value='$datelimit' size='80' /></td>
181
                </tr>";
182
    $ret .= "
183
                    <tr>
184
                        <td class='even' width='300px'>" . _APCAL_RO_STATUS_ACT. ":</td>
185
                        <td class='odd'>
186
                            <input id='needconfirm1' type='radio' value='1'";
187
                            if ($needconfirm ==1) $ret .=" checked='checked'";
188
                            $ret .=" title='" . _APCAL_RO_STATUS_ACT . "' name='needconfirm' />
189
                            <label for='needconfirm1' name='xolb_needconfirm1'>"._APCAL_RO_RADIO_YES."</label>
190
                            <input id='needconfirm2' type='radio' value='0'";
191
                            if ($needconfirm == 0) $ret .=" checked='checked'";
192
                            $ret .=" title='" . _APCAL_RO_STATUS_ACT . "' name='needconfirm' />
193
                            <label for='needconfirm2' name='xolb_needconfirm2'>"._APCAL_RO_RADIO_NO."</label>
194
                        </td>
195
                    </tr>";
196
    $ret .= "
197
                    <tr>
198
                        <td class='even' width='300px'>" . _APCAL_RO_LIST_ACT . ":</td>
199
                        <td class='odd'>
200
                            <input id='waitinglist1' type='radio' value='1'";
201
                        if ($waitinglist == 1) $ret .=" checked='checked'";
202
                        $ret .=" title='" . _APCAL_RO_LIST_ACT . "' name='waitinglist' />
203
                        <label for='waitinglist1' name='xolb_waitinglist1'>"._APCAL_RO_RADIO_YES."</label>
204
                            <input id='waitinglist2' type='radio' value='0'";
205
                        if ($waitinglist == 0) $ret .=" checked='checked'";
206
                        $ret .=" title='" . _APCAL_RO_LIST_ACT . "' name='waitinglist' />
207
                        <label for='waitinglist2' name='xolb_waitinglist2'>"._APCAL_RO_RADIO_NO."</label>
208
                        </td>
209
                </tr>
210
                <tr>
211
                    <td class='even' width='300px'>" . _APCAL_RO_EMAIL_NOTIFY . ":</td>
212
                    <td class='odd'>
213
                        <table cellspacing='0' cellpading='0'>
214
                            <tr>
215
                                <td class='odd'><input type='text' name='email1' value='$email1' size='80' /></td>
216
                            </tr>
217
                            <tr>
218
                                <td class='odd'><input type='text' name='email2' value='$email2' size='80' /></td>
219
                            </tr>
220
                            <tr>
221
                                <td class='odd'><input type='text' name='email3' value='$email3' size='80' /></td>
222
                            </tr>
223
                            <tr>
224
                                <td class='odd'><input type='text' name='email4' value='$email4' size='80' /></td>
225
                            </tr>
226
                            <tr>
227
                                <td class='odd'><input type='text' name='email5' value='$email5' size='80' /></td>
228
                            </tr>
229
                        </table>
230
                    </td>
231
                </tr>
232
            </table>
233
            <br><br>
234
            <div align='center'>";
235
236
    if ($typeedit == 0) {
237
        $ret .= "<input type='image' src='$roimagesave' name='activate' alt='" . _APCAL_RO_BTN_CONF_SAVE . "' title='" . _APCAL_RO_BTN_CONF_SAVE . "' height='24px'/>";
238
    } else {
239
        $ret .= "<input type='image' src='$roimagesave' name='activate' alt='" . _APCAL_RO_BTN_CONF_EDIT . "' title='" . _APCAL_RO_BTN_CONF_EDIT . "' height='24px'/>";
240
    }
241
    $ret .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
242
    $ret .= "<input type='image' src='$roimagedelete' name='deactivate' alt='" . _APCAL_RO_BTN_RO_DEACTIVATE . "' title='" . _APCAL_RO_BTN_RO_DEACTIVATE . "' height='24px'/>";
243
    $ret .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
244
    $ret .= "<input type='image' src='$roimagecancel' name='cancel' alt='" . _APCAL_RO_BTN_CANCEL . "' title='" . _APCAL_RO_BTN_CANCEL . "' height='24px'/>";
245
    $ret .= "</div>
246
        </form>
247
        </td></tr>
248
    </table>
249
    \n";
250
    echo $ret;
251
}
252
253
if (isset($_POST['activate_x'])) {
254
    if (!empty($_POST['eventid'])) {
255
        $uid         = Request::getInt('uid');
256
        $eventid     = Request::getInt('eventid');
257
        $eventurl    = Request::getString('eventurl', '');
258
        $datelimit   = Request::getString('datelimit', '');
259
        $number      = Request::getInt('number');
260
        $needconfirm = Request::getInt('needconfirm');
261
        $waitinglist = ($number > 0 ) ? Request::getInt('waitinglist') : 0;
262
        $email1      = Request::getString('email1', '');
263
        $email2      = Request::getString('email2', '');
264
        $email3      = Request::getString('email3', '');
265
        $email4      = Request::getString('email4', '');
266
        $email5      = Request::getString('email5', '');
267
        $typeedit    = Request::getInt('typeedit');
268
269
        if ($datelimit === '') {
270
            $datelimit = 0;
271
        } else {
272
            $datelimit = strtotime($datelimit);
273
        }
274
275
        //insert or update data in table apcal_ro_events
276
        if ($typeedit == 0) {
277
            $query = 'Insert into '
278
                     . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
279
                     . " (roe_submitter, roe_eventid, roe_datelimit, roe_number, roe_needconfirm, roe_waitinglist, roe_date_created) values ($uid, $eventid, $datelimit, $number, $needconfirm, $waitinglist, "
280
                     . time()
281
                     . ')';
282
        } else {
283
            $query = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . ' SET ';
284
            $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . ".roe_submitter = $uid, ";
285
            $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . ".roe_datelimit = $datelimit, ";
286
            $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . ".roe_number = $number, ";
287
            $query .= $GLOBALS['xoopsDB']->prefix("apcal_ro_events") . ".roe_needconfirm = $needconfirm, ";
288
            $query .= $GLOBALS['xoopsDB']->prefix("apcal_ro_events") . ".roe_waitinglist = $waitinglist, ";
289
            $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . '.roe_date_created = ' . time() . ' ';
290
            $query .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('apcal_ro_events') . ".roe_eventid)=$eventid))";
291
        }
292
        $res = $GLOBALS['xoopsDB']->query($query);
293
        if (!$res) {
294
            redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
295
        }
296
297
        //update data in table apcal_events
298
        $query = 'UPDATE '
299
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
300
                 . ' SET '
301
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
302
                 . '.extkey0 = 1 WHERE ((('
303
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
304
                 . ".id)=$eventid))";
305
        $res   = $GLOBALS['xoopsDB']->query($query);
306
        if (!$res) {
307
            //echo $query;
308
            redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
309
        }
310
311
        //update date in apcal_ro_notify
312
        if ($typeedit == 1) {
313
            //delete old data in apcal_ro_notify
314
            $query = 'DELETE '
315
                     . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
316
                     . '.* FROM '
317
                     . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
318
                     . ' WHERE (('
319
                     . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
320
                     . ".ron_eventid)=$eventid)";
321
            $res   = $GLOBALS['xoopsDB']->query($query);
322
        }
323 View Code Duplication
        if ($email1 !== '') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
324
            $submitter = $xoopsUser->getVar('uid');
325
            $query     = 'Insert into ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . " (ron_eventid, ron_email, ron_submitter, ron_date_created) values ($eventid, '$email1', $submitter, ". time().")";
326
            $res       = $GLOBALS['xoopsDB']->query($query);
327
            if (!$res) {
328
                redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
329
            }
330
        }
331 View Code Duplication
        if ($email2 !== '') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
332
            $query = 'Insert into ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . " (ron_eventid, ron_email, ron_submitter, ron_date_created) values ($eventid, '$email2', $submitter, ". time().")";
333
            $res   = $GLOBALS['xoopsDB']->query($query);
334
            if (!$res) {
335
                redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
336
            }
337
        }
338 View Code Duplication
        if ($email3 !== '') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
339
            $query = 'Insert into ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . " (ron_eventid, ron_email, ron_submitter, ron_date_created) values ($eventid, '$email3', $submitter, ". time().")";
340
            $res   = $GLOBALS['xoopsDB']->query($query);
341
            if (!$res) {
342
                redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
343
            }
344
        }
345 View Code Duplication
        if ($email4 !== '') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
346
            $query = 'Insert into ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . " (ron_eventid, ron_email, ron_submitter, ron_date_created) values ($eventid, '$email4', $submitter, ". time().")";
347
            $res   = $GLOBALS['xoopsDB']->query($query);
348
            if (!$res) {
349
                redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
350
            }
351
        }
352 View Code Duplication
        if ($email5 !== '') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
353
            $query = 'Insert into ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . " (ron_eventid, ron_email, ron_submitter, ron_date_created) values ($eventid, '$email5', $submitter, ". time().")";
354
            $res   = $GLOBALS['xoopsDB']->query($query);
355
            if (!$res) {
356
                redirect_header($eventurl, 3, _APCAL_RO_ERROR_RO_ACTIVATE);
357
            }
358
        }
359
        redirect_header($eventurl, 3, _APCAL_RO_SUCCESS_RO_ACTIVATE);
360
    }
361
}
362
363
if (isset($_POST['deactivate_x'])) {
364
    if (!empty($_POST['eventid'])) {
365
        $eventid = Request::getInt('eventid');
366
        $url     = Request::getString('eventurl', '');
367
368
        //delete data in table apcal_ro_members
369
        $query = 'DELETE '
370
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
371
                 . '.* FROM '
372
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
373
                 . ' WHERE (('
374
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
375
                 . ".rom_eventid)=$eventid)";
376
        $res   = $GLOBALS['xoopsDB']->query($query);
377
        if (!$res) {
378
            redirect_header($url, 3, _APCAL_RO_ERROR_RO_DEACTIVATE);
379
        }
380
381
        //delete data in table apcal_ro_notify
382
        $query = 'DELETE '
383
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
384
                 . '.* FROM '
385
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
386
                 . ' WHERE (('
387
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify')
388
                 . ".ron_eventid)=$eventid)";
389
        $res   = $GLOBALS['xoopsDB']->query($query);
390
391
        //delete data in table apcal_ro_events
392
        $query = 'DELETE '
393
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
394
                 . '.* FROM '
395
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
396
                 . ' WHERE (('
397
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
398
                 . ".roe_eventid)=$eventid)";
399
        $res   = $GLOBALS['xoopsDB']->query($query);
400
        if (!$res) {
401
            redirect_header($url, 3, _APCAL_RO_ERROR_RO_DEACTIVATE);
402
        }
403
404
        //update data in table apcal_event
405
        $query = 'UPDATE '
406
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
407
                 . ' SET '
408
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
409
                 . '.extkey0 = 0 WHERE ((('
410
                 . $GLOBALS['xoopsDB']->prefix('apcal_event')
411
                 . ".id)=$eventid))";
412
        $res   = $GLOBALS['xoopsDB']->query($query);
413
        if (!$res) {
414
            redirect_header($url, 3, _APCAL_RO_ERROR_RO_DEACTIVATE);
415
        } else {
416
            //Data were correctly deleted from DB;
417
            redirect_header($url, 3, _APCAL_RO_SUCCESS_RO_DEACTIVATE);
418
        }
419
    }
420
}
421
422
if (isset($_REQUEST['form_add'])) {
423
    if (!empty($_REQUEST['eventid'])) {
424
        $eventid   = Request::getInt('eventid');
425
        $eventurl  = Request::getString('eventurl', '');
426
        $summary   = Request::getString('summary', '');
427
        $date      = Request::getString('date');
428
        $eventdate = Request::getInt('eventdate');
429
        $location  = Request::getString('location', '');
430
        $title     = '';
431
        $ret       = '';
432
        $retList      = '';
433
        $classname = '';
434
        $event_uid = Request::getInt('event_uid');
435
        
436
        $firstname  = Request::getString('firstname', '');
437
        $lastname   = Request::getString('lastname', '');
438
        $email      = Request::getString('email', '');
439
        $extrainfo1 = Request::getString('extrainfo1', '');
440
        $extrainfo2 = Request::getString('extrainfo2', '');
441
        $extrainfo3 = Request::getString('extrainfo3', '');
442
        $extrainfo4 = Request::getString('extrainfo4', '');
443
        $extrainfo5 = Request::getString('extrainfo5', '');
444
        $dataprivacy = Request::getInt('dataprivacy');
445
446
        $eventdate = date('d.m.Y H:i:s', $eventdate);
447
448
        $title = $summary . ' (' . $eventdate . ' ' . $location . ')';
449
450 View Code Duplication
        if (!empty($_SERVER['HTTPS'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
451
            $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
452
        } else {
453
            $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
454
        }
455
456
        $url .= '?form_add=1';
457
        $url .= "&eventid=$eventid";
458
        $url .= "&event_uid=$event_uid";
459
        $url .= "&eventurl=$eventurl";
460
        $url .= "&summary=$summary";
461
        $url .= "&date=$date";
462
        $url .= "&eventdate=$eventdate";
463
        $url .= "&location=$location";
464
465
        //read data from apcal_ro_events
466
        $query    = 'SELECT '
467
            . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
468
            . '.roe_number, roe_datelimit, roe_needconfirm, roe_waitinglist FROM '
469
            . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
470
            . ' WHERE (('
471
            . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
472
            . ".roe_eventid)=$eventid)";
473
        $res      = $GLOBALS['xoopsDB']->query($query);
474
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
475
        if ($num_rows == 0) {
476
            $datelimit      = 0;
477
        } else {
478
            while ($ro_result = $GLOBALS['xoopsDB']->fetchObject($res)) {
479
                $datelimit      = $ro_result->roe_datelimit;
480
            }
481
        }
482
483
        //get username and email
484
        global $xoopsUser;
485 View Code Duplication
        if (!isset($xoopsUser) || !is_object($xoopsUser)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
486
            $uname = '';
487
            $email = '';
488
            $uid   = 0;
489
        } else {
490
            $uname = $xoopsUser->getVar('uname');
491
            $email = $xoopsUser->getVar('email');
492
            $uid   = $xoopsUser->getVar('uid');
493
        }
494
495
        $ret = "
496
        <h3 class='row'>
497
            <h3>" . _APCAL_RO_TITLE1 . "</h3>
498
            <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformaddmember' style='margin:0px;'>
499
                <input type='hidden' name='uid' value='$uid' />
500
                <input type='hidden' name='uname' value='$uname' />
501
                <input type='hidden' name='eventid' value='$eventid' />
502
                <input type='hidden' name='event_uid' value='$event_uid' />
503
                <input type='hidden' name='url' value='$url' />
504
                <input type='hidden' name='eventurl' value='$eventurl' />
505
                <input type='hidden' name='eventdate' value='$eventdate' />
506
                <input type='hidden' name='title' value='$title' />
507
                <input type='hidden' name='summary' value='$summary' />
508
                <input type='hidden' name='date' value='$date' />
509
                <input type='hidden' name='eventdate' value='$eventdate' />
510
                <input type='hidden' name='location' value='$location' />
511
                        <div class='col-xs-12 col-sm-4'>" . _APCAL_RO_EVENT . ":</div>
512
                        <div class='col-xs-12 col-sm-8'><input type='text' name='title' disabled='disabled' value='$summary' style='width:100%' /></div>
513
                        <div class='clear'></div>
514
                        <div class='col-xs-12 col-sm-4'>" . _APCAL_RO_DATE . ":</div>
515
                        <div class='col-xs-12 col-sm-8'><input type='text' name='eventdate' disabled='disabled' value='$eventdate' style='width:100%' /></div>
516
                        <div class='clear'></div>
517
                        <div class='col-xs-12 col-sm-4'>" . _APCAL_RO_LOCATION . ":</div>
518
                        <div class='col-xs-12 col-sm-8'><input type='text' name='location' disabled='disabled' value='$location' style='width:100%' /></div>
519
                        <div class='clear'></div>
520
                        <div class='even col-xs-12 col-sm-4'>" . _APCAL_RO_FIRSTNAME . "*:</div>
521
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='firstname' value='$firstname' style='width:100%' /></div>
522
                        <div class='clear'></div>
523
                        <div class='even col-xs-12 col-sm-4'>" . _APCAL_RO_LASTNAME . "*:</div>
524
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='lastname' value='$lastname' style='width:100%' /></div>
525
                        <div class='clear'></div>
526
                        <div class='even col-xs-12 col-sm-4'>" . _APCAL_RO_EMAIL . ":</div>
527
                        <div class='odd col-xs-12 col-sm-8'>
528
                            <input type='text' name='email' value='$email' style='width:100%' />
529
                            <br>" . _APCAL_RO_SEND_CONF3 . "
530
                            <input type='radio' name='sendconf' value='yes' checked> " . _APCAL_RO_RADIO_YES . "
531
                            <input type='radio' name='sendconf' value='no'> " . _APCAL_RO_RADIO_NO . '
532
                        </div>
533
                        <div class="clear"></div>
534
                    ';
535
        if ($cal->ro_extrainfo1 !== '') {
536
            $extrainfo1_obligatory = ($cal->ro_extrainfo1_obl > 0) ? '*' : '';
537
            $ret .= "
538
                        <div class='even col-xs-12 col-sm-4'>" . $cal->ro_extrainfo1 . "$extrainfo1_obligatory:</div>
539
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='extrainfo1' value='$extrainfo1' style='width:100%' /></div>
540
                        <div class='clear'></div>
541
                    ";
542
        }
543
        if ($cal->ro_extrainfo2 !== '') {
544
            $extrainfo2_obligatory = ($cal->ro_extrainfo2_obl > 0) ? '*' : '';
545
            $ret .= "
546
                        <div class='even col-xs-12 col-sm-4'>" . $cal->ro_extrainfo2 . "$extrainfo2_obligatory:</div>
547
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='extrainfo2' value='$extrainfo2' style='width:100%' /></div>
548
                        <div class='clear'></div>
549
                    ";
550
        }
551
        if ($cal->ro_extrainfo3 !== '') {
552
            $extrainfo3_obligatory = ($cal->ro_extrainfo3_obl > 0) ? '*' : '';
553
            $ret .= "
554
                        <div class='even col-xs-12 col-sm-4'>" . $cal->ro_extrainfo3 . "$extrainfo3_obligatory:</div>
555
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='extrainfo3' value='$extrainfo3' style='width:100%' /></div>
556
                        <div class='clear'></div>
557
                    ";
558
        }
559
        if ($cal->ro_extrainfo4 !== '') {
560
            $extrainfo4_obligatory = ($cal->ro_extrainfo4_obl > 0) ? '*' : '';
561
            $ret .= "
562
                        <div class='even col-xs-12 col-sm-4'>" . $cal->ro_extrainfo4 . "$extrainfo4_obligatory:</div>
563
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='extrainfo4' value='$extrainfo4' style='width:100%' /></div>
564
                        <div class='clear'></div>
565
                    ";
566
        }
567
        if ($cal->ro_extrainfo5 !== '') {
568
            $extrainfo5_obligatory = ($cal->ro_extrainfo5_obl > 0) ? '*' : '';
569
            $ret .= "
570
                        <div class='even col-xs-12 col-sm-4'>" . $cal->ro_extrainfo5 . "$extrainfo5_obligatory:</div>
571
                        <div class='odd col-xs-12 col-sm-8'><input type='text' name='extrainfo5' value='$extrainfo5' style='width:100%' /></div>
572
                        <div class='clear'></div>
573
                    ";
574
        }
575
        
576
        if (($event_uid == $uid && $uid > 0) || //current user is event owner
577
            ($cal->isadmin == 1) || //current user is admin
578
            ($cal->ro_superedit == 1)) //current user can edit/delete registrations of other persons
0 ignored issues
show
The property ro_superedit does not seem to exist. Did you mean superedit?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
579
        {
580
            $ret .= "
581
                <div class='even col-xs-12 col-sm-4'>" . _APCAL_RO_STATUS . ":</div>
582
                <div class='odd col-xs-12 col-sm-8'>
583
                    <input id='status0' type='radio' value='0' checked='checked' title=" . _APCAL_RO_STATUS_OK . " name='status' />
584
                    <label for='status0' name='xolb_status0'>" . _APCAL_RO_STATUS_OK . "</label>&nbsp;&nbsp;
585
                    <input id='status1' type='radio' value='1' title=" . _APCAL_RO_STATUS_PENDING . " name='status' />
586
                    <label for='status1' name='xolb_status1'>" . _APCAL_RO_STATUS_PENDING . "</label>&nbsp;&nbsp;
587
                    <input id='status2' type='radio' value='2' title=" . _APCAL_RO_STATUS_LIST . " name='status' />
588
                    <label for='status2' name='xolb_status2'>" . _APCAL_RO_STATUS_LIST . "</label>
589
                </div>";
590
        } else {
591
            $ret .= "<input type='hidden' name='status' value='-1' size='100' />";
592
        }
593
        $ret .= "
594
                <div class='even col-xs-12 col-sm-4'>" . _APCAL_RO_DATAPRIVACY . "*:</div>
595
                <div class='odd col-xs-12 col-sm-8'>
596
                    <input id='dataprivacy' type='checkbox' ";
597
        if ($dataprivacy == 1) {
598
            $ret .= "value='0' checked='checked'";
599
        } else {
600
            $ret .= "value='0' ";
601
        }
602
603
        $ret .= "title=" . _APCAL_RO_DATAPRIVACY . " name='dataprivacy' />
604
                    <span>" . _APCAL_RO_DATAPRIVACY_DETAIL . "</span>
605
                </div>";
606
        $ret .= '
607
                </div>
608
                * ' . _APCAL_RO_OBLIGATORY . "
609
                <br><br>
610
                <div align='center'>
611
                    <input type='image' src='$roimagesave' name='add_member' alt='" . _APCAL_RO_BTN_CONF_ADD . "' title='" . _APCAL_RO_BTN_CONF_ADD . "' height='24px'/>&nbsp;&nbsp;
612
                    <input type='image' src='$roimagesavemore' name='add_member_more' alt='" . _APCAL_RO_BTN_CONF_ADD_MORE . "' title='" . _APCAL_RO_BTN_CONF_ADD_MORE . "' height='24px'/>&nbsp;&nbsp;
613
                    <input type='image' src='$roimagecancel' name='cancel' alt='" . _APCAL_RO_BTN_CANCEL . "' title='" . _APCAL_RO_BTN_CANCEL . "' height='24px'/>
614
                </div>
615
            </form>
616
         </div>\n<br><br>";
617
618
        $retList = '';
619
        $query = "SELECT ".$GLOBALS['xoopsDB']->prefix("apcal_ro_members").".* ";
620
        $query .= "FROM ".$GLOBALS['xoopsDB']->prefix("apcal_ro_members");
621
        //replaced one line by goffy2
622
        //$query .= " WHERE (((rom_eventid)=$eventid) AND ((rom_submitter)=$uid))";
623
        $query .= " WHERE (((rom_eventid)=$eventid) AND ((rom_submitter)=$uid)";
624
        if ($uid==0) {
625
            $poster_ip = gethostbyaddr(getenv("REMOTE_ADDR"));
626
            if ($poster_ip=='') $poster_ip='x';
627
            $query .= " AND ((rom_poster_ip)='$poster_ip')";
628
        }
629
        $query .= ")";
630
        
631
        $res = $GLOBALS['xoopsDB']->query($query);
632
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
633
634
635
        if ($num_rows > 0) {
636
            $retList .= "
637
                <table border='0' width='100%'>
638
                    <tr><td width='100%' class='itemHead'><span class='itemTitle'>" . _APCAL_RO_TITLE3 . "</span></td></tr>
639
                    <tr><td width='100%'>
640
                    <table class='ro_table' width='100%'>
641
                        <tr>
642
                            <th class='even'>" . _APCAL_RO_FIRSTNAME . "</th>
643
                            <th class='even'>" . _APCAL_RO_LASTNAME . "</th>
644
                            <th class='even'>" . _APCAL_RO_EMAIL . '</th>';
645
            if ($cal->ro_extrainfo1 !== '') {
646
                $retList .= "<th class='even'>" . $cal->ro_extrainfo1 . '</th>';
647
            }
648
            if ($cal->ro_extrainfo2 !== '') {
649
                $retList .= "<th class='even'>" . $cal->ro_extrainfo2 . '</th>';
650
            }
651
            if ($cal->ro_extrainfo3 !== '') {
652
                $retList .= "<th class='even'>" . $cal->ro_extrainfo3 . '</th>';
653
            }
654
            if ($cal->ro_extrainfo4 !== '') {
655
                $retList .= "<th class='even'>" . $cal->ro_extrainfo4 . '</th>';
656
            }
657
            if ($cal->ro_extrainfo5 !== '') {
658
                $retList .= "<th class='even'>" . $cal->ro_extrainfo5 . '</th>';
659
            }
660
            $retList .= "<th class='even'>"._APCAL_RO_STATUS."</th>";
661
            $retList .= "
662
                    <th class='even'>" . _APCAL_RO_ACTION . '</th>
663
                </tr>';
664
            while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
665
                $romfirstname  = $member->rom_firstname;
666
                $romlastname   = $member->rom_lastname;
667
                $romemail      = $member->rom_email;
668
                $romextrainfo1 = $member->rom_extrainfo1;
669
                $romextrainfo2 = $member->rom_extrainfo2;
670
                $romextrainfo3 = $member->rom_extrainfo3;
671
                $romextrainfo4 = $member->rom_extrainfo4;
672
                $romextrainfo5 = $member->rom_extrainfo5;
673
                $rom_id        = $member->rom_id;
674
                $status        = (int)$member->rom_status;
675
676 View Code Duplication
                if ($line == 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
677
                    $classname = 'odd';
678
                    $line = 1;
679
                } else {
680
                    $classname = 'even';
681
                    $line = 0;
682
                }
683
                $unique_id = uniqid(mt_rand());
684
                $retList .= "
685
                    <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformeditremovemember_" . $unique_id . "' style='margin:0px;'>
686
                        <input type='hidden' name='eventid' value='$eventid' />
687
                        <input type='hidden' name='event_uid' value='$event_uid' />
688
                        <input type='hidden' name='uid' value='$uid' />
689
                        <input type='hidden' name='uname' value='$uname' />
690
                        <input type='hidden' name='url' value='$url' />
691
                        <input type='hidden' name='eventurl' value='$eventurl' />
692
                        <input type='hidden' name='summary' value='$summary' />
693
                        <input type='hidden' name='date' value='$date' />
694
                        <input type='hidden' name='eventdate' value='$eventdate' />
695
                        <input type='hidden' name='location' value='$location' />
696
                        <input type='hidden' name='rom_id' value='$rom_id' />
697
                        <input type='hidden' name='firstname' value='$romfirstname' />
698
                        <input type='hidden' name='lastname' value='$romlastname' />
699
                        <input type='hidden' name='email' value='$romemail' />
700
                        <input type='hidden' name='extrainfo1' value='$romextrainfo1' />
701
                        <input type='hidden' name='extrainfo2' value='$romextrainfo2' />
702
                        <input type='hidden' name='extrainfo3' value='$romextrainfo3' />
703
                        <input type='hidden' name='extrainfo4' value='$romextrainfo4' />
704
                        <input type='hidden' name='extrainfo5' value='$romextrainfo5' />
705
                        <input type='hidden' name='status' value='$status' />
706
                        <input type='hidden' name='num_members' value='$num_rows' />
707
                    ";
708
                $retList .= "<tr>
709
                            <td class='$classname'>$romfirstname</td>
710
                            <td class='$classname'>$romlastname</td>
711
                            <td class='$classname'>$romemail</td>";
712
                if ($cal->ro_extrainfo1 !== '') {
713
                    $retList .= "<td class='$classname'>$romextrainfo1</td>";
714
                }
715
                if ($cal->ro_extrainfo2 !== '') {
716
                    $retList .= "<td class='$classname'>$romextrainfo2</td>";
717
                }
718
                if ($cal->ro_extrainfo3 !== '') {
719
                    $retList .= "<td class='$classname'>$romextrainfo3</td>";
720
                }
721
                if ($cal->ro_extrainfo4 !== '') {
722
                    $retList .= "<td class='$classname'>$romextrainfo4</td>";
723
                }
724
                if ($cal->ro_extrainfo5 !== '') {
725
                    $retList .= "<td class='$classname'>$romextrainfo5</td>";
726
                }
727
                $retList .= "<td class='$classname'>";
728 View Code Duplication
                if (($event_uid == $uid && $uid > 0) || //current user is event owner
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
729
                    ($cal->isadmin == 1) || //current user is admin
730
                    ($cal->ro_superedit == 1)) //current user can edit/delete registrations of other persons
0 ignored issues
show
The property ro_superedit does not seem to exist. Did you mean superedit?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
731
                {
732
                    if ($status == 1) {
733
                        $retList .= "<input type='image' src='$roimagestatuspending' name='confirm_member' alt='"._APCAL_RO_STATUS_PENDING."' title='"._APCAL_RO_STATUS_PENDING."'  height='22px' />";
734
                    } else if ($status == 2){
735
                        $retList .= "<input type='image' src='$roimagestatuslist' name='confirm_member' alt='"._APCAL_RO_STATUS_LIST."' title='"._APCAL_RO_STATUS_LIST."'  height='22px' />";
736
                    } else {
737
                        $retList .= "<input type='image' src='$roimagestatusok' name='confirm_member' alt='"._APCAL_RO_STATUS_OK."' title='"._APCAL_RO_STATUS_OK."'  height='22px' />";
738
                    }
739
                } else {
740
                    if ($status == 1) {
741
                        $retList .= "<img type='image' src='$roimagestatuspending' name='confirm_member' alt='"._APCAL_RO_STATUS_PENDING."' title='"._APCAL_RO_STATUS_PENDING."'  height='22px' />";
742
                    } else if ($status == 2){
743
                        $retList .= "<img type='image' src='$roimagestatuslist' name='confirm_member' alt='"._APCAL_RO_STATUS_LIST."' title='"._APCAL_RO_STATUS_LIST."'  height='22px' />";
744
                    } else {
745
                        $retList .= "<img type='image' src='$roimagestatusok' name='confirm_member' alt='"._APCAL_RO_STATUS_OK."' title='"._APCAL_RO_STATUS_OK."'  height='22px' />";
746
                    }
747
                }
748
                $retList .= '</td>';
749
                //check limit date expired
750
                $datenow = strtotime(date('d.m.Y H:i:s'));
751
                if ($datelimit > 0 && $datelimit < $datenow) {
752
                    $retList .= "<td class='$classname'>" ._APCAL_RO_ERROR_TIMEOUT . "</td>";
753
                } else {
754
                    $retList .= "
755
                            <td class='$classname'>
756
                                <input type='image' src='$roimageedit' name='form_edit' alt='" . _APCAL_RO_BTN_EDIT . "' title='" . _APCAL_RO_BTN_EDIT . "'  height='24px' />
757
                                <input type='image' src='$roimagedelete' name='remove_member' alt='" . _APCAL_RO_BTN_REMOVE . "' title='" . _APCAL_RO_BTN_REMOVE . "'  height='24px' />
758
                            </td>";
759
                }
760
            }
761
            $retList .= "</tr>";
762
            $retList .= '</form></table></td></tr></table>';
763
            $retList .= "<p style='text-align:center;align:center;'>
764
        <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformgoback' style='margin:0px;'>
765
            <input type='hidden' name='eventurl' value='$eventurl' />
766
            <div align='center'>
767
            <input type='image' src='$roimagecancel' name='goback' alt='" . _APCAL_RO_BTN_BACK . "' title='" . _APCAL_RO_BTN_BACK . "' height='24px'/>
768
            </div>
769
        </form></p>\n";
770
            $retList .= '<br><br>';
771
        }
772
        
773
774
        echo $retList;
775
        //check limit date expired
776
        $datenow = strtotime(date('d.m.Y H:i:s'));
777
        if ($datelimit > 0 && $datelimit < $datenow) {
778
            if (($event_uid == $uid && $uid > 0) || //current user is event owner
779
                ($cal->isadmin == 1) || //current user is admin
780
                ($cal->ro_superedit == 1)) //current user can edit/delete registrations of other persons
0 ignored issues
show
The property ro_superedit does not seem to exist. Did you mean superedit?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
781
            {
782
                echo $ret;
783
            } else {
784
                echo "<h2>" ._APCAL_RO_ERROR_TIMEOUT . "</h2>";
785
            }
786
        } else {
787
            echo $ret;
788
        }
789
790
    }
791
}
792
793
if (isset($_POST['add_member_x']) || isset($_POST['add_member_more_x'])) {
794
    if (!empty($_POST['eventid'])) {
795
        $uid         = Request::getInt('uid');
796
        $url         = Request::getString('url', '');
797
        $eventurl    = Request::getString('eventurl', '');
798
        $uname       = Request::getString('uname', '');
799
        $eventid     = Request::getInt('eventid');
800
        $firstname   = Request::getString('firstname', '');
801
        $lastname    = Request::getString('lastname', '');
802
        $email       = Request::getString('email', '');
803
        $extrainfo1  = Request::getString('extrainfo1', '-');
804
        $extrainfo2  = Request::getString('extrainfo2', '-');
805
        $extrainfo3  = Request::getString('extrainfo3', '-');
806
        $extrainfo4  = Request::getString('extrainfo4', '-');
807
        $extrainfo5  = Request::getString('extrainfo5', '-');
808
        $summary     = Request::getString('summary', '');
809
        $date        = Request::getString('date');
810
        $location    = Request::getString('location', '');
811
        $sendconf    = Request::getString('sendconf', '');
812
        $status      = Request::getInt('status');
813
        $eventdate   = Request::getString('eventdate', '');
814
        $dataprivacy = Request::hasVar('dataprivacy');
815
816
        $url_redirect = "&firstname=".$firstname;
817
        $url_redirect .= "&lastname=".$lastname;
818
        $url_redirect .= "&email=".$email;
819
        $url_redirect .= "&extrainfo1=".$extrainfo1;
820
        $url_redirect .= "&extrainfo2=".$extrainfo2;
821
        $url_redirect .= "&extrainfo3=".$extrainfo3;
822
        $url_redirect .= "&extrainfo4=".$extrainfo4;
823
        $url_redirect .= "&extrainfo5=".$extrainfo5;
824
        $url_redirect .= "&dataprivacy=".$dataprivacy;
825
826
        if ($dataprivacy == 0) {
827
            redirect_header($url.$url_redirect, 3, str_replace('%s', _APCAL_RO_DATAPRIVACY, _APCAL_RO_MISSING_ITEM));
828
        }
829
        if ($firstname=='') {
830
            redirect_header($url.$url_redirect, 3, str_replace('%s', _APCAL_RO_FIRSTNAME, _APCAL_RO_MISSING_ITEM));
831
        }
832
        if ($lastname=='') {
833
          redirect_header($url.$url_redirect, 3, str_replace('%s', _APCAL_RO_LASTNAME, _APCAL_RO_MISSING_ITEM));
834
        }
835
/*
836
        if ($email=='') {
837
          redirect_header($url.$url_redirect, 3, str_replace('%s', _APCAL_RO_EMAIL, _APCAL_RO_MISSING_ITEM));
838
        }*/
839 View Code Duplication
        if ($cal->ro_extrainfo1_obl > 0 && $extrainfo1=='') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
840
            redirect_header($url . $url_redirect, 3, str_replace('%s', $cal->ro_extrainfo1, _APCAL_RO_MISSING_ITEM));
841
        }
842 View Code Duplication
        if ($cal->ro_extrainfo2_obl > 0 && $extrainfo2=='') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
843
          redirect_header($url.$url_redirect, 3, str_replace('%s', $cal->ro_extrainfo2, _APCAL_RO_MISSING_ITEM));
844
        }
845 View Code Duplication
        if ($cal->ro_extrainfo3_obl > 0 && $extrainfo3=='') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
846
          redirect_header($url.$url_redirect, 3, str_replace('%s', $cal->ro_extrainfo3, _APCAL_RO_MISSING_ITEM));
847
        }
848 View Code Duplication
        if ($cal->ro_extrainfo4_obl > 0 && $extrainfo4=='') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
849
          redirect_header($url.$url_redirect, 3, str_replace('%s', $cal->ro_extrainfo4, _APCAL_RO_MISSING_ITEM));
850
        }
851 View Code Duplication
        if ($cal->ro_extrainfo5_obl > 0 && $extrainfo5=='') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
852
            redirect_header($url.$url_redirect, 3, str_replace('%s', $cal->ro_extrainfo5, _APCAL_RO_MISSING_ITEM));
853
        }
854
855
        if ($email === '') {
856
            $email = '-';
857
        }
858
        if ($extrainfo1 == '') {
859
            $extrainfo1 = '-';
860
        }
861
        if ($extrainfo2 == '') {
862
            $extrainfo2 = '-';
863
        }
864
        if ($extrainfo3 == '') {
865
            $extrainfo3 = '-';
866
        }
867
        if ($extrainfo4 == '') {
868
            $extrainfo4 = '-';
869
        } 
870
        if ($extrainfo5 == '') {
871
            $extrainfo5 = '-';
872
        }
873
        
874
        //read data from apcal_ro_events
875
        $query    = 'SELECT '
876
                    . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
877
                    . '.roe_number, roe_datelimit, roe_needconfirm, roe_waitinglist FROM '
878
                    . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
879
                    . ' WHERE (('
880
                    . $GLOBALS['xoopsDB']->prefix('apcal_ro_events')
881
                    . ".roe_eventid)=$eventid)";
882
        $res      = $GLOBALS['xoopsDB']->query($query);
883
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
884
        if ($num_rows == 0) {
885
            $number_allowed = 0;
886
            $datelimit      = 0;
887
            $needconfirm    = 0;
888
            $waitinglist    = 0;
889
        } else {
890
            while ($ro_result = $GLOBALS['xoopsDB']->fetchObject($res)) {
891
                $number_allowed = (int)$ro_result->roe_number;
892
                $datelimit      = $ro_result->roe_datelimit;
893
                $needconfirm    = (int)$ro_result->roe_needconfirm;
894
                $waitinglist    = (int)$ro_result->roe_waitinglist;
895
            }
896
        }
897
        //check limit date expired
898
        if ($datelimit > 0) {
899
            $datenow = strtotime(date('d.m.Y H:i:s'));
900
            if ($datelimit < $datenow) {
901
                redirect_header($url, 3, _APCAL_RO_ERROR_TIMEOUT);
902
            }
903
        }
904
        //check limit number registrations
905
        $waitinglist_used  = '';
906
        $waitinglist_used2 = '';
907
        if ($number_allowed > 0) {
908
            //get existing registrations
909
            $query    = 'SELECT '
910
                        . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
911
                        . '.rom_id FROM '
912
                        . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
913
                        . ' WHERE (('
914
                        . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
915
                        . ".rom_eventid)=$eventid)";
916
            $res          = $GLOBALS['xoopsDB']->query($query);
917
            $number_total = $GLOBALS['xoopsDB']->getRowsNum($res);
918
919
            if ($number_total >= $number_allowed) {
920
                if($waitinglist > 0 ) {
921
                    $waitinglist_used  =  _APCAL_RO_PUT_ON_WAITINGLIST;
922
                    $waitinglist_used2 =  _APCAL_RO_PUT_ON_WAITINGLIST2;
923
                } else {
924
                    redirect_header($url, 5, _APCAL_RO_ERROR_FULL);
925
                }
926
            }
927
        }
928
929
        $confirmto = $email;
930
        // check whether email is available and confirmation is selected
931
        if ($confirmto === '') {
932
            $confirmto = '-';
933
        }
934
        if ($sendconf === 'no') {
935
            $confirmto = '-';
936
        }
937
938
        $poster_ip = gethostbyaddr(getenv("REMOTE_ADDR"));
939
        if ($poster_ip=='') $poster_ip='-';
940
941
        if ($status == -1) {
942
            if ($number_total >= $number_allowed && $number_allowed > 0) {
943
                $status = 2;
944
            } else if ($needconfirm > 0) {
945
                $status = 1;
946
            } else {
947
                $status = 0;
948
            }
949
        }
950
951
        $query = 'Insert into '
952
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
953
                 . " (rom_submitter, rom_eventid, rom_firstname, rom_lastname, rom_email, rom_extrainfo1, rom_extrainfo2, rom_extrainfo3, rom_extrainfo4, rom_extrainfo5, rom_poster_ip, rom_status, rom_date_created) values ($uid, $eventid, '$firstname', '$lastname', '$email', '$extrainfo1', '$extrainfo2', '$extrainfo3', '$extrainfo4', '$extrainfo5', '$poster_ip', $status, "
954
                 . time()
955
                 . ' )';
956
        
957
        $res   = $GLOBALS['xoopsDB']->query($query);
958
        if (!$res) {
959
            redirect_header($url, 3, _APCAL_RO_ERROR_ADD); 
960
        } else {
961
            //send email of responsible persons
962
            $query    = 'SELECT ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . '.* ';
963
            $query    .= 'FROM ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify');
964
            $query    .= " WHERE (((ron_eventid)=$eventid))";
965
            $res      = $GLOBALS['xoopsDB']->query($query);
966
            $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
967 View Code Duplication
            if ($num_rows == 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
968
                //nothing to do
969
            } else {
970
                while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
971
                    $xoopsMailer = xoops_getMailer();
972
                    $xoopsMailer->useMail();
973
                    //set template path
974
                    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
975
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
976
                    } else {
977
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
978
                    }
979
                    //set template name
980
                    $xoopsMailer->setTemplate('ro_notify_in.tpl');
981
                    //set sender
982
                    $xoopsMailer->setFromEmail($cal->ro_mail_sender);
983
                    //set name of sender
984
                    $xoopsMailer->setFromName($cal->ro_mail_sendername);
985
                    //set subject
986
                    $subject = _APCAL_RO_MAIL_SUBJ_ADD;
987
                    $xoopsMailer->setSubject($subject);
988
                    //assign vars in template
989
                    $xoopsMailer->assign('UNAME', $uname);
990
                    $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
991
                    $xoopsMailer->assign('SUMMARY', $summary);
992
                    $xoopsMailer->assign('DATE', $date);
993
                    $xoopsMailer->assign('LOCATION', $location);
994
                    $xoopsMailer->assign('WAITINGLIST', $waitinglist_used2);
995
                    $xoopsMailer->assign('URL', $eventurl);
996
                    $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
997
                    //set recipient
998
                    $recipient = $member->ron_email;
999
                    $xoopsMailer->setToEmails($recipient);
1000
1001
                    //execute sending
1002
                    $xoopsMailer->send();
1003
                    $xoopsMailer->reset();
1004
                }
1005
            }
1006
1007
            //confirmation mail to registered person
1008 View Code Duplication
            if ($confirmto == '-') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1009
                //echo "option not selected or no email-address available";
1010
            } else {
1011
                $xoopsMailer = xoops_getMailer();
1012
                $xoopsMailer->useMail();
1013
                //set template path
1014
                if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
1015
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
1016
                } else {
1017
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1018
                }
1019
                //set template name
1020
                $xoopsMailer->setTemplate('ro_confirm_in.tpl');
1021
                //set sender
1022
                $xoopsMailer->setFromEmail($cal->ro_mail_sender);
1023
                //set sender name
1024
                $xoopsMailer->setFromName($cal->ro_mail_sendername);
1025
                //set subject
1026
                $subject = _APCAL_RO_MAIL_SUBJ_ADD;
1027
                $xoopsMailer->setSubject($subject);
1028
                //assign vars
1029
                $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
1030
                $xoopsMailer->assign('SUMMARY', $summary);
1031
                $xoopsMailer->assign('DATE', $date);
1032
                $xoopsMailer->assign('LOCATION', $location);
1033
                $xoopsMailer->assign('WAITINGLIST', $waitinglist_used);
1034
                $xoopsMailer->assign('URL', $eventurl);
1035
                $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
1036
                //set recipient
1037
                $xoopsMailer->setToEmails($confirmto);
1038
1039
                //execute sending
1040
                $xoopsMailer->send();
1041
                $xoopsMailer->reset();
1042
            }
1043
1044
            if (isset($_POST['add_member_more_x'])) {
1045
                redirect_header($url, 3, _APCAL_RO_SUCCESS_ADD);
1046
            } else {
1047
                redirect_header($eventurl, 3, _APCAL_RO_SUCCESS_ADD);
1048
            }
1049
        }
1050
    }
1051
}
1052
1053
if (isset($_POST['confirm_member']) || isset($_POST['confirm_member_x'])){
1054
1055
    if (!empty($_POST['eventid'])){
1056
        $uid       = Request::getInt('uid');
1057
        $url       = Request::getString('url', '');
1058
        $eventurl  = Request::getString('eventurl', '');
1059
        $uname     = Request::getString('uname', '');
1060
        $eventid   = Request::getInt('eventid');
1061
        $firstname = Request::getString('firstname', '');
1062
        $lastname  = Request::getString('lastname', '');
1063
        $email     = Request::getString('email', '');
1064
        $summary   = Request::getString('summary', '');
1065
        $date      = Request::getString('date');
1066
        $location  = Request::getString('location', '');
1067
        $status    = Request::getInt('status');
1068
        $rom_id    = Request::getInt('rom_id');
1069
        $eventdate = Request::getString('eventdate', '');
1070
1071
        if ($email=='') $email='-';
1072
1073
        $confirmto = $email;
1074
1075
        if ($status == 0) {
1076
            $status = 1;
1077
            $roinfo = _APCAL_RO_STATUS_SUCCESS_CHANGE_PENDING;
1078
        } else {
1079
            $status = 0;
1080
            $roinfo = _APCAL_RO_STATUS_SUCCESS_CHANGE_OK;
1081
        }
1082
1083
        $query = "UPDATE `".$GLOBALS['xoopsDB']->prefix("apcal_ro_members")."` SET `rom_status` = '$status' WHERE `rom_id` = $rom_id;";
1084
        $res = $GLOBALS['xoopsDB']->query($query);
1085
        if(!$res) {
1086
            redirect_header($url, 3, _APCAL_RO_ERROR_STATUS_CONF);
1087
        } else {
1088
            //confirmation mail to registrated person
1089
            if ($confirmto=='-') {
1090
                //echo "option not selected or no email-address available";
1091
            } else {
1092
                $xoopsMailer =& xoops_getMailer();
1093
                $xoopsMailer->useMail();
1094
                //set template path
1095
                if( file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/'. $xoopsConfig['language'] .'/')) {
1096
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/'. $xoopsConfig['language'] .'/mail_template/');
1097
                } else {
1098
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1099
                }
1100
                //set template name 
1101
                $xoopsMailer->setTemplate('ro_confirm_status.tpl');
1102
                //set sender 
1103
                $xoopsMailer->setFromEmail($cal->ro_mail_sender);
1104
                //set sender name
1105
                $xoopsMailer->setFromName($cal->ro_mail_sendername);
1106
                //set subject
1107
                $subject = _APCAL_RO_MAIL_SUBJ_STATUS;
1108
                $xoopsMailer->setSubject($subject);
1109
                //assign vars
1110
                $xoopsMailer->assign("NAME", $firstname." ".$lastname);
1111
                $xoopsMailer->assign("SUMMARY", $summary);
1112
                $xoopsMailer->assign("DATE", $date);
1113
                $xoopsMailer->assign("LOCATION", $location);
1114
                $xoopsMailer->assign("URL", $eventurl);
1115
                $xoopsMailer->assign("SIGNATURE", $cal->ro_mail_signature);
1116
                $xoopsMailer->assign("INFOTEXT", $roinfo.".");
1117
                //set recipient
1118
                $xoopsMailer->setToEmails($confirmto);
1119
1120
                //execute sending
1121
                $xoopsMailer->send();
1122
                $xoopsMailer->reset();
1123
            }
1124
            redirect_header($url, 3, $roinfo);
1125
        }
1126
    }
1127
}
1128
1129
if (isset($_POST['remove_member']) || isset($_POST['remove_member_x'])) {
1130
    if (!empty($_POST['rom_id'])) {
1131
        $rom_id      = Request::getInt('rom_id');
1132
        $url         = Request::getString('url', '');
1133
        $eventurl    = Request::getString('eventurl', '');
1134
        $uid         = Request::getInt('uid');
1135
        $uname       = Request::getString('uname', '');
1136
        $eventid     = Request::getInt('eventid');
1137
        $title       = Request::getString('title', '');
1138
        $firstname   = Request::getString('firstname', '');
1139
        $lastname    = Request::getString('lastname', '');
1140
        $confirmto   = Request::getString('email', '');
1141
        $summary     = Request::getString('summary', '');
1142
        $date        = Request::getInt('date');
1143
        $location    = Request::getString('location', '');
1144
        $num_members = Request::getInt('num_members');
1145
        $eventdate   = Request::getString('eventdate', '');
1146
1147
        // check whether confirmation mail should be send
1148
        if ($confirmto === '') {
1149
            $confirmto = '-';
1150
        }
1151
1152
        $query = 'DELETE '
1153
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1154
                 . '.* FROM '
1155
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1156
                 . ' WHERE (('
1157
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1158
                 . ".rom_id)=$rom_id)";
1159
1160
        $res = $GLOBALS['xoopsDB']->query($query);
1161
        if (!$res) {
1162
            redirect_header($url, 3, _APCAL_RO_ERROR_REMOVE);
1163
        } else {
1164
            //data was correctly deleted from DB;
1165
            //send mail to responsible person
1166
            $query = 'SELECT ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify') . '.* ';
1167
            $query .= 'FROM ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_notify');
1168
            $query .= " WHERE (((ron_eventid)=$eventid))";
1169
1170
            $res      = $GLOBALS['xoopsDB']->query($query);
1171
            $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1172 View Code Duplication
            if ($num_rows == 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1173
                //nothing to do
1174
            } else {
1175
                while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
1176
                    $xoopsMailer = xoops_getMailer();
1177
                    $xoopsMailer->useMail();
1178
                    //set template path
1179
                    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
1180
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
1181
                    } else {
1182
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1183
                    }
1184
                    //set template name
1185
                    $xoopsMailer->setTemplate('ro_notify_out.tpl');
1186
                    //set sender
1187
                    $xoopsMailer->setFromEmail($cal->ro_mail_sender);
1188
                    //set sender name
1189
                    $xoopsMailer->setFromName($cal->ro_mail_sendername);
1190
                    //set subject
1191
                    $subject = _APCAL_RO_MAIL_SUBJ_REMOVE;
1192
                    $xoopsMailer->setSubject($subject);
1193
                    //assign vars
1194
                    $xoopsMailer->assign('UNAME', $uname);
1195
                    $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
1196
                    $xoopsMailer->assign('SUMMARY', $summary);
1197
                    $xoopsMailer->assign('DATE', $date);
1198
                    $xoopsMailer->assign('LOCATION', $location);
1199
                    $xoopsMailer->assign('URL', $eventurl);
1200
                    $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
1201
                    //set recipient
1202
                    $recipient = $member->ron_email;
1203
                    $xoopsMailer->setToEmails($recipient);
1204
1205
                    //execute sending
1206
                    $xoopsMailer->send();
1207
                    $xoopsMailer->reset();
1208
                }
1209
            }
1210
1211
            //confirmation mail to registered person
1212
            if ($confirmto == '-') {
1213
                //echo "option not selected or no email-address available";
1214
            } else {
1215
                $xoopsMailer = xoops_getMailer();
1216
                $xoopsMailer->useMail();
1217
                //set template path
1218
                if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
1219
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
1220
                } else {
1221
                    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1222
                }
1223
                //set template name
1224
                $xoopsMailer->setTemplate('ro_confirm_out.tpl');
1225
                //set sender
1226
                $sender = $cal->ro_mail_sender;
1227
                $xoopsMailer->setFromEmail($sender);
1228
                //set sender name
1229
                $xoopsMailer->setFromName($cal->ro_mail_sendername);
1230
                //set subject
1231
                $subject = _APCAL_RO_MAIL_SUBJ_REMOVE;
1232
                $xoopsMailer->setSubject($subject);
1233
                //assign vars
1234
                $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
1235
                $xoopsMailer->assign('SUMMARY', $summary);
1236
                $xoopsMailer->assign('DATE', $date);
1237
                $xoopsMailer->assign('LOCATION', $location);
1238
                $xoopsMailer->assign('URL', $eventurl);
1239
                $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
1240
                //set recipient
1241
                $xoopsMailer->setToEmails($confirmto);
1242
                //execute sending
1243
                $xoopsMailer->send();
1244
                $xoopsMailer->reset();
1245
            }
1246
            if ($num_members == 1) {
1247
                redirect_header($eventurl, 3, _APCAL_RO_SUCCESS_REMOVE);
1248
            } else {
1249
                redirect_header($url, 3, _APCAL_RO_SUCCESS_REMOVE);
1250
            }
1251
        }
1252
    }
1253
}
1254
1255
if (isset($_REQUEST['list'])) {
1256
    if (!empty($_REQUEST['eventid'])) {
1257
        $eventid   = Request::getInt('eventid');
1258
        $summary   = Request::getString('summary', '');
1259
        $date      = Request::getString('date');
1260
        $eventdate = Request::getInt('eventdate');
1261
        $location  = Request::getString('location', '');
1262
        $eventurl  = Request::getString('eventurl', '');
1263
        $event_uid = Request::getInt('event_uid');
1264
        $classname = '';
1265
1266 View Code Duplication
        if (!empty($_SERVER['HTTPS'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1267
            $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1268
        } else {
1269
            $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1270
        }
1271
1272
        if (!isset($xoopsUser) || !is_object($xoopsUser)) {
1273
            $current_uid = 0;
1274
            $current_uname = "";
1275
        } else {
1276
            $current_uid   = $xoopsUser->getVar('uid');
1277
            $current_uname = $xoopsUser->getVar('uname');
1278
        }
1279
1280
        $url .= '?list=1';
1281
        $url .= "&uid=$event_uid";
1282
        $url .= "&eventid=$eventid";
1283
        $url .= "&event_uid=$event_uid";
1284
        $url .= "&summary=$summary";
1285
        $url .= "&date=$date";
1286
        $url .= "&eventdate=$eventdate";
1287
        $url .= "&location=$location";
1288
        $url .= "&eventurl=$eventurl";
1289
1290
        $title = $summary . ' (' . $date . ' ' . $location . ')';
1291
        $query = 'SELECT '
1292
                 . $GLOBALS['xoopsDB']->prefix('users')
1293
                 . '.uname, '
1294
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1295
                 . '.* FROM '
1296
                 . $GLOBALS['xoopsDB']->prefix('users')
1297
                 . ' right JOIN '
1298
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1299
                 . ' ON '
1300
                 . $GLOBALS['xoopsDB']->prefix('users')
1301
                 . '.uid = '
1302
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1303
                 . '.rom_submitter WHERE ((('
1304
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1305
                 . ".rom_eventid)=$eventid)) ORDER BY "
1306
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1307
                 . '.rom_date_created';
1308
1309
        $res      = $GLOBALS['xoopsDB']->query($query);
1310
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1311
1312
        if ($num_rows == 0) {
1313
            $ret = _APCAL_RO_NOMEMBERS;
1314
        } else {
1315
            $counter = 0;
1316
            $ret .= '<h3>' . _APCAL_RO_EVENT . ": $summary</h3>";
1317
            $ret .= '<p>' . _APCAL_RO_DATE . ": $date</p>";
1318
            $ret .= '<p>' . _APCAL_RO_LOCATION . ": $location</p>";
1319
            $ret .= "
1320
           <table class='ro_table'>
1321
             <tr>
1322
               <th class='listeheader'>&nbsp;</th>
1323
               <th width='100px' class='listeheader'>" . _APCAL_RO_UNAME . "</th>
1324
               <th width='100px' class='listeheader'>" . _APCAL_RO_FIRSTNAME . "</th>
1325
               <th width='100px' class='listeheader'>" . _APCAL_RO_LASTNAME . "</th>
1326
               <th class='listeheader'>" . _APCAL_RO_EMAIL . '</th>';
1327
            if ($cal->ro_extrainfo1 !== '') {
1328
                $ret .= "<th class='listeheader'>" . $cal->ro_extrainfo1 . '</th>';
1329
            }
1330
            if ($cal->ro_extrainfo2 !== '') {
1331
                $ret .= "<th class='listeheader'>" . $cal->ro_extrainfo2 . '</th>';
1332
            }
1333
            if ($cal->ro_extrainfo3 !== '') {
1334
                $ret .= "<th class='listeheader'>" . $cal->ro_extrainfo3 . '</th>';
1335
            }
1336
            if ($cal->ro_extrainfo4 !== '') {
1337
                $ret .= "<th class='listeheader'>" . $cal->ro_extrainfo4 . '</th>';
1338
            }
1339
            if ($cal->ro_extrainfo5 !== '') {
1340
                $ret .= "<th class='listeheader'>" . $cal->ro_extrainfo5 . '</th>';
1341
            }
1342
            $ret .= "<th class='listeheader'>"._APCAL_RO_STATUS."</th>";
1343
            $ret .= "
1344
               <th class='listeheader'>" . _APCAL_RO_ACTION . '</th>
1345
             </tr>';
1346
            while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
1347
                $rom_id     = $member->rom_id;
1348
                $uname      = $member->uname;
1349
                $firstname  = $member->rom_firstname;
1350
                $lastname   = $member->rom_lastname;
1351
                $email      = $member->rom_email;
1352
                $extrainfo1 = $member->rom_extrainfo1;
1353
                $extrainfo2 = $member->rom_extrainfo2;
1354
                $extrainfo3 = $member->rom_extrainfo3;
1355
                $extrainfo4 = $member->rom_extrainfo4;
1356
                $extrainfo5 = $member->rom_extrainfo5;
1357
                $status     = (int)$member->rom_status;
1358 View Code Duplication
                if ($line == 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1359
                    $classname = 'odd';
1360
                    $line      = 1;
1361
                } else {
1362
                    $classname = 'even';
1363
                    $line      = 0;
1364
                }
1365
                $counter++;
1366
                $ret .= "<tr>
1367
                    <td class='$classname'>" . $counter . "</td>
1368
                    <td class='$classname'>$uname</td>
1369
                    <td class='$classname'>$firstname</td>
1370
                    <td class='$classname'>$lastname</td>
1371
                    <td class='$classname'>$email</td>";
1372
                if ($cal->ro_extrainfo1 !== '') {
1373
                    $ret .= "<td class='$classname'>$extrainfo1</td>";
1374
                }
1375
                if ($cal->ro_extrainfo2 !== '') {
1376
                    $ret .= "<td class='$classname'>$extrainfo2</td>";
1377
                }
1378
                if ($cal->ro_extrainfo3 !== '') {
1379
                    $ret .= "<td class='$classname'>$extrainfo3</td>";
1380
                }
1381
                if ($cal->ro_extrainfo4 !== '') {
1382
                    $ret .= "<td class='$classname'>$extrainfo4</td>";
1383
                }
1384
                if ($cal->ro_extrainfo5 !== '') {
1385
                    $ret .= "<td class='$classname'>$extrainfo5</td>";
1386
                }
1387
                $ret .= "<td class='$classname' style='text-align:center'>";
1388
                $unique_id = uniqid(mt_rand());
1389
                $ret .= "
1390
                    <form method='post' action='ro_regonlinehandler.php' name='roformlistconfirm_".$unique_id."' style='margin:0px;'>
1391
                      <input type='hidden' name='eventid' value='$eventid' />
1392
                      <input type='hidden' name='url' value='$url' />
1393
                      <input type='hidden' name='eventurl' value='$eventurl' />
1394
                      <input type='hidden' name='rom_id' value='$rom_id' />
1395
                      <input type='hidden' name='summary' value='$summary' />
1396
                      <input type='hidden' name='date' value='$date' />
1397
                      <input type='hidden' name='location' value='$location' />
1398
                      <input type='hidden' name='uid' value='$uid' />
1399
                      <input type='hidden' name='event_uid' value='$event_uid' /> 
1400
                      <input type='hidden' name='firstname' value='$firstname' />
1401
                      <input type='hidden' name='lastname' value='$lastname' />
1402
                      <input type='hidden' name='email' value='$email' />
1403
                      <input type='hidden' name='uname' value='$uname' />
1404
                      <input type='hidden' name='current_uname' value='$current_uname' />              
1405
                      <input type='hidden' name='status' value='$status' />
1406
                      <div style='display:inline;'>";
1407 View Code Duplication
                        if (($event_uid == $current_uid && $current_uid > 0) || //current user is event owner
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1408
                            ($cal->isadmin == 1) || //current user is admin
1409
                            ($cal->ro_superedit == 1)) //current user can edit/delete registrations of other persons
0 ignored issues
show
The property ro_superedit does not seem to exist. Did you mean superedit?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1410
                        {
1411
                            if ($status == 1) {
1412
                                $ret .= "<input type='image' src='$roimagestatuspending' name='confirm_member' alt='"._APCAL_RO_STATUS_PENDING."' title='"._APCAL_RO_STATUS_PENDING."'  height='22px' />";
1413
                            } else if ($status == 2){
1414
                                $ret .= "<input type='image' src='$roimagestatuslist' name='confirm_member' alt='"._APCAL_RO_STATUS_LIST."' title='"._APCAL_RO_STATUS_LIST."'  height='22px' />";
1415
                            } else {
1416
                                $ret .= "<input type='image' src='$roimagestatusok' name='confirm_member' alt='"._APCAL_RO_STATUS_OK."' title='"._APCAL_RO_STATUS_OK."'  height='22px' />";
1417
                            }
1418
                        } else {
1419
                            if ($status == 1) {
1420
                                $ret .= "<img src='$roimagestatuspending' name='confirm_member' alt='"._APCAL_RO_STATUS_PENDING."' title='"._APCAL_RO_STATUS_PENDING."'  height='22px' />";
1421
                            } else if ($status == 2){
1422
                                $ret .= "<img src='$roimagestatuslist' name='confirm_member' alt='"._APCAL_RO_STATUS_LIST."' title='"._APCAL_RO_STATUS_LIST."'  height='22px' />";
1423
                            } else {
1424
                                $ret .= "<img src='$roimagestatusok' name='confirm_member' alt='"._APCAL_RO_STATUS_OK."' title='"._APCAL_RO_STATUS_OK."'  height='22px' />";
1425
                            }
1426
                        }
1427
1428
                        $ret .= "
1429
                      </div>
1430
                    </form>";
1431
                $ret .= "</td>";
1432
                $ret .= "<td class='$classname'>";
1433
                
1434
                $current_ip = gethostbyaddr(getenv("REMOTE_ADDR"));
1435
                if ($current_ip=='') $current_ip='-';
1436
                if (!isset($xoopsUser) || !is_object($xoopsUser)) {
1437
                    $current_uid = 0;
1438
                } else {
1439
                    $current_uid = $xoopsUser->getVar('uid');
1440
                }
1441
                if (($event_uid == $current_uid && $current_uid > 0) || //current user is event owner
1442
                    ($submitter == $current_uid && $current_uid > 0) || //current user made registration
1443
                    ($cal->isadmin == 1) || //current user is admin
1444
                    ($cal->superedit == 1) || //current user can edit/delete registrations of other persons
1445
                    ($submitter == $current_uid && $current_uid == 0 && $poster_ip == $current_ip)) //current user is guest, but ip is the same as guest who made registration 
1446
                    { //end added
1447
                        $unique_id = uniqid(mt_rand());
1448
                        $ret .= "
1449
                        <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformlist_" . $unique_id . "' style='margin:0px;'>
1450
                            <input type='hidden' name='eventid' value='$eventid' />
1451
                            <input type='hidden' name='url' value='$url' />
1452
                            <input type='hidden' name='eventurl' value='$eventurl' />
1453
                            <input type='hidden' name='event_uid' value='$event_uid' />
1454
                            <input type='hidden' name='rom_id' value='$rom_id' />
1455
                            <input type='hidden' name='firstname' value='$firstname' />
1456
                            <input type='hidden' name='lastname' value='$lastname' />
1457
                            <input type='hidden' name='email' value='$email' />
1458
                            <input type='hidden' name='summary' value='$summary' />
1459
                            <input type='hidden' name='date' value='$date' />
1460
                            <input type='hidden' name='location' value='$location' />
1461
                            <input type='hidden' name='uname' value='$uname' />  
1462
                            <input type='hidden' name='uid' value='$uid' />
1463
                            <input type='hidden' name='event_uid' value='$event_uid' />           
1464
                            <input type='hidden' name='extrainfo1' value='$extrainfo1' />
1465
                            <input type='hidden' name='extrainfo2' value='$extrainfo2' />
1466
                            <input type='hidden' name='extrainfo3' value='$extrainfo3' />
1467
                            <input type='hidden' name='extrainfo4' value='$extrainfo4' />
1468
                            <input type='hidden' name='extrainfo5' value='$extrainfo5' />
1469
                            <input type='hidden' name='status' value='$status' />
1470
                            <input type='hidden' name='current_uname' value='$current_uname' />
1471
                            <input type='hidden' name='num_members' value='$num_rows' />
1472
                            <div style='display:inline;'>                            
1473
                                    <input type='image' src='$roimageedit' name='form_edit' alt='" . _APCAL_RO_BTN_EDIT . "' title='" . _APCAL_RO_BTN_EDIT . "'  height='22px' />
1474
                                    <input type='image' src='$roimagedelete' name='remove_member' alt='" . _APCAL_RO_BTN_REMOVE . "' title='" . _APCAL_RO_BTN_REMOVE . "'  height='22px' />
1475
                             </div>
1476
                        </form>";
1477
1478
1479
                    }
1480
                    $ret .= '
1481
                    </td>
1482
                </tr>';
1483
            }
1484
            $ret .= "</table>\n<br>";
1485
1486
            $ret .= "<div align='center'><a href='$eventurl' target='_self'><img src='$roimagecancel' name='goback' alt='" . _APCAL_RO_BTN_BACK . "' title='" . _APCAL_RO_BTN_BACK . "' style='height:24px;margin:0 10px;'/></a>";
1487
            if ($cal->enableprint) {
1488
                $ret .= "<a href='print.php?smode=ro_list&eventid=$eventid&summary=$summary&date=$date&location=$location' target='_blank'><img src='$roimageprint' name='print' alt='" . _APCAL_RO_PRINT_LIST . "' title='" . _APCAL_RO_PRINT_LIST . "' style='height:24px;margin:0 10px;'/></a>";
1489
                $ret .= "<a href='print.php?smode=ro_list&op=exportxls&eventid=$eventid&summary=$summary&date=$date&location=$location' target='_blank'><img src='$roimagedownload' name='download' alt='" . _APCAL_RO_DOWNLOAD . "' title='" . _APCAL_RO_DOWNLOAD . "' style='height:24px;margin:0 10px;'/></a>";
1490
            }
1491
            $ret .= "</div>\n";
1492
1493
            //show form for sending mail to all registered persons; only allowed for event owner or admins
1494
            if (($event_uid == $current_uid && $current_uid > 0) || //current user is event owner
1495
                ($cal->isadmin == 1) || //current user is admin
1496
                ($cal->superedit == 1) //current user can edit/delete registrations of other persons
1497
               )
1498
            {
1499
                $query = 'SELECT ' . $GLOBALS['xoopsDB']->prefix('users') . '.email ';
1500
                $query .= 'FROM ' . $GLOBALS['xoopsDB']->prefix('users');
1501
                $query .= ' WHERE (((' . $GLOBALS['xoopsDB']->prefix('users') . ".uid)=$event_uid))";
1502
1503
                $res = $GLOBALS['xoopsDB']->query($query);
1504
                $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1505
1506 View Code Duplication
                if ($num_rows == 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1507
                    $sender = '';
1508
                } else {
1509
                    while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
1510
                        $sender = $member->email;
1511
                    }
1512
                }
1513
                $mailtext = _APCAL_RO_EVENT . ": $summary\n" . _APCAL_RO_DATE . ": $date\n" . _APCAL_RO_LOCATION . ": $location\n" . _APCAL_RO_LINK . ": $eventurl\n\n";
1514
                $ret .= "
1515
                    <br><br><br>
1516
                    <p class='listeheader'>" . _APCAL_RO_TITLE4 . "</p>
1517
                    <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformsendmail' accept-charset='UTF-8'>
1518
                    <table border='0' width='100%'>
1519
                        <tr>
1520
                            <td class='even' width='100px'>" . _APCAL_RO_MAIL_SENDER . ":</td>
1521
                            <td class='odd'><input type='text' name='sender' size='70' value='$sender'></td>
1522
                        </tr>
1523
                        <tr>
1524
                            <td class='even' width='100px'>" . _APCAL_RO_MAIL_SUBJ . ":</td>
1525
                            <td class='odd'><input type='text' name='subject' size='70' value='" . _APCAL_RO_MAIL_SUBJ_TEXT . "'></td>
1526
                        </tr>
1527
                        <tr>
1528
                            <td class='even' width='200px'>" . _APCAL_RO_MAIL_BODY1 . ":<br><br><font size='1'>" . _APCAL_RO_MAIL_BODY2 . "</font></td>
1529
                            <td class='odd' height='200px' valign='top'>
1530
                            <textarea rows='25' name='mailtext' cols='95'>$mailtext</textarea></td>
1531
                      </tr>
1532
                    </table>
1533
                        <input type='hidden' name='url' value='$url' />
1534
                        <input type='hidden' name='eventurl' value='$eventurl' />
1535
                        <input type='hidden' name='eventid' value='$eventid' />
1536
                        <p style='text-align:center;align:center'><input type='image' src='$roimagesend' name='ro_notify_all' alt='" . _APCAL_RO_BTN_SEND . "' title='" . _APCAL_RO_BTN_SEND . "' height='24px'/></p>
1537
                    </form>
1538
                    \n";
1539
            }
1540
        }
1541
        echo $ret;
1542
    }
1543
}
1544
1545
if (isset($_POST['sendmail_member']) || isset($_POST['sendmail_member_x'])) {
1546
    if (!empty($_REQUEST['eventid'])){
1547
1548
        $uid       = Request::getInt('uid');
1549
        $event_uid = Request::getInt('event_uid');
1550
        $eventid   = Request::getInt('eventid');
1551
        $summary   = Request::getString('summary', '');
1552
        $date      = Request::getInt('date');
1553
        $location  = Request::getString('location', '');
1554
        $eventurl  = Request::getString('eventurl', '');
1555
        $email     = Request::getString('email', '');
1556
        $firstname = Request::getString('firstname', '');
1557
        $lastname  = Request::getString('lastname', '');
1558
        $classname ='';
1559
1560 View Code Duplication
        if( ! empty( $_SERVER['HTTPS'] ) ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1561
            $url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ;
1562
        } else {
1563
            $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ;
1564
        }
1565
1566
        $url .= "?list=1";
1567
        $url .= "&uid=$event_uid";
1568
        $url .= "&eventid=$eventid";
1569
        $url .= "&event_uid=$event_uid";
1570
        $url .= "&summary=$summary";
1571
        $url .= "&date=$date";
1572
        $url .= "&location=$location";
1573
        $url .= "&eventurl=$eventurl";
1574
1575
        //show form for sending mail to registered persons
1576
        $unique_id = uniqid(mt_rand());
1577
1578
        $query = "SELECT ".$GLOBALS['xoopsDB']->prefix("users").".email ";
1579
        $query .= "FROM ".$GLOBALS['xoopsDB']->prefix("users");
1580
        $query .= " WHERE (((".$GLOBALS['xoopsDB']->prefix("users").".uid)=$event_uid))";
1581
1582
        $res = $GLOBALS['xoopsDB']->query($query);
1583
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1584
1585 View Code Duplication
        if( $num_rows == 0 ) $sender= "" ;
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1586
        else while( $member = $GLOBALS['xoopsDB']->fetchObject($res) ) {
1587
            $sender=$member->email;
1588
        }
1589
        $mailtext = _APCAL_RO_EVENT.": $summary\n"._APCAL_RO_DATE.": $date\n"._APCAL_RO_LOCATION.": $location\n"._APCAL_RO_LINK.": $eventurl\n\n";
1590
        $mailtext .= "Hallo $firstname $lastname\n\n";
1591
        $ret .= "
1592
    <br /><br /><br />
1593
    <table border='1' cellpadding='0' cellspacing='0' width='100%'>
1594
      <tr>
1595
        <td class='listeheader'>"._APCAL_RO_TITLE4."</td>
1596
      </tr>
1597
    </table>
1598
    <form method='post' action='ro_regonlinehandler.php' name='roformsendmail".$unique_id."' accept-charset='UTF-8'>
1599
    <table border='1' width='100%'>
1600
      <tr>
1601
        <td class='even' width='100px'>"._APCAL_RO_MAIL_SENDER.":</td>
1602
        <td class='odd'><input type='text' name='sender' size='70' value='$sender'></td>
1603
      </tr>
1604
      <tr>
1605
        <td class='even' width='100px'>"._APCAL_RO_MAIL_RECEPIENT.":</td>
1606
        <td class='odd'><input type='text' name='email' size='70' value='$email'></td>
1607
      </tr>
1608
      <tr>
1609
        <td class='even' width='100px'>"._APCAL_RO_MAIL_SUBJ.":</td>
1610
        <td class='odd'><input type='text' name='subject' size='70' value='"._APCAL_RO_MAIL_SUBJ_TEXT."'></td>
1611
      </tr>
1612
      <tr>
1613
        <td class='even' width='200px'>"._APCAL_RO_MAIL_BODY1.":<br/><br/><font size='1'>"._APCAL_RO_MAIL_BODY2."</font></td>
1614
        <td class='odd' height='200px' valign='top'>
1615
        <textarea rows='25' name='mailtext' cols='95'>$mailtext</textarea></td>
1616
      </tr>
1617
    </table>
1618
        <input type='hidden' name='url' value='$url' />
1619
        <input type='hidden' name='eventurl' value='$eventurl' />
1620
        <input type='hidden' name='eventid' value='$eventid' />
1621
        <p style='text-align:center;align:center'>
1622
        <input type='image' src='$roimagesend' name='ro_notify_one' alt='"._APCAL_RO_BTN_SEND."' title='"._APCAL_RO_BTN_SEND."' height='32px'/>
1623
        <input type='image' src='$roimagecancel' name='goback' alt='"._APCAL_RO_BTN_BACK."' title='"._APCAL_RO_BTN_BACK."' height='32px'/>
1624
        </p>
1625
    </form>
1626
    \n";
1627
1628
1629
        echo $ret;
1630
    }
1631
}
1632
1633
if (isset($_POST['form_edit']) || isset($_POST['form_edit_x'])) {
1634
    if (!empty($_POST['rom_id'])) {
1635
        $rom_id     = Request::getInt('rom_id');
1636
        $url        = Request::getString('url', '');
1637
        $event_uid  = Request::getInt('event_uid');
1638
        $eventurl   = Request::getString('eventurl', '');
1639
        $uname      = Request::getString('uname', '');
1640
        $eventid    = Request::getInt('eventid');
1641
        $firstname  = Request::getString('firstname', '');
1642
        $lastname   = Request::getString('lastname', '');
1643
        $email      = Request::getString('email', '');
1644
        $extrainfo1 = Request::getString('extrainfo1', '');
1645
        $extrainfo2 = Request::getString('extrainfo2', '');
1646
        $extrainfo3 = Request::getString('extrainfo3', '');
1647
        $extrainfo4 = Request::getString('extrainfo4', '');
1648
        $extrainfo5 = Request::getString('extrainfo5', '');
1649
        $summary    = Request::getString('summary', '');
1650
        $date       = Request::getInt('date');
1651
        $location   = Request::getString('location', '');
1652
        $sendconf   = Request::getInt('sendconf');
1653
        $status     = Request::getInt('status');
1654
1655
        //get username and email
1656
        global $xoopsUser;
1657 View Code Duplication
        if (!isset($xoopsUser) || !is_object($xoopsUser)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1658
            $uname = '';
1659
            $email = '';
1660
            $uid   = 0;
1661
        } else {
1662
            $uname = $xoopsUser->getVar('uname');
1663
            $email = $xoopsUser->getVar('email');
1664
            $uid   = $xoopsUser->getVar('uid');
1665
        }
1666
1667
        $ret  = '';
1668
        $retList = '';
1669
1670
        $ret = "
1671
        <table border='0' width='100%'>
1672
            <tr><td width='100%' class='itemHead'><span class='itemTitle'>" . _APCAL_RO_TITLE5 . "</span></td></tr>
1673
            <tr><td width='100%'>
1674
            <form class='apcalForm' method='post' id='RegOnlineForm' action='ro_regonlinehandler.php' name='roformeditmember' style='margin:0px;'>
1675
                <input type='hidden' name='url' value='$url' />
1676
                <input type='hidden' name='rom_id' value='$rom_id' />
1677
                <table>
1678
                    <tr>
1679
                        <td class='even' width='120px'>" . _APCAL_RO_FIRSTNAME . "*:</td>
1680
                        <td class='odd'><input type='text' name='firstname' value='$firstname' size='100' /></td>
1681
                    </tr>
1682
                    <tr>
1683
                        <td class='even' width='120px'>" . _APCAL_RO_LASTNAME . "*:</td>
1684
                        <td class='odd'><input type='text' name='lastname' value='$lastname' size='100' /></td>
1685
                    </tr>
1686
                    <tr>
1687
                        <td class='even' width='120px'>" . _APCAL_RO_EMAIL . ":</td>
1688
                        <td class='odd'><input type='text' name='email' value='$email' size='100' /></td>
1689
                    </tr>";
1690
        if ($cal->ro_extrainfo1 !== '') {
1691
            $ret .= "
1692
                    <tr>
1693
                        <td class='even' width='120px'>" . $cal->ro_extrainfo1 . ":</td>
1694
                        <td class='odd'><input type='text' name='extrainfo1' value='$extrainfo1' size='100' /></td>
1695
                    </tr>";
1696
        }
1697
        if ($cal->ro_extrainfo2 !== '') {
1698
            $ret .= "
1699
                    <tr>
1700
                        <td class='even' width='120px'>" . $cal->ro_extrainfo2 . ":</td>
1701
                        <td class='odd'><input type='text' name='extrainfo2' value='$extrainfo2' size='100' /></td>
1702
                    </tr>";
1703
        }
1704
        if ($cal->ro_extrainfo3 !== '') {
1705
            $ret .= "
1706
                    <tr>
1707
                        <td class='even' width='120px'>" . $cal->ro_extrainfo3 . ":</td>
1708
                        <td class='odd'><input type='text' name='extrainfo3' value='$extrainfo3' size='100' /></td>
1709
                    </tr>";
1710
        }
1711
        if ($cal->ro_extrainfo4 !== '') {
1712
            $ret .= "
1713
                    <tr>
1714
                        <td class='even' width='120px'>" . $cal->ro_extrainfo4 . ":</td>
1715
                        <td class='odd'><input type='text' name='extrainfo4' value='$extrainfo4' size='100' /></td>
1716
                    </tr>";
1717
        }
1718
        if ($cal->ro_extrainfo5 !== '') {
1719
            $ret .= "
1720
                    <tr>
1721
                        <td class='even' width='120px'>" . $cal->ro_extrainfo5 . ":</td>
1722
                        <td class='odd'><input type='text' name='extrainfo5' value='$extrainfo5' size='100' /></td>
1723
                    </tr>";
1724
        }
1725
        if (($event_uid == $uid && $uid > 0) || //current user is event owner
1726
            ($cal->isadmin == 1) || //current user is admin
1727
            ($cal->ro_superedit == 1)) //current user can edit/delete registrations of other persons
0 ignored issues
show
The property ro_superedit does not seem to exist. Did you mean superedit?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1728
        {
1729
            $ret .= "
1730
          <tr>
1731
            <td class='even' width='120px'>"._APCAL_RO_STATUS.":</td>
1732
            <td class='odd'>
1733
              <input id='status0' type='radio' value='0'";
1734
            if ($status == 0 ) $ret .=" checked='checked'";
1735
            $ret .=" title="._APCAL_RO_STATUS_OK." name='status' />
1736
              <label for='status0' name='xolb_status0'>"._APCAL_RO_STATUS_OK."</label>&nbsp;&nbsp;
1737
              <input id='status1' type='radio' value='1'";
1738
            if ($status == 1) $ret .=" checked='checked'";
1739
            $ret .=" title="._APCAL_RO_STATUS_PENDING." name='status' />
1740
              <label for='status1' name='xolb_status1'>"._APCAL_RO_STATUS_PENDING."</label>&nbsp;&nbsp;
1741
              <input id='status2' type='radio' value='2'";
1742
            if ($status == 2) $ret .=" checked='checked'";
1743
            $ret .=" title="._APCAL_RO_STATUS_LIST." name='status' />
1744
              <label for='status2' name='xolb_status2'>"._APCAL_RO_STATUS_LIST."</label>
1745
            </td>
1746
          </tr>";
1747
        } else {
1748
            $ret .= "<input type='hidden' name='status' value='$status' size='100' />";
1749
        }
1750
        $ret .= '
1751
                </table>
1752
                * ' . _APCAL_RO_OBLIGATORY . "
1753
                <br><br>
1754
                <div align='center'>
1755
                    <input type='image' src='$roimagesave' name='edit_member' alt='" . _APCAL_RO_BTN_CONF_EDIT . "' title='" . _APCAL_RO_BTN_CONF_EDIT . "' height='24px'/>
1756
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1757
                    <input type='image' src='$roimagecancel' name='cancel' alt='" . _APCAL_RO_BTN_CANCEL . "' title='" . _APCAL_RO_BTN_CANCEL . "' height='24px'/>
1758
                </div>
1759
            </form>
1760
            </td></tr>
1761
        </table>\n<br><br>";
1762
1763
        echo $ret;
1764
    }
1765
}
1766
1767
if (isset($_POST['edit_member']) || isset($_POST['edit_member_x'])) {
1768
    if (!empty($_POST['rom_id'])) {
1769
        $rom_id     = Request::getInt('rom_id');
1770
        $uid        = Request::getInt('uid');
1771
        $url        = Request::getString('url', '');
1772
        $eventurl   = Request::getString('eventurl', '');
1773
        $uname      = Request::getString('uname', '');
1774
        $eventid    = Request::getInt('eventid');
1775
        $firstname  = Request::getString('firstname', '');
1776
        $lastname   = Request::getString('lastname', '');
1777
        $email      = Request::getString('email', '');
1778
        $extrainfo1 = Request::getString('extrainfo1', '');
1779
        $extrainfo2 = Request::getString('extrainfo2', '');
1780
        $extrainfo3 = Request::getString('extrainfo3', '');
1781
        $extrainfo4 = Request::getString('extrainfo4', '');
1782
        $extrainfo5 = Request::getString('extrainfo5', '');
1783
        $summary    = Request::getString('summary', '');
1784
        $date       = Request::getInt('date');
1785
        $location   = Request::getString('location', '');
1786
        $sendconf   = Request::getInt('sendconf');
1787
        $status     = Request::getInt('status');
1788
1789
        if ($firstname === '') {
1790
            $firstname = '-';
1791
        }
1792
        if ($lastname === '') {
1793
            $lastname = '-';
1794
        }
1795
        if ($email === '') {
1796
            $email = '-';
1797
        }
1798
        if ($extrainfo1 === '') {
1799
            $extrainfo1 = '-';
1800
        }
1801
        if ($extrainfo2 === '') {
1802
            $extrainfo2 = '-';
1803
        }
1804
        if ($extrainfo3 === '') {
1805
            $extrainfo3 = '-';
1806
        }
1807
        if ($extrainfo4 === '') {
1808
            $extrainfo4 = '-';
1809
        }
1810
        if ($extrainfo5 === '') {
1811
            $extrainfo5 = '-';
1812
        }
1813
1814
        $query = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ' SET ';
1815
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_firstname = '$firstname', ";
1816
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_lastname = '$lastname', ";
1817
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_email = '$email', ";
1818
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_extrainfo1 = '$extrainfo1', ";
1819
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_extrainfo2 = '$extrainfo2', ";
1820
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_extrainfo3 = '$extrainfo3', ";
1821
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_extrainfo4 = '$extrainfo4', ";
1822
        $query .= $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_extrainfo5 = '$extrainfo5', ";
1823
        $query .= $GLOBALS['xoopsDB']->prefix("apcal_ro_members") . ".rom_status = $status ";
1824
        $query .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('apcal_ro_members') . ".rom_id)=$rom_id))";
1825
1826
        $res = $GLOBALS['xoopsDB']->query($query);
1827
        if (!$res) {
1828
            redirect_header($url, 3, _APCAL_RO_ERROR_EDIT);
1829
        } else {
1830
            redirect_header($url, 3, _APCAL_RO_SUCCESS_EDIT);
1831
        }
1832
    }
1833
}
1834
1835
if (isset($_POST['cancel']) || isset($_POST['cancel_x'])) {
1836 View Code Duplication
    if (!empty($_POST['eventurl'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1837
        $url = Request::getString('eventurl', '');
1838
        redirect_header($url, 1, _APCAL_RO_CANCEL);
1839
    }
1840 View Code Duplication
    if (!empty($_POST['url'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1841
        $url = Request::getString('url', '');
1842
        redirect_header($url, 1, _APCAL_RO_CANCEL);
1843
    }
1844
}
1845
if (isset($_POST['goback']) || isset($_POST['goback_x'])) {
1846 View Code Duplication
    if (!empty($_POST['eventurl'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1847
        $url = Request::getString('eventurl', '');
1848
        redirect_header($url, 0, _APCAL_RO_BACK);
1849
    }
1850
}
1851
1852
if (isset($_POST['ro_notify_all']) || isset($_POST['ro_notify_all_x'])) {
1853
    if (!empty($_POST['url'])) {
1854
        $url      = Request::getString('url', '');
1855
        $eventurl = Request::getString('eventurl', '');
1856
        $eventid  = Request::getInt('eventid');
1857
        $sender   = Request::getString('sender', '');
1858
        $subject  = Request::getString('subject', '');
1859
        $mailtext = Request::getString('mailtext', '');
1860
        $counter  = 0;
1861
1862
        //$subject = utf8_encode($subject);
1863
        //$mailtext = utf8_encode($mailtext);
1864
1865
        $query = 'SELECT '
1866
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1867
                 . '.rom_email, rom_firstname, rom_lastname FROM '
1868
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1869
                 . ' WHERE ((('
1870
                 . $GLOBALS['xoopsDB']->prefix('apcal_ro_members')
1871
                 . ".rom_eventid)=$eventid) AND not(rom_email is null))";
1872
1873
        $res      = $GLOBALS['xoopsDB']->query($query);
1874
        $num_rows = $GLOBALS['xoopsDB']->getRowsNum($res);
1875
1876
        if ($num_rows == 0) {
1877
            //no action
1878
        } else {
1879
            while ($member = $GLOBALS['xoopsDB']->fetchObject($res)) {
1880
                $recipient = $member->rom_email;
1881
                $firstname = $member->rom_firstname;
1882
                $lastname  = $member->rom_lastname;
1883
1884 View Code Duplication
                if ($recipient != '-') {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1885
                    ++$counter;
1886
1887
                    $xoopsMailer = xoops_getMailer();
1888
                    $xoopsMailer->useMail();
1889
                    //set template path
1890
                    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/')) {
1891
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
1892
                    } else {
1893
                        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1894
                    }
1895
                    //set template name
1896
                    $xoopsMailer->setTemplate('ro_notify_all.tpl');
1897
                    //set sender
1898
                    $xoopsMailer->setFromEmail($sender); //take email from inputbox
1899
                    //set sender name
1900
                    $xoopsMailer->setFromName($cal->ro_mail_sendername);
1901
                    //set subject
1902
                    $xoopsMailer->setSubject($subject);
1903
                    //assign vars
1904
                    $xoopsMailer->assign('MAILTEXT', $mailtext);
1905
                    $xoopsMailer->assign('NAME', $firstname . ' ' . $lastname);
1906
                    $xoopsMailer->assign('SUMMARY', $summary);
1907
                    $xoopsMailer->assign('DATE', $date);
1908
                    $xoopsMailer->assign('LOCATION', $location);
1909
                    $xoopsMailer->assign('URL', $eventurl);
1910
                    $xoopsMailer->assign('SIGNATURE', $cal->ro_mail_signature);
1911
                    //set recipient
1912
                    $xoopsMailer->setToEmails($recipient);
1913
1914
                    //execute sending
1915
                    $xoopsMailer->send();
1916
                    $xoopsMailer->reset();
1917
                }
1918
            }
1919
        }
1920
1921
        redirect_header($url, 3, $counter . _APCAL_RO_MAILSENT);
1922
    }
1923
}
1924
1925
if (isset($_POST['ro_notify_one']) || isset($_POST['ro_notify_one_x'])) {
1926
1927
    if (!empty($_POST['url'])){
1928
1929
        $url      = Request::getString('url', '');
1930
        $eventurl = Request::getString('eventurl', '');
1931
        $eventid  = Request::getInt('eventid');
1932
        $sender   = Request::getString('sender', '');
1933
        $email    = Request::getString('email', '');
1934
        $subject  = Request::getString('subject', '');
1935
        $mailtext = Request::getString('mailtext', '');
1936
        $counter=1;
1937
1938
        //$subject = utf8_encode($subject);
1939
        //$mailtext = utf8_encode($mailtext);
1940
        $recipient=$email;
1941
1942
        $xoopsMailer =& xoops_getMailer();
1943
        $xoopsMailer->useMail();
1944
        //set template path
1945
        if( file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/'. $xoopsConfig['language'] .'/')) {
1946
            $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/'. $xoopsConfig['language'] .'/mail_template/');
1947
        } else {
1948
            $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/mail_template/');
1949
        }
1950
        //set template name
1951
        $xoopsMailer->setTemplate('ro_notify_all.tpl');
1952
        //set sender
1953
        $xoopsMailer->setFromEmail($sender); //take email from inputbox
1954
        //set sender name
1955
        $xoopsMailer->setFromName($cal->ro_mail_sendername);
1956
        //set subject
1957
        $xoopsMailer->setSubject($subject);
1958
        //assign vars
1959
        $xoopsMailer->assign("MAILTEXT", $mailtext);
1960
        //set recipient
1961
        $xoopsMailer->setToEmails($recipient);
1962
1963
        //execute sending
1964
        $xoopsMailer->send();
1965
        $xoopsMailer->reset();
1966
1967
        redirect_header($url, 3, $counter._APCAL_RO_MAILSENT) ;
1968
1969
    }
1970
}
1971
1972
require XOOPS_ROOT_PATH . '/footer.php';
1973