6 * Copyright (c) 2002-2005 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
11 * Functions to delete a event.
15 * @subpackage calendar
21 define('SM_PATH','../../');
23 /* Calender plugin required files. */
24 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
25 require_once(SM_PATH
. 'plugins/calendar/functions.php');
27 /* SquirrelMail required files. */
28 require_once(SM_PATH
. 'include/validate.php');
29 require_once(SM_PATH
. 'functions/strings.php');
30 require_once(SM_PATH
. 'functions/date.php');
31 require_once(SM_PATH
. 'config/config.php');
32 require_once(SM_PATH
. 'functions/page_header.php');
33 require_once(SM_PATH
. 'include/load_prefs.php');
34 require_once(SM_PATH
. 'functions/html.php');
36 if (isset($_GET['month']) && is_numeric($_GET['month'])) {
37 $month = $_GET['month'];
39 elseif (isset($_POST['month']) && is_numeric($_GET['month'])) {
40 $month = $_POST['month'];
42 if (isset($_GET['year']) && is_numeric($_GET['year'])) {
43 $year = $_GET['year'];
45 elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
46 $year = $_POST['year'];
48 if (isset($_GET['day']) && is_numeric($_GET['day'])) {
51 elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
54 if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) {
55 $dyear = $_GET['dyear'];
57 elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) {
58 $dyear = $_POST['dyear'];
60 if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) {
61 $dmonth = $_GET['dmonth'];
63 elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) {
64 $dmonth = $_POST['dmonth'];
66 if (isset($_GET['dday']) && is_numeric($_GET['dday'])) {
67 $dday = $_GET['dday'];
69 elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) {
70 $dday = $_POST['dday'];
72 if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) {
73 $dhour = $_GET['dhour'];
75 elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) {
76 $dhour = $_POST['dhour'];
78 if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) {
79 $dminute = $_GET['dminute'];
81 elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) {
82 $dminute = $_POST['dminute'];
84 if (isset($_POST['confirmed'])) {
85 $confirmed = $_POST['confirmed'];
89 function confirm_deletion()
91 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
93 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
95 echo html_tag( 'table',
97 html_tag( 'th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"' )
100 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
101 html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
104 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
105 html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
108 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
109 html_tag( 'td', $tmparray['title'], 'left', $color[4] )
112 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
113 html_tag( 'td', $tmparray['message'], 'left', $color[4] )
117 " <form name=\"delevent\" method=\"post\" action=\"$calself\">\n".
118 " <input type=\"hidden\" name=\"dyear\" value=\"$dyear\" />\n".
119 " <input type=\"hidden\" name=\"dmonth\" value=\"$dmonth\" />\n".
120 " <input type=\"hidden\" name=\"dday\" value=\"$dday\" />\n".
121 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
122 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
123 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
124 " <input type=\"hidden\" name=\"dhour\" value=\"$dhour\" />\n".
125 " <input type=\"hidden\" name=\"dminute\" value=\"$dminute\" />\n".
126 " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n".
127 ' <input type="submit" value="' . _("Yes") . "\" />\n".
129 'right', $color[4] ) .
131 " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n".
132 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
133 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
134 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
135 ' <input type="submit" value="' . _("No") . "\" />\n".
139 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
143 $month = date( 'm' );
152 $calself=basename($PHP_SELF);
154 displayPageHeader($color, 'None');
158 echo html_tag( 'tr', '', '', $color[0] ) .
160 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
162 html_tag( 'td', '', 'left' ) .
163 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
164 if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
165 if (isset($confirmed)){
166 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
167 echo '<br /><br />' . _("Event deleted!") . "<br />\n";
168 echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
169 _("Day View") . "</a>\n";
175 echo '<br />' . _("Nothing to delete!");
179 </table
></td
></tr
></table
>