250ea2d5ed69a9298496aefba5b133008c242b23
6 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
8 * Functions to delete a event.
10 * @copyright © 2002-2005 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @subpackage calendar
20 define('SM_PATH','../../');
22 /* Calender plugin required files. */
23 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
24 require_once(SM_PATH
. 'plugins/calendar/functions.php');
26 /* SquirrelMail required files. */
27 require_once(SM_PATH
. 'include/validate.php');
28 require_once(SM_PATH
. 'functions/strings.php');
29 require_once(SM_PATH
. 'functions/date.php');
30 require_once(SM_PATH
. 'config/config.php');
31 require_once(SM_PATH
. 'functions/page_header.php');
32 require_once(SM_PATH
. 'include/load_prefs.php');
33 require_once(SM_PATH
. 'functions/html.php');
35 if (isset($_GET['month']) && is_numeric($_GET['month'])) {
36 $month = $_GET['month'];
38 elseif (isset($_POST['month']) && is_numeric($_GET['month'])) {
39 $month = $_POST['month'];
41 if (isset($_GET['year']) && is_numeric($_GET['year'])) {
42 $year = $_GET['year'];
44 elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
45 $year = $_POST['year'];
47 if (isset($_GET['day']) && is_numeric($_GET['day'])) {
50 elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
53 if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) {
54 $dyear = $_GET['dyear'];
56 elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) {
57 $dyear = $_POST['dyear'];
59 if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) {
60 $dmonth = $_GET['dmonth'];
62 elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) {
63 $dmonth = $_POST['dmonth'];
65 if (isset($_GET['dday']) && is_numeric($_GET['dday'])) {
66 $dday = $_GET['dday'];
68 elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) {
69 $dday = $_POST['dday'];
71 if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) {
72 $dhour = $_GET['dhour'];
74 elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) {
75 $dhour = $_POST['dhour'];
77 if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) {
78 $dminute = $_GET['dminute'];
80 elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) {
81 $dminute = $_POST['dminute'];
83 if (isset($_POST['confirmed'])) {
84 $confirmed = $_POST['confirmed'];
88 function confirm_deletion()
90 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
92 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
94 echo html_tag( 'table',
96 html_tag( 'th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"' )
99 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
100 html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
103 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
104 html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
107 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
108 html_tag( 'td', $tmparray['title'], 'left', $color[4] )
111 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
112 html_tag( 'td', $tmparray['message'], 'left', $color[4] )
116 " <form name=\"delevent\" method=\"post\" action=\"$calself\">\n".
117 " <input type=\"hidden\" name=\"dyear\" value=\"$dyear\" />\n".
118 " <input type=\"hidden\" name=\"dmonth\" value=\"$dmonth\" />\n".
119 " <input type=\"hidden\" name=\"dday\" value=\"$dday\" />\n".
120 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
121 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
122 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
123 " <input type=\"hidden\" name=\"dhour\" value=\"$dhour\" />\n".
124 " <input type=\"hidden\" name=\"dminute\" value=\"$dminute\" />\n".
125 " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n".
126 ' <input type="submit" value="' . _("Yes") . "\" />\n".
128 'right', $color[4] ) .
130 " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n".
131 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
132 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
133 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
134 ' <input type="submit" value="' . _("No") . "\" />\n".
138 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
142 $month = date( 'm' );
151 $calself=basename($PHP_SELF);
153 displayPageHeader($color, 'None');
157 echo html_tag( 'tr', '', '', $color[0] ) .
159 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
161 html_tag( 'td', '', 'left' ) .
162 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
163 if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
164 if (isset($confirmed)){
165 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
166 echo '<br /><br />' . _("Event deleted!") . "<br />\n";
167 echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
168 _("Day View") . "</a>\n";
174 echo '<br />' . _("Nothing to delete!");
178 </table
></td
></tr
></table
>