Some code cleanups to read_body.php
[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 */
15
16require_once('calendar_data.php');
17require_once('functions.php');
18chdir('..');
cf1efdce 19define('SM_PATH','../');
20
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');
d61a01d4 29
30function confirm_deletion()
31{
32 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
33
34 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
35
b01b21d0 36 echo html_tag( 'table',
37 html_tag( 'tr',
38 html_tag( 'th', _("Do you really want to delete this event?") . '<br>', '', $color[4], 'colspan="2"' )
39 ) .
40 html_tag( 'tr',
41 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
42 html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
43 ) .
44 html_tag( 'tr',
45 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
46 html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
47 ) .
48 html_tag( 'tr',
49 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
50 html_tag( 'td', $tmparray[title], 'left', $color[4] )
51 ) .
52 html_tag( 'tr',
53 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
54 html_tag( 'td', $tmparray[message], 'left', $color[4] )
55 ) .
56 html_tag( 'tr',
57 html_tag( 'td',
58 " <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
59 " <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
60 " <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
61 " <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
62 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
63 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
64 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
65 " <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
66 " <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
67 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
68 ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
69 " </FORM>\n" ,
70 'right', $color[4] ) .
71 html_tag( 'td',
72 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
73 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
74 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
75 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
76 ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
77 " </FORM>\n" ,
78 'left', $color[4] )
79 ) ,
80 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
d61a01d4 81}
82
83if ($month <= 0){
84 $month = date( 'm' );
85}
86if ($year <= 0){
87 $year = date( 'Y' );
88}
89if ($day <= 0){
90 $day = date( 'd' );
91}
92
93$calself=basename($PHP_SELF);
94
95displayPageHeader($color, 'None');
96//load calendar menu
97calendar_header();
98
b01b21d0 99echo html_tag( 'tr', '', '', $color[0] ) .
100 html_tag( 'td' ) .
101 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
102 html_tag( 'tr' ) .
103 html_tag( 'td', '', 'left' ) .
f3409980 104 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
d61a01d4 105if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
106 if (isset($confirmed)){
107 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
b01b21d0 108 echo '<br><br>' . _("Event deleted!") . "<br>\n";
109 echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
110 _("Day View") . "</a>\n";
d61a01d4 111 } else {
112 readcalendardata();
113 confirm_deletion();
114 }
115} else {
116 echo '<br>' . _("Nothing to delete!");
117}
118
119?>
120</table></td></tr></table>
beb218e0 121</body></html>