4 * Functions to delete a event.
6 * @copyright © 2002-2009 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @subpackage calendar
14 * Include the SquirrelMail initialization file.
16 require('../../include/init.php');
19 include_once(SM_PATH
. 'functions/date.php');
21 /* Calendar plugin required files. */
22 include_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
23 include_once(SM_PATH
. 'plugins/calendar/functions.php');
26 if (! sqGetGlobalVar('month',$month,SQ_FORM
) ||
! is_numeric($month)) {
29 if (! sqGetGlobalVar('year',$year,SQ_FORM
) ||
! is_numeric($year)) {
32 if (! sqGetGlobalVar('day',$day,SQ_FORM
) ||
! is_numeric($day)) {
35 if (! sqGetGlobalVar('dyear',$dyear,SQ_FORM
) ||
! is_numeric($dyear)) {
38 if (! sqGetGlobalVar('dmonth',$dmonth,SQ_FORM
) ||
! is_numeric($dmonth)) {
41 if (! sqGetGlobalVar('dday',$dday,SQ_FORM
) ||
! is_numeric($dday)) {
44 if (! sqGetGlobalVar('dhour',$dhour,SQ_FORM
) ||
! is_numeric($dhour)) {
47 if (! sqGetGlobalVar('dminute',$dminute,SQ_FORM
) ||
! is_numeric($dminute)) {
50 sqGetGlobalVar('confirmed',$confirmed,SQ_POST
);
55 * Displays confirmation form when event is deleted
58 function confirm_deletion() {
59 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
61 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
63 echo html_tag( 'table',
65 html_tag( 'th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"' )
68 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
69 html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$dmonth,$dday,$dyear)), 'left', $color[4] )
72 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
73 html_tag( 'td', date_intl(_("H:i"),mktime($dhour,$dminute,0,$dmonth,$dday,$dyear)), 'left', $color[4] )
76 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
77 html_tag( 'td', htmlspecialchars($tmparray['title']), 'left', $color[4] )
80 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
81 html_tag( 'td', nl2br(htmlspecialchars($tmparray['message'])), 'left', $color[4] )
85 " <form name=\"delevent\" method=\"post\" action=\"$calself\">\n".
86 " <input type=\"hidden\" name=\"dyear\" value=\"$dyear\" />\n".
87 " <input type=\"hidden\" name=\"dmonth\" value=\"$dmonth\" />\n".
88 " <input type=\"hidden\" name=\"dday\" value=\"$dday\" />\n".
89 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
90 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
91 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
92 " <input type=\"hidden\" name=\"dhour\" value=\"$dhour\" />\n".
93 " <input type=\"hidden\" name=\"dminute\" value=\"$dminute\" />\n".
94 " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n".
95 ' <input type="submit" value="' . _("Yes") . "\" />\n".
97 'right', $color[4] ) .
99 " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n".
100 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
101 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
102 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
103 ' <input type="submit" value="' . _("No") . "\" />\n".
107 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
111 $month = date( 'm' );
120 $calself=basename($PHP_SELF);
122 displayPageHeader($color);
126 echo html_tag( 'tr', '', '', $color[0] ) .
128 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
130 html_tag( 'td', '', 'left' ) .
131 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
132 if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
133 if (isset($confirmed)){
134 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
135 echo '<br /><br />' . _("Event deleted!") . "<br />\n";
136 echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
137 _("Day View") . "</a>\n";
143 echo '<br />' . _("Nothing to delete!");
147 </table
></td
></tr
></table
>