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