-
Notifications
You must be signed in to change notification settings - Fork 1
/
changeeinfo-form.inc.php
126 lines (111 loc) · 3.88 KB
/
changeeinfo-form.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
if (!defined('ALLOWINCLUDES')) { exit; } // prohibits direct calling of include files
// ================================
// Display input form
// ================================
if (isset($eventid)) {
if (isset($copy) && $copy == 1) {
pageheader(lang('copy_event', false), 'Update');
echo '<input type="hidden" name="copy" value="' . $copy . '" />' . "\n";
}
else {
pageheader(lang('update_event', false), 'Update');
}
}
else {
pageheader(lang('add_new_event', false), 'Update');
}
// Preset event with defaults if the form has not yet been submitted.
if (!isset($check)) { defaultevent($event, $_SESSION['AUTH_SPONSORID']); }
// Load template if necessary
if (isset($templateid)) {
if ($templateid > 0) {
$result = DBQuery("
SELECT
*
FROM
" . SCHEMANAME . "vtcal_template
WHERE
calendarid='" . sqlescape($_SESSION['CALENDAR_ID']) . "'
AND
id='" . sqlescape($templateid) . "'
");
$event = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
}
}
// "add new event" was started from week,month or detail view.
if (isset($timebegin_year)) { $event['timebegin_year'] = $timebegin_year; }
if (isset($timebegin_month)) { $event['timebegin_month'] = $timebegin_month; }
if (isset($timebegin_day)) { $event['timebegin_day'] = $timebegin_day; }
// Load event to update information if it's the first time the form is viewed.
if (isset($eventid) && (!isset($check) || $check != 1)) {
$result = DBQuery("
SELECT
*
FROM
" . SCHEMANAME . "vtcal_event
WHERE
calendarid='" . sqlescape($_SESSION['CALENDAR_ID']) . "'
AND
id='" . sqlescape($eventid) . "'
");
// Event exists in "vtcal_event".
if ($result->numRows() > 0) { $event = $result->fetchRow(DB_FETCHMODE_ASSOC, 0); }
// For some reason the event is not in "vtcal_event" (even though it should be).
// Try to load it from "event_public".
else {
$result = DBQuery("
SELECT
*
FROM
" . SCHEMANAME . "vtcal_event_public
WHERE
calendarid='" . sqlescape($_SESSION['CALENDAR_ID']) . "'
AND
id='" . sqlescape($eventid) . "'
");
// Event exists in "event_public".
// Insert into "vtcal_event" since it is missing.
if ($result->numRows() > 0) {
$event = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
//eventaddslashes($event);
insertintoevent($event['id'], $event);
}
}
disassemble_timestamp($event);
if (!empty($event['repeatid'])) { readinrepeat($event['repeatid'], $event, $repeat); }
else { $repeat['mode'] = 0; }
//$sponsorid = $event[sponsorid];
}
contentsection_begin(lang('input_event_information'));
echo '
<form name="inputevent" action="changeeinfo.php" method="post">';
inputeventbuttons($httpreferer);
if (!isset($check)) { $check = 0; }
inputeventdata($event, $event['sponsorid'], 1, $check, 1, $repeat, $copy);
echo '
<input type="hidden" name="httpreferer" value="' . htmlspecialchars($httpreferer, ENT_COMPAT, 'UTF-8') . '" />';
if (isset($eventid)) { echo '
<input type="hidden" name="eventid" value="' . htmlspecialchars($event['id'], ENT_COMPAT, 'UTF-8') . '" />'; }
echo '
<input type="hidden" name="event[repeatid]" value="' .
(isset($event['repeatid'])? htmlspecialchars($event['repeatid'], ENT_COMPAT, 'UTF-8') : '') . '" />';
if (!$_SESSION['AUTH_ISCALENDARADMIN']) {
echo '
<input type="hidden" name="event[sponsorid]" value="' . htmlspecialchars($event['sponsorid'], ENT_COMPAT, 'UTF-8') . '" />';
}
if (isset($copy)) { echo '
<input type="hidden" name="copy" value="' . htmlspecialchars($copy, ENT_COMPAT, 'UTF-8') . '" />'; }
inputeventbuttons($httpreferer);
echo '
</form>';
contentsection_end();
function inputeventbuttons($httpreferer)
{
?>
<p><input type="submit" name="preview" value="<?php echo htmlspecialchars(lang('preview_event', false), ENT_COMPAT, 'UTF-8'); ?>" />
<input type="submit" name="cancel" value="<?php echo htmlspecialchars(lang('cancel_button_text', false), ENT_COMPAT, 'UTF-8'); ?>" onclick="location.href='<?php echo htmlspecialchars($httpreferer, ENT_COMPAT, 'UTF-8'); ?>';return false;" /></p>
<?php
}
?>