Michal Szczotka <michal@tuxy.org> Calendar plugin.
[squirrelmail.git] / plugins / calendar / event_delete.php
CommitLineData
d61a01d4 1<?php
2/*
3 * event_delete.php
4 *
5 * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * Functions to delete a event.
9 *
10 * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org.
11 */
12
13require_once('calendar_data.php');
14require_once('functions.php');
15chdir('..');
16require_once('../src/validate.php');
17require_once('../functions/strings.php');
18require_once('../functions/date.php');
19require_once('../config/config.php');
20require_once('../functions/page_header.php');
21require_once('../src/load_prefs.php');
22
23function confirm_deletion()
24{
25 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
26
27 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
28
29 echo " <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
30 " <TR><TH COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
31 _("Do you really want to delete this event?") . "<br></th>\n".
32 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Date:") . "</TD>\n".
33 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$dmonth/$dday/$dyear</TD></TR>\n".
34 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Time:") . "</TD>\n".
35 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$dhour:$dminute</TD></TR>\n".
36 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Title:") . "</TD>\n".
37 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[title]</TD></TR>\n".
38 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Message:") . "</TD>\n".
39 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[message]</TD></TR>\n".
40 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">\n".
41 " <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
42 " <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
43 " <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
44 " <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
45 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
46 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
47 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
48 " <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
49 " <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
50 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
51 " <INPUT TYPE=SUBMIT VALUE=\"Yes\">\n".
52 " </FORM>\n".
53 " </TD><TD ALIGN=LEFT BGCOLOR=\"$color[4]\">\n".
54 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
55 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
56 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
57 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
58 " <INPUT TYPE=SUBMIT VALUE=\"No\">\n".
59 " </FORM>\n".
60 " </TD></TR>\n".
61 " </TABLE>\n";
62
63
64}
65
66if ($month <= 0){
67 $month = date( 'm' );
68}
69if ($year <= 0){
70 $year = date( 'Y' );
71}
72if ($day <= 0){
73 $day = date( 'd' );
74}
75
76$calself=basename($PHP_SELF);
77
78displayPageHeader($color, 'None');
79//load calendar menu
80calendar_header();
81
82echo "<TR BGCOLOR=\"$color[0]\"><TD>".
83 "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">".
84 '<tr><td>'.
85 date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year));
86if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
87 if (isset($confirmed)){
88 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
89 echo '<br><br>' . _("Event deleted!") . "<BR>\n";
90 echo "<A HREF=\"day.php?year=$year&month=$month&day=$day\">Day View</A>\n";
91 } else {
92 readcalendardata();
93 confirm_deletion();
94 }
95} else {
96 echo '<br>' . _("Nothing to delete!");
97}
98
99?>
100</table></td></tr></table>
101</body></html>