d61a01d4 |
1 | <?php |
7c67a5e8 |
2 | |
3 | /** |
4 | * event_delete.php |
5 | * |
6c84ba1e |
6 | * Copyright (c) 2002-2005 The SquirrelMail Project Team |
7c67a5e8 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
d61a01d4 |
8 | * |
7c67a5e8 |
9 | * Originally contrubuted by Michal Szczotka <michal@tuxy.org> |
d61a01d4 |
10 | * |
91e0dccc |
11 | * Functions to delete a event. |
d61a01d4 |
12 | * |
2c85de8f |
13 | * $Id$ |
ea5f4b8e |
14 | * @package plugins |
15 | * @subpackage calendar |
16 | */ |
17 | |
18 | /** |
19 | * @ignore |
d61a01d4 |
20 | */ |
92219031 |
21 | define('SM_PATH','../../'); |
cf1efdce |
22 | |
8d6a115b |
23 | /* Calender plugin required files. */ |
24 | require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); |
25 | require_once(SM_PATH . 'plugins/calendar/functions.php'); |
26 | |
cf1efdce |
27 | /* SquirrelMail required files. */ |
28 | require_once(SM_PATH . 'include/validate.php'); |
29 | require_once(SM_PATH . 'functions/strings.php'); |
30 | require_once(SM_PATH . 'functions/date.php'); |
31 | require_once(SM_PATH . 'config/config.php'); |
32 | require_once(SM_PATH . 'functions/page_header.php'); |
aa7fb30c |
33 | require_once(SM_PATH . 'include/load_prefs.php'); |
cf1efdce |
34 | require_once(SM_PATH . 'functions/html.php'); |
95dcee50 |
35 | /* get globals */ |
d8270226 |
36 | if (isset($_GET['month']) && is_numeric($_GET['month'])) { |
95dcee50 |
37 | $month = $_GET['month']; |
38 | } |
d8270226 |
39 | elseif (isset($_POST['month']) && is_numeric($_GET['month'])) { |
95dcee50 |
40 | $month = $_POST['month']; |
41 | } |
d8270226 |
42 | if (isset($_GET['year']) && is_numeric($_GET['year'])) { |
95dcee50 |
43 | $year = $_GET['year']; |
44 | } |
d8270226 |
45 | elseif (isset($_POST['year']) && is_numeric($_POST['year'])) { |
95dcee50 |
46 | $year = $_POST['year']; |
47 | } |
d8270226 |
48 | if (isset($_GET['day']) && is_numeric($_GET['day'])) { |
95dcee50 |
49 | $day = $_GET['day']; |
50 | } |
d8270226 |
51 | elseif (isset($_POST['day']) && is_numeric($_POST['day'])) { |
95dcee50 |
52 | $day = $_POST['day']; |
53 | } |
d8270226 |
54 | if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) { |
95dcee50 |
55 | $dyear = $_GET['dyear']; |
56 | } |
d8270226 |
57 | elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) { |
95dcee50 |
58 | $dyear = $_POST['dyear']; |
59 | } |
d8270226 |
60 | if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) { |
95dcee50 |
61 | $dmonth = $_GET['dmonth']; |
62 | } |
d8270226 |
63 | elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) { |
95dcee50 |
64 | $dmonth = $_POST['dmonth']; |
65 | } |
d8270226 |
66 | if (isset($_GET['dday']) && is_numeric($_GET['dday'])) { |
95dcee50 |
67 | $dday = $_GET['dday']; |
68 | } |
d8270226 |
69 | elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) { |
95dcee50 |
70 | $dday = $_POST['dday']; |
71 | } |
d8270226 |
72 | if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) { |
95dcee50 |
73 | $dhour = $_GET['dhour']; |
74 | } |
d8270226 |
75 | elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) { |
95dcee50 |
76 | $dhour = $_POST['dhour']; |
77 | } |
d8270226 |
78 | if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) { |
95dcee50 |
79 | $dminute = $_GET['dminute']; |
80 | } |
d8270226 |
81 | elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) { |
95dcee50 |
82 | $dminute = $_POST['dminute']; |
83 | } |
84 | if (isset($_POST['confirmed'])) { |
85 | $confirmed = $_POST['confirmed']; |
86 | } |
87 | /* got 'em */ |
d61a01d4 |
88 | |
89 | function confirm_deletion() |
90 | { |
91 | global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day; |
92 | |
93 | $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"]; |
94 | |
b01b21d0 |
95 | echo html_tag( 'table', |
96 | html_tag( 'tr', |
6fd95361 |
97 | html_tag( 'th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"' ) |
b01b21d0 |
98 | ) . |
99 | html_tag( 'tr', |
100 | html_tag( 'td', _("Date:"), 'right', $color[4] ) . |
101 | html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] ) |
102 | ) . |
103 | html_tag( 'tr', |
104 | html_tag( 'td', _("Time:"), 'right', $color[4] ) . |
105 | html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] ) |
106 | ) . |
107 | html_tag( 'tr', |
108 | html_tag( 'td', _("Title:"), 'right', $color[4] ) . |
a11df61b |
109 | html_tag( 'td', $tmparray['title'], 'left', $color[4] ) |
b01b21d0 |
110 | ) . |
111 | html_tag( 'tr', |
112 | html_tag( 'td', _("Message:"), 'right', $color[4] ) . |
a11df61b |
113 | html_tag( 'td', $tmparray['message'], 'left', $color[4] ) |
b01b21d0 |
114 | ) . |
115 | html_tag( 'tr', |
116 | html_tag( 'td', |
6fd95361 |
117 | " <form name=\"delevent\" method=\"post\" action=\"$calself\">\n". |
118 | " <input type=\"hidden\" name=\"dyear\" value=\"$dyear\" />\n". |
119 | " <input type=\"hidden\" name=\"dmonth\" value=\"$dmonth\" />\n". |
120 | " <input type=\"hidden\" name=\"dday\" value=\"$dday\" />\n". |
121 | " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n". |
122 | " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n". |
123 | " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n". |
124 | " <input type=\"hidden\" name=\"dhour\" value=\"$dhour\" />\n". |
125 | " <input type=\"hidden\" name=\"dminute\" value=\"$dminute\" />\n". |
126 | " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n". |
127 | ' <input type="submit" value="' . _("Yes") . "\" />\n". |
128 | " </form>\n" , |
b01b21d0 |
129 | 'right', $color[4] ) . |
130 | html_tag( 'td', |
6fd95361 |
131 | " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n". |
132 | " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n". |
133 | " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n". |
134 | " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n". |
135 | ' <input type="submit" value="' . _("No") . "\" />\n". |
136 | " </form>\n" , |
b01b21d0 |
137 | 'left', $color[4] ) |
138 | ) , |
139 | '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' ); |
d61a01d4 |
140 | } |
141 | |
142 | if ($month <= 0){ |
143 | $month = date( 'm' ); |
144 | } |
145 | if ($year <= 0){ |
146 | $year = date( 'Y' ); |
147 | } |
148 | if ($day <= 0){ |
149 | $day = date( 'd' ); |
150 | } |
151 | |
152 | $calself=basename($PHP_SELF); |
153 | |
154 | displayPageHeader($color, 'None'); |
155 | //load calendar menu |
156 | calendar_header(); |
157 | |
b01b21d0 |
158 | echo html_tag( 'tr', '', '', $color[0] ) . |
159 | html_tag( 'td' ) . |
160 | html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) . |
161 | html_tag( 'tr' ) . |
162 | html_tag( 'td', '', 'left' ) . |
f3409980 |
163 | date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)); |
d61a01d4 |
164 | if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){ |
165 | if (isset($confirmed)){ |
166 | delete_event("$dmonth$dday$dyear", "$dhour$dminute"); |
6fd95361 |
167 | echo '<br /><br />' . _("Event deleted!") . "<br />\n"; |
1ba8cd6b |
168 | echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" . |
b01b21d0 |
169 | _("Day View") . "</a>\n"; |
d61a01d4 |
170 | } else { |
171 | readcalendardata(); |
172 | confirm_deletion(); |
173 | } |
174 | } else { |
6fd95361 |
175 | echo '<br />' . _("Nothing to delete!"); |
d61a01d4 |
176 | } |
177 | |
178 | ?> |
179 | </table></td></tr></table> |
91e0dccc |
180 | </body></html> |