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