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